RFR: 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.
Thanks for reviews.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/15581#issuecomment-1711062898
More information about the serviceability-dev
mailing list