merlimat commented on issue #1108: Replace DoubleByteBuf with CompositeByteBuf 
because of perf regression with Netty > 4.1.12
URL: https://github.com/apache/bookkeeper/pull/1108#issuecomment-362442893
 
 
   
   > allocations are from its
   > 
   >     public ByteBuffer nioBuffer(int index, int length) {
   >         ByteBuffer dst = isDirect() ? ByteBuffer.allocateDirect(length) : 
ByteBuffer.allocate(length);
   > 
   > Composite also ends up doing
   > 
   >         ByteBuffer merged = ByteBuffer.allocate(length).order(order());
   > 
   > if it is wrapped around > 1 buffers.
   > so you are trading a chance for direct buffer allocation for always 
on-heap allocation.
   
   I don't see the heap being used when wrapping direct buffers. I got a memory 
dump when running after the patch and I don't see the heap being polluted.
   
   > We use DoubleByteBuf to wrap (header, data) tuple i.e. in 
computeDigestAndPackageForSending.
   > Header is of fixed size for given ledger. so I got rid of DoubleByteBuf 
and preallocated enough space > in single buffer to have data after offset for 
header and populated it.
   
   Though this would mean to copy each payload into a buffer that contains 
header+payload, right?
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to