Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] How to configure max requests per connection in Jetty 8?


We don't have that particular setting.  I've never really seen the reason for it.  If the client is sending regular request, then closing the connection after N requests will just make it open a new connection, which is more work for everybody?  Maybe tomcat offers it as some kind of memory leak clearance, but jetty doesn't have any such leaks, so we never have seen the need.

Ah I see your reason is that you want better load balancing.   Well rather than have some code counting requests and connections, you can probably just have a filter that randomly adds the Connection:close header to the response and that will give you pretty much the same effect of helping level your load balancer.

You can also look at our lowResourcesMonitor and DoSFilter for other approaches that may help.

cheers





On 26 April 2016 at 06:57, Pranay Dalmia <pranaydalmia@xxxxxxxxx> wrote:
Hi, 

I'm using Jetty 8 and want to add some sort of periodic "graceful" connection closing. My client's use connection keep-alives. 

Currently, I only close the connection if it has been idle for 60 seconds. However, there is no closing of connections if a client keeps sending occasional requests, say, once every 60 seconds. 

I want to add another closing strategy, which is basically limiting the max number of requests a connections can serve, before the server closes it. The client will be forced to re-connect and I will get better load-balancing :-) 

Tomcat has a setting called maxKeepAliveRequests, which controls this setting. Does Jetty have something similar? If not, is there any sample code to do something similar? 

Thanks
Pranay


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users



--

Back to the top