11

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)?

3
  • 1
    The JVM does the utilization, so may be your load is not high enough yet. Can you increase and try?
    – JoseK
    Sep 17, 2010 at 10:19
  • i have try with 200 and 300 threads, it is still the same.
    – Reusable
    Sep 17, 2010 at 12:06
  • Just for my help, could you please let me know how yoy tracked down that jvm is not using all cores and it's threads. I meant which tool? I am also planning to diagonse performance issue for one of application deployed on tomcat. Sep 16, 2019 at 3:02

2 Answers 2

4

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.

4

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!

3
  • It is likely not disk access, but rather internal locking in the logging framework that throttle your application to perform more serially.
    – nos
    Oct 19, 2010 at 11:12
  • 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
    Oct 19, 2010 at 23:59
  • 1
    @Reusable: Way too late to be any help --- most logging frameworks have a network appender. They tend not to suffer from the file locking issues you describe.
    – Peter K.
    Feb 5, 2014 at 13:44

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.