kubectl-prof icon indicating copy to clipboard operation
kubectl-prof copied to clipboard

Adding multi-arch to jvm based profiling

Open kikokikok opened this issue 1 year ago • 3 comments

ADDED: switched to buildx to ease the multi-platform builds ADDED: Variabilization of the async-profiler version CHANGED: switched to supported version of Java container images as a base images fixes #34

kikokikok avatar May 13 '24 15:05 kikokikok

I think that it will not work now: https://github.com/josepdcs/kubectl-prof/blob/c5d294ea36192b24ce769beda081eba33808744a/internal/agent/profiler/jvm/jcmd.go#L29

By the way, you can test your customized image by using the flag: --image and check that everything still working

josepdcs avatar May 13 '24 16:05 josepdcs

I think that it will not work now:

https://github.com/josepdcs/kubectl-prof/blob/c5d294ea36192b24ce769beda081eba33808744a/internal/agent/profiler/jvm/jcmd.go#L29

By the way, you can test your customized image by using the flag: --image and check that everything still working

Ok thanks will try that, didn't know how I could test locally built images. I thought the CI would be a effective way of identifying the issues. Will definitely try the --image to test it locally, shouldn't be an issue.

kikokikok avatar May 13 '24 16:05 kikokikok

updated and tested for debian and alpine based images. I've added a custom built java sdk containing only jcmd to reduce resulting image sizes For Alpine, I had to add an async-profiler build-stage as they don't provide the native libs for arm64.

kikokikok avatar May 21 '24 16:05 kikokikok

Hi, @kikokikok

Have you tried generating a Heapdump or a JFR with JCMD? Please let me know if it worked for you, whether you used Alpine or not. If it worked, I will accept the PR. Thank you

josepdcs avatar May 27 '24 06:05 josepdcs

Done, I've tested all scenario you mentioned and everything is working. Had a glitch on the minideb based JDK which is now fixed and an issue I suppose you had also due to the split binary which was not compatible with the -e argument. Everything is functional on my side for both distributions.

kikokikok avatar May 27 '24 08:05 kikokikok

kubectl prof back-0 --target-container-name back --runtime-path "/run/k3s/containerd" -t 5m -l java -o heapdump --tool jcmd --namespace kapp --image=zot.kyri.test/kubectl-prof:v1.3.17-dev-jvm
Verifying target pod ... ✔ Launching profiler ... ✔ Profiling ... ✔ Remote profiling file downloaded in 14.967091 seconds. ✔ The profiling result file [agent-heapdump-27858-1-2024-05-27T08_51_45Z.hprof] was obtained in 64.394824 seconds. 🔥 ➜ kubectl-prof git:(main) ✗ kubectl prof back-0 --target-container-name back --runtime-path "/run/k3s/containerd" -t 5m -l java -o heapdump --tool jcmd --namespace kapp --image=zot.kyri.test/kubectl-prof:v1.3.17-dev-jvm-alpine Verifying target pod ... ✔ Launching profiler ... ✔ Profiling ... ✔ Remote profiling file downloaded in 8.536349 seconds. ✔ The profiling result file [agent-heapdump-27858-1-2024-05-27T08_54_12Z.hprof] was obtained in 36.787063 seconds. 🔥

kikokikok avatar May 27 '24 08:05 kikokikok

Great, @kikokikok !!

josepdcs avatar May 27 '24 10:05 josepdcs