CPU performance analysis demo for docker containers using FlameGraphs
VIDEO: YouTube
- Download my perf containers (My desktop repo). You will need the dockerfile and the docker-compose file here
Note: You need the dotnet core version of the application you are profiling. Check and adjust the dockerfile accordingly
Change directory to where you downloaded those files and run docker-compose build
to compile perf tools with dotnetcore SDK
- Download the flamegraph container
docker pull aimvector/flamegraph
In this directory of this repo, run
docker-compose build
docker-compose up
While the stack is running you can profile it with the perf container
Checkout the perf
example here
Checkout the ebpf
example here
The same process above works for Kubernetes containers as well.
Instead of docker-compose, you will have to use the ./k8s.yaml
file in this repo that runs the perf container in a pod in your cluster.
Be warned! It's armed with priviledges so use with caution and delete it when done :)
Instead of docker cp
, you can use kubectl cp
to copy out.perf
to your machine where you can run the above flamegraph container.
So therefore the same concept applies in Kubernetes.
You can get the Linux kernel version of your node by running:
kubectl run alpine --image alpine -- /bin/sh -c "uname -r"