Uploaded image for project: 'JGroups'
  1. JGroups
  2. JGRP-1991

TCP_NIO2: copy on demand

    XMLWordPrintable

Details

    • Enhancement
    • Status: Resolved (View Workflow)
    • Major
    • Resolution: Done
    • None
    • 3.6.7
    • None

    Description

      When TCP_NIO2 writes data, we always pass a copy of data of it, because of JGRP-1961 [1].
      However, if we copied the data only on a partial write (full writes don't need a copy), then we could always pass data from reused buffers down to the transport.

      Example: we want to write 3 buffers of 100, 200 and 700 bytes in a gathering write (the buffers are allocated from reusable byte[] arrays).
      If the write returns 1000, we know that all 3 buffers have been written and there is no need to copy any of the buffers. However, if only 500 bytes were written, then we can trash the first 2 buffers, but need to make a copy of the 3rd buffer in range [201 .. 700].

      This allows the sender to reuse previously allocated buffers, as all transports (UDP, TCP, TCP_NIO2) now guarantee that, on return of the send(), either the data was written completely, or a copy was made.

      [1] https://issues.jboss.org/browse/JGRP-1961

      Attachments

        Issue Links

          Activity

            People

              rhn-engineering-bban Bela Ban
              rhn-engineering-bban Bela Ban
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: