tags:

views:

70

answers:

2

We have a new client, and currently we are performing stress test on the production like server with 100 concurrent http threads (using Jmeter). The problem is even though we have 2 Xeon Processor (each CPU with 4 core, total to 8 core), i can only see tomcat utilizing 4 cores, not 8 cores. the 4 cores i believe it belongs to only 1 processor. the other 4 threads is virtually sleeping.

i got the impression from the Apache document that if we have multi CPU machine, we should configure acceptorThreadCount="2" : http://tomcat.apache.org/tomcat-6.0-doc/config/http.html

We have change the default connector to tomcatThreadPool with maxThreads="150" minSpareThreads="4" and connector executer to have acceptorThreadCount="2". But it is only still utilizing 1 CPU.

Any idea how to configure to utilize all cores (or all CPU's processors)?

+1  A: 

A couple random thoughts to help you out.

The JVM will do its own scheduling of tasks internally. There are times if the JVM does not think that one CPU is being over taxed it may reserve a few cores for critical operations. Therefore you see some cores being used and others sitting idle.

Another possibility is that the CPU affinity needs to be explicitly set. In Unix you can check which CPU's the JVM has been chosen to use with the taskset command::

taskset -p <pid>

In Windows, bring up your task manager, go to the process tab, right click a process and choose set Affinity. You can see which CPU/Cores are set to be used.

I am not aware of a start-up parameter in Java/Tomcat to control CPU usage. I believe this should be on the OS level. I also dont recall ever reading about the JVM being coded to limit the number of CPU/Cores being used.

Sean
A: 

Comment by @JoseK triggers the whole bottleneck. our application is writing too many log. on one instance we were trying to reduce the amount of log in our log file, we notice the overall performance is better and higher CPU utilization.

We then try with log4k log level to "WARN", and wow! the application is utilizing 70% of all CPU cores.

We should check the Disk utilization before even asking the question. Thanks!

Reusable
It is likely not disk access, but rather internal locking in the logging framework that throttle your application to perform more serially.
nos
Could be. all we know now is turning off the log, the application performs better. i still have 2 more days to play around. is there any better logging framework or any special configuration in Log4j that could be faster?
Reusable