简体   繁体   English

Java多线程峰值处理器的使用

[英]Java multithreading peak processor usage

I seem to have a strange reading on the processor usage of a heavily loaded multi-threaded Java application (started using the Client JVM). 我似乎对一个负载很重的多线程Java应用程序(使用Client JVM启动)的处理器使用情况有一个奇怪的解读。

The problem is that even under heavy load, the processor usage peaks at 99.9% (seen using the top system utility on a Debian Linux Kernel 2.6). 问题是即使在高负载下,处理器使用率也达到了99.9%(使用Debian Linux Kernel 2.6上的顶级系统实用程序)。 This seems strange, as the server is an 8 core, and I would thus expect something heading into >100% teritory for heavy load. 这看起来很奇怪,因为服务器是一个8核心,因此我希望有一些东西可以达到> 100%的重负荷。

Are there any JVM options that I should consider or any system parameters I should have a look into? 是否有我应该考虑的JVM选项或我应该查看的任何系统参数?

I am currently using the following parameters for JVM startup: 我目前正在使用以下参数进行JVM启动:

  java -XX:PermSize=128M -XX:MaxPermSize=512M -Xss1024k -Xms512M -Xmx2048M

The most likely cause of the observed processor usage is that your application has an concurrency bottleneck that is effectively limiting it to the speed of a single thread on average. 观察到的处理器使用的最可能原因是您的应用程序具有并发瓶颈,有效地将其限制为平均单个线程的速度。

Changing JVM options is unlikely to make a significant difference. 更改JVM选项不太可能产生显着差异。 What you need to use a Java performance analyser to figure out where the bottlenecks are, and figure out how to eliminate them. 您需要使用Java性能分析器来确定瓶颈的位置,并找出如何消除它们。

heavily loaded multi-threaded Java application (started using the Client JVM). 负载很重的多线程Java应用程序(使用Client JVM启动)。

That sounds like a bad idea. 这听起来像个坏主意。 The Client VM is design for small, light weight applications such as applets on 32-bit systems. 客户端VM专为小型,轻量级应用程序而设计,例如32位系统上的applet。 I suggest you using the Server VM which is the default on Linux, Solaris and 64-bit Windows. 我建议你使用Server VM,它是Linux,Solaris和64位Windows的默认设置。

This seems strange, as the server is an 8 core, and I would thus expect something heading into >100% teritory for heavy load. 这看起来很奇怪,因为服务器是一个8核心,因此我希望有一些东西可以达到> 100%的重负荷。

This means your application is effectively single threaded. 这意味着您的应用程序实际上是单线程的 You may be trying to use multiple threads but unless they can act independantly, they cannot run more than one at a time. 您可能尝试使用多个线程,但除非它们可以独立操作,否则它们不能一次运行多个线程。

Are there any JVM options that I should consider or any system parameters I should have a look into? 是否有我应该考虑的JVM选项或我应该查看的任何系统参数?

Command line options have no control over this. 命令行选项无法控制此操作。 It is entirely down to how your threads interact. 这完全取决于您的线程如何交互。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM