I want to profile the docker containers using perf tool. All I want to do is run a command inside docker container for a fixed duration and get the usage of all the resources used by the the container. What is the correct way to do that ?
A TL;DR version is docker stats <contiainer>. cadvisor from google, and sensu are all good ‘on your machine’ options. Docker stats will likely do everything you need.
Thanks for your reply, There is one more problem, I’m running apache httpd server inside docker container on linux (centos 7) machine. I’ve placed container behind the bridge. Now I want to measure the overhead incurred by docker bridge. How can I do that ? I used perf tool for cpu profiling, but I can’t infer from that the cpu used when the packet is moved through the bridge (the overhead added because of the bridge). From that I can get the total cpu usage of all the processes of a particular container. I got that around 2/3rd of cpu used in kernel mode and 1/3rd cpu used in user mode by httpd processes. How can tell from it that what percentage of cpu was used executing the bridge functions ?
Another option to profile app running inside a container is to use VTune Amplifier tool. You will be able to see the hotspots in your app including callstacks and the performance metrics distributed through the source file. This step-by-step article will explain how to do it. You can download VTune here.