Thread.dump_to_file time

Dr Heinz M. Kabutz heinz at javaspecialists.eu
Tue Sep 5 11:26:40 UTC 2023


Hi,

I was wondering about the cost of generating the thread dumps with jcmd 
Thread.dump_to_file and how this would affect the practicality of 
finding issues in thread dumps. I thus spun up more and more virtual 
threads to see how long it would take to call jcmd Thread.dump_to_file.

No surprise that the time is linear. Also no surprise that json is 
slower to generate than plain.

What did surprise me was how much slower it was to generate these on my 
MacBookPro vs my server. The machines are roughly the same speed, and my 
MBP has a very fast SSD. I'm not sure why it would be so slow, but the 
MBP is approximately 3x slower for generating the dumps:

The generated dumps are also (understandably) large.

For 2m threads, it took 1m34s to generate the plain dump on Linux and 
2m7s for the JSON dump. This is probably an acceptable time. On the Mac 
it is 4m28s and 6m10s respectively.

However, it might be more tricky if threads are being created and 
stopped whilst the dump is being taken, since we might never get to the 
end of the dump.

In terms of LOC in the dumps, this is dependent on the stack depths of 
the threads.


	

Linux

	

Mac OS X

Threads

	

Plain

	

JSON

	

Plain

	

JSON


	

time

	

LOC

	

time

	

LOC

	

time

	

time

4000

	

0.3s

	

48k

	

0.4s

	

64k

	

0.7s

	

0.8s

8000

	

0.5s

	

96k

	

0.6s

	

128k

	

1.2s

	

1.6s

16000

	

0.8s

	

192k

	

1.2s

	

256k

	

2.5s

	

3.4s

32000

	

1.6s

	

384k

	

2.1s

	

512k

	

4.4s

	

6.3s

64000

	

3s

	

768k

	

4.6s

	

1m

	

9s

	

13s

128000

	

6s

	

1.5m

	

9s

	

2m

	

18s

	

27s

256000

	

12s

	

3m

	

16s

	

4m

	

39s

	

53s

512000

	

23s

	

6m

	

32s

	

8m

	

1m16s

	

1m42s

1024000

	

47s

	

12m

	

1m5s

	

16m

	

2m27s

	

3m28s

2048000

	

1m34s

	

25m

	

2m7s

	

33m

	

4m28s

	

6m10s


Regards

Heinz
-- 
Dr Heinz M. Kabutz (PhD CompSci)
Author of "The Java™ Specialists' Newsletter" -www.javaspecialists.eu
Java Champion -www.javachampions.org
JavaOne Rock Star Speaker
Tel: +30 69 75 595 262
Skype: kabutz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20230905/b462902a/attachment-0001.htm>


More information about the loom-dev mailing list