Configuring HTTP Connection Throttling

When a web application experiences overwhelming traffic, it's better if you start queuing or dropping some connections than to exhaust server resources trying to serve them all at once. Within server.xml , you can set limits on the number of simultaneous connections allowed and choose how many connections should be queued before incoming requests result in server errors or redirects to a specified URL.

The following example shows the default configuration:

 <max-http-connections max-connections-queue-timeout="10" socket-backlog="30" value="100000"/> 

In this case, if the server needs to start refusing some requests, it will return "Server Busy" errors instead of the requested pages. If you would prefer to have it redirect to a user -friendly error page, just include that URL inside the <max-http-connections> element, as follows :

 <max-http-connections max-connections-queue-timeout="10" socket-backlog="30" value="100000">http://www.acme.com/unavailable.html</max-http-connections> 

The <max-http-connections> element allows the following attributes:

  • Value . The maximum number of HTTP connections that will be serviced concurrently. The default is 100,000, which is probably unmanageable on most hardware configurations.

  • socket-backlog . The maximum number of HTTP connections that will be queued before socket connections are rejected. The default is 30.

  • max-connections-queue-timeout . The maximum number of seconds that a connection may remain in the queue before the server sends a busy notification or redirect to the client and drops the connection. The default is 10.

The optimal value for each of these parameters is highly dependent on the underlying hardware and operating system. To tune, run load tests and observe how many concurrent connections the application server can handle before performance becomes unacceptable. Set your max-http-connections value a bit lower than this breaking point and run tests to ensure that the server no longer fails under excess load. This gives you a good baseline, from which you can systematically adjust all three parameters to find the best-performing combination.

Tip 

There are a number of open -source and commercial load generators that will let you create a test plan through your browser and then execute it hundreds or thousands of times in parallel, to simulate heavy traffic. If you have the budget, take a look at Mercury 's LoadRunner ( www.mercury.com/us/products/performance-center/loadrunner/ ). Otherwise check out the open-source JMeter project ( http://jakarta.apache.org/jmeter ).



Oracle Application Server 10g. J2EE Deployment and Administration
Oracle Application Server 10g: J2EE Deployment and Administration
ISBN: 1590592352
EAN: 2147483647
Year: 2004
Pages: 150

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net