[英]How to reduce the number of threads used by the jvm
I'm running a single threaded Java app on the following java version: 我在以下java版本上运行单线程Java应用程序:
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
with the -XX:+UseSerialGC
option enabled. 启用
-XX:+UseSerialGC
选项。 Still when I start the application I see multiple threads starting when monitoring the system with htop
. 仍然在我启动应用程序时,我看到在使用
htop
监视系统时会启动多个线程。 I'd like to reduce the number of processes started as much as possible since I have a use case which involves running multiple instances of this application and this will hit the roof of the maximum allowed number of process on the system that I'm running on. 我想尽可能减少启动的进程数,因为我有一个用例,它涉及运行此应用程序的多个实例,这将触及我正在运行的系统上允许的最大进程数量上。 Are there any other jvm options other than
-XX:+UseSerialGC
that I could use to reduce the number of threads starting? 除了
-XX:+UseSerialGC
之外是否还有其他jvm选项-XX:+UseSerialGC
我可以用来减少线程的数量?
Apart from -XX:+UseSerialGC
which disables Parallel or Concurrent GC, there are the following options to reduce the number of JVM threads: 除了
-XX:+UseSerialGC
禁用并行或并发GC之外,还有以下选项可以减少JVM线程的数量:
-XX:CICompilerCount=1
leaves only one JIT compiler thread. -XX:CICompilerCount=1
只留下一个JIT编译器线程。 -XX:+ReduceSignalUsage
disables Signal Dispatcher thread. -XX:+ReduceSignalUsage
禁用Signal Dispatcher线程。 Eg JVM will not handle SIGQUIT to dump threads. -XX:+DisableAttachMechanism
prevents AttachListener thread from starting. -XX:+DisableAttachMechanism
阻止AttachListener线程启动。 In theory it is possible to disable even more threads (eg Service Thread and VM Periodic Task Thread) but this would require patching JVM. 从理论上讲,可以禁用更多线程(例如服务线程和VM周期任务线程),但这需要修补JVM。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.