Community
Participate
Working Groups
Currently jetty keeps request/response objects associated with a connection and reuses them for each request received. With modern garbage collectors, this may not be an ideal strategy, as it may encourage request/response object (and their associated objects) to migrate into old generation, since the lifetime of a connection is often be many minutes. It may be better to simply recreate new request/response objects for each request. This would free memory while the connection is idle and reduce the chances of those objects ending up in old gen. Note that Async Servlets and techniques like long polling will fight against this, as they increase the lifespan of request objects. However protocols like websocket may make long polling less utilised. Another problem with recycling request/responses/continuations/AsyncContexts, is that it makes it harder to detect programming errors in asynchronous code, which wrongly holds onto a reference beyond the objects lifecycle. We need to evaluate if recycling is still a net benefit.
In addition to the comment above, we need to investigate if recycling of data contained in the request object is effective. The HTTP headers name/values will sum up for a large amount of memory occupied by each request, so using interned strings for those may be more effective than recycling the request object that wraps them.
Evaluations in Jetty-9 have show
https://github.com/eclipse/jetty.project/issues/95