How to configure Tomcat to use more than 1 CPU?

后端 未结 2 384
长发绾君心
长发绾君心 2021-02-04 11:37

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 ha

相关标签:
2条回答
  • 2021-02-04 12:11

    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.

    0 讨论(0)
  • 2021-02-04 12:16

    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!

    0 讨论(0)
提交回复
热议问题