Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-6663

conserve-sockets=false can cause buffer fragmentation



    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • messaging


      When conserve-sockets is set to false it enables an optimization called direct ack. This optimization allows the reply message to be sent directly back to the requestor on the same socket it sent to request. But the way the reply is read (see Connection.readAck) can cause small direct ByteBuffer instances to be created and added to the queue in the Buffers class. These small buffers can then cause future allocations from the queue to be slower because the small ones are removed and and added back to the end of the queue.

      I think it would be better for readAck to allocate one of this fixed size: "this.owner.getConduit().tcpBufferSize" instead of basing it off of the reply message size.

      That would keep the all the ones in Buffers the same size.

      It is possible that the "inputBuffer" owned by Connection could be used. But Bruce had this warning regard it: "Be careful about using the Connection's input buffer.  I had so much trouble with multi-threaded access to that buffer that I decided not to use it in MsgReader."




            Unassigned Unassigned
            dschneider Darrel Schneider
            0 Vote for this issue
            3 Start watching this issue