Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8186750

Examine buffering and memory usage in the HTTP Client

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • None
    • 10
    • core-libs

      The HTTP/2 implementation queues up ByteBuffers ( typically 16K heap byte buffers) for a complete Data Frame before pushing them to the body processor.
      HTTP/1.1 streams bytes (wrapped in 8K heap byte buffers ) out to the response body processor. A number of response body processors simply queue these up in a list until onComplete ( asString, asByteArray, buffering ).

      A simple test case that performs a GET request serviced by a pathological server ( returns body byte-at-a-time ) demonstrates that an excessive amount of memory is used to consume a 16K response body, ~125MB for HTTP/1.1 and ~250MB for HTTP/2.

      The memory is consumed because the ByteBuffers typically contain just a single byte of data, out of their 8K or 16K encapsulated heap byte[]. Attachments demonstrate memory usage for a GET request repeated multiple times.

            chegar Chris Hegarty
            chegar Chris Hegarty
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: