How to configure Tomcat to use more than 1 CPU?

后端 未结 2 377
长发绾君心
长发绾君心 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 
    

    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.

提交回复
热议问题