4

Am monitoring a java application for thread lock scenario,

In visualvm under monitor tab,

Live threads : 112 Live Peak : 126 Daemon thread : 99 Total started : 135,742

What does this mean? I feel its not right to have so much total started threads count. Is there any optimal number for thread creation? Am new to java programming . please help

3
  • How long had the VM been running and what does the application(s) o? Of course there can't be any optimal started threads count. How could there be when applications can do different things?
    – Kayaman
    Jun 17, 2015 at 5:21
  • @Kayaman the VM was running for about 15hrs. The application does reads a file and stores it in DB.Problem is when the application runs linux runs out of resource, even opening a terminal is not happening. So, guessed the linux might ran out of max thread count and no process is further created. However rebooting the system helped. Jun 17, 2015 at 5:27
  • 1
    Well that does seem high for such an application for that time (~150 threads started per minute). But that's just the number for the total number of threads started, as you can see there has been at most 126 live threads at the same time, and that's not a problem.
    – Kayaman
    Jun 17, 2015 at 5:33

1 Answer 1

4

Make sure that your program is using ThreadPool, which will make efficient use of threads.

The total thread count is number of threads started since the JVM is started. Live threads started(peak) is 126 threads so this looks normal & current live thread count is 112 this include all the threads Daemon/non-daemon threads not just started by your program but by JVM as well.

What does it mean by each count:

Live threads: This shows the current number of live/active threads including both daemon and non-daemon threads(Currently running).

Live Peak: This gives the peak count of live threads since the Java virtual machine started or peak was reset.

Daemon Threads: This gives the current number of live daemon threads.

Total Threads: This gives the total number of threads created and also started since the Java virtual machine started.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.