I have a web application that uses Apache web server and tomcatservlet engine. I am doing performance tests using jMeter.
1) I ran a test with 150 threads(users) each sending 1 request per minute (configured in jmeter using a constant timer with value 40 secs ) and the average response time was 30secs.
2) I ran another test with 75 threads(users) each sending 2 reqs per minute ( again configured in jmeter using a constant timer with value 20 secs ) and noted that the average response time was 15 secs.
In both the tests, the throughput of the server recorded was 130 req/minute.
I am confused why there is a huge difference in the response time if i increase the number of threads, though the throughput, CPU usage heap size etc remain the same.
Welcome to the JavaRanch.
I don't know much about Tomcat internals, but my knee jerk reaction is to blame session overhead. 150 clients will have twice the overhead 75 clients would have.
Have you tuned the number of threads your server uses? Look at the Connector configuration in server.xml, in particular maxThreads/minSpareThreads/maxSpareThreads. It looks like the defaults are 150/25/75, which means if you hit Tomcat with 150 simultaneous requests, it's got to do some work to bring up 125 new threads. That's going to impact response time. Then Tomcat is going to keep 75 of those threads around for subsequent requests (you don't tell us if you restart Tomcat between tests) so when you retest with 75 clients, Tomcat already has 75 threads ready. It should respond to those subsequent requests faster.
I kept the tests running for a whole night, so i guess the thread startup has little overhead for a long run.
I had restarted my server for both the tests, and i had changed the configuration in server.xml as follows
One more symptom that i see is that the classes loaded keeps increasing during the test, till it goes upto 40000 in about 3 hours even though all the threads are sending the same request. Then it comes down ( i guess garbage collection ). I am setting permMaxSize=128m, minheap=256m maxheap=512m.
I should also say that my web application processing involves a lot of XSLTC processing.
subject: Tomcat performance problem with increased no of threads