How to reduce the number of threads used by jvm

I am running a single threaded Java application in the following java version:

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 option enabled -XX:+UseSerialGC

. However, when I start the application, I see multiple threads starting from monitoring the system with htop

. I would like to reduce the number of running processes as much as possible, since I have a use case that involves launching multiple instances of this application and that will hit the roof of the maximum number of processes allowed on the system I am running on. Are there any other jvm options besides -XX:+UseSerialGC

that I could use to reduce the number of thread starts?

+3


source to share


1 answer


Besides -XX:+UseSerialGC

which disables parallel or parallel GC, there are the following options to reduce the number of JVM threads:

  • -XX:CICompilerCount=1

    leaves only one JIT compiler thread.
  • -XX:+ReduceSignalUsage

    disables the signal manager thread. For example. The JVM will not handle SIGQUIT to flush threads.
  • -XX:+DisableAttachMechanism

    prevents the AttachListener from starting.


In theory, it is possible to disable even more threads (such as the service thread and the VM periodic task thread), but this would require a JVM patch.

+8


source







All Articles