Integrated: 8315702: jcmd Thread.dump_to_file slow with millions of virtual threads
Alan Bateman
alanb at openjdk.org
Fri Sep 8 04:42:50 UTC 2023
On Wed, 6 Sep 2023 07:02:53 GMT, Alan Bateman <alanb at openjdk.org> wrote:
> `HotSpotDiagnosticMXBean.dumpThreads` and `jcmd Thread.dump_to_file` are slow when there is a large number of threads.
>
> The thread dump can be sped up significantly with some small changes:
> - Using println rather than format when printing the thread info and thread stacks
> - Wrap the underlying file output stream in a BufferedOutputStream
>
> With 200k virtual threads on macOS, the plain format thread dump goes from 22s to 1.8s, and the json format thread dump goes from 31s to 2.8s on one system that I tried. On a Linux system, also with 200k threads, the plain thread dump goes from 8.7s to 2.9s, and the json format thread dump from 12.4s to 4.5s.
This pull request has now been integrated.
Changeset: 3c258ac9
Author: Alan Bateman <alanb at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/3c258ac907287850d690375bae07c0575d1f1463
Stats: 19 lines in 1 file changed: 8 ins; 0 del; 11 mod
8315702: jcmd Thread.dump_to_file slow with millions of virtual threads
Reviewed-by: mchung, amenkov, jpai
-------------
PR: https://git.openjdk.org/jdk/pull/15581
More information about the serviceability-dev
mailing list