What is the best way to limit the number of simultaneous user sessions using Apache (IHS/2.0.42) and WebSphere (5.1) for high traffic periods?

The desired solution should limit users and present those who do not gain access to the site with a HTML page explaining the current traffic situation and ask them to return. Those users who do make it into the site should be allowed to navigate freely until either they close their browser or their session expires.

The architecture is 3-tiered (separate web, application, and database servers) with multiple servers at each tier. Currently our application and database servers are being taxed by the traffic while the web server is holding up strong to the traffic.

  • Can you specify whether it's authenticated or unauthenticated traffic that is bogging down your application server & database? If it's authenticated, you may be able to do something at login time. – M. Lucas Jul 7 '09 at 16:19

Unfortunately this will be hard to do with Apache as it is most likely your bottleneck. Out of the box Apache can handle a maximum of 256 connections at once. This include your proxied Websphere data, and also your static files being sent directly from Apache. You'd be suppressed how many separate connections a client can use up.

There are a few things you can do to increase the number of connections Apache can support, switching to mod_worker_mpm for instance may help.

The difficulty in serving a lucid 'server overloaded' page will come just at the point that your server is overloaded. That is to say, when things are fine, you don't want to waste resources counting active sessions, etc. And when things are going badly, the last thing you want to do is add more load to your server doing expensive calculations.

It is not possible to reserve connections for people who already have a session, because http is request oriented, not session oriented. That is to say, if they can't make a connection because your web server is overloaded, then their session isn't going to get them any sort of priority.

Having said all that here are a few things I recommend:

  • mod_worker_mpm (unless your use php, which I don't think you are)
  • be prepared to tweak your apache and websphere configs. I don't have a lot of experience with websphere, but you will have to make sure it can handle as many connections as apache can, so it won't become the next bottleneck
  • replace the standard ErrorDocuments with custom ones, specifically 502 and 503
  • watch your apache error logs for warnings about max client exhaustion
  • keep a close eye on your servers memory, apache has a tendancy to spawn many many processes, which can quickly make your server swap, right at the point you don't need it too.

If none of that helps I would consider the following

  • switch to a single threaded web server, there are a few to choose from, most also support some per IP connection limiting, which may be useful
  • if apache is just acting as a proxy, consider something like HAProxy which is much better at dealing with a large number of proxy connections
  • be prepared to tune your application to be more efficient under load
  • Thanks for the help. I have updated the original question to specify that Apache is NOT the bottleneck. – sirrhosys May 21 '09 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy