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)?
Yes, if a process in top goes over 100% or top shows >1.0 in load, this means that more than one core is occupied, or the system is oversubscribed. Oversubscription means that there is more work to be put onto the core than is phsyically manageble.
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.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With