Created attachment 31618 [details] diff file of
in AbstractServletOutputStream, there is an output buffer to save the unwritten bytes for one write in non-blocking mode. However the buffer is allocate each time it's needed and will cause many unnecessary trash. We observed it during our performance testing when the server runs for long time at high TPS, the GC over head is getting larger. After improvement the GC overhead is lowered and CPU usage is also lowered with same TPS.
it's in package org.apache.coyote.http11.upgrade
Here TPS is Transaction Per Second which indicates the throughput of the server.
Created attachment 31619 [details] AB testing result for performance the red line is the performance of the patched server while the green one is the base.
The other thing that would significantly reduce garbage is not to copy the data from the buffer to a new buffer if it is not fully written.
Fixed in 8.0.x for 8.0.9 onwards and in 7.0.x fir 7.0.55 onwards.