Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 370088 - Evaluate if Request recycling is still valid?
Summary: Evaluate if Request recycling is still valid?
Status: CLOSED MOVED
Alias: None
Product: Jetty
Classification: RT
Component: server (show other bugs)
Version: 8.1.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 9.0.x   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-30 01:23 EST by Greg Wilkins CLA
Modified: 2016-02-16 18:45 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Greg Wilkins CLA 2012-01-30 01:23:59 EST
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.
Comment 1 Simone Bordet CLA 2012-01-31 04:16:26 EST
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.
Comment 2 Greg Wilkins CLA 2013-01-24 19:57:03 EST
Evaluations in Jetty-9 have show
Comment 3 Jesse McConnell CLA 2016-02-16 18:45:52 EST
https://github.com/eclipse/jetty.project/issues/95