1

I have a 3.5 GB 2 CPU server running on tomcat/apache with mod.jk. We are seeing our server itself having plenty of memory available and tomcat is not showing anything crazy in terms of GC.

We have been trying different settings for the maxClients maxThreads and the socket_timeout in workers.properties.

we are averaging around 4000 concurrent users, its a bit hard to estimate number of requests per second but its probably 400 i would say (just a guess).

Should the maxThreads in tomcat always be greater than maxClients in httpd? and if so by how much.

We tried maxClients at 250 and maxThreads at 300 and we were seeing slowness form the web but the server looked fine.

Also our average httpd size is 10mg.

Any help would be great!

Thanks

1

You don't say which MPM you are using or which Tomcat version so I can't be as precise as would like.

AJP uses persistent connections by default. Therefore, by default, Tomcat needs at least as many threads in its thread pool as httpd has maxClients. This tends to be very inefficient as most of those connections will be idle.

There are a couple of ways to improve things:

  1. Switch to the NIO AJP connector if available (Tomcat 7 onwards). You'll need to configure Tomcat's AJP connector with maxThreads > expected concurrent requests.

  2. Disable connection re-use on the httpd side. With mod_jk that means using

    JkOptions +DisableReuse

Ignore the warnings in the docs about a performance penalty - they are not correct. You'll still need to configure Tomcat's AJP connector with maxThreads > expected concurrent requests.

For more details see my reverse proxy presentation and Rainer's notes on it.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.