wtorek, 31 maja 2022

Async Profiler - quick profiling for any application

Are you tired of setting up Java APM agents, configuring some arcane ENV variables (does "org.jboss.logmanager" ring any bells)? Just try Async Profiler ( https://github.com/jvm-profiling-tools/async-profiler ). It is even trivial to use on your already *running* docker images. For example: 

$ kubectl -n my-namespace cp ./async-profiler-2.8-linux-x64.tar.gz my-pod:/root $ winpty kubectl -n my-namespace exec -it my-pod bash root@my-pod:/# cd /root root@my-pod:~# tar xf async-profiler-2.8-linux-x64.tar.gz root@my-pod:~# cd async-profiler-2.8-linux-x64 root@my-pod:~/async-profiler-2.8-linux-x64# ./profiler.sh -d 1200 -i 10ms -f profile.html 6 Profiling for 1200 seconds Done root@@my-pod:~/async-profiler-2.8-linux-x64# exit kubectl -n my-namespace cp my-pod:/root/async-profiler-2.8-linux-x64/profile.html ./profile.html
Where "-i 10ms" was how often to run sampling and "6" was the pid of java process (you can check for one with `jps` or plain old `ps`). You can view the resulting flame graph (the local "profile.html" file) in any browser.

Brak komentarzy:

Prześlij komentarz