Reputation: 689
I'm running a single threaded Java app on 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 -XX:+UseSerialGC
option enabled. Still when I start the application I see multiple threads starting when monitoring the system with 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?
Upvotes: 6
Views: 6352
Reputation: 98304
Apart from -XX:+UseSerialGC
which disables Parallel or Concurrent 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 Signal Dispatcher thread. E.g. JVM will not handle SIGQUIT to dump threads.-XX:+DisableAttachMechanism
prevents AttachListener thread from starting.In theory it is possible to disable even more threads (e.g. Service Thread and VM Periodic Task Thread) but this would require patching JVM.
Upvotes: 10