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.
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.