Comment 1 for bug 985117

Revision history for this message
Peter Beaman (pbeaman) wrote :

Upon further investigation, it appears that IOUtil.java potentially allocates and caches a direct ByteBuffer for each thread. The cached buffers are head in SoftReferences, but I assume multiple threads could be backed up waiting to write to the journal, and therefore multiple threads could temporarily hold strong references to their DirectByteBuffers; this could exhaust the address space available for direct buffer allocation?

Bottom line is that the JournalManager's _writeBuffer field should be allocated as a direct buffer to avoid all the extra allocation and copying. There is a reference to the array() method in readFully that will need to change; the arraycopy operation can be done instead by a carefully executed call to put(bb) where bb is the destination ByteBuffer.

This change could improve performance, due primarily to gc and to a lesser extend, avoided array copying.