I am running Docker version 1.9.1, build a34a1d5. I noticed that there can be problems with the CPU stat data reported by ps and /proc/[pid]/stat for the processes that are running inside docker containers. The CPU stat data does not update regularly once the process gets busy.
I have a perl script that runs ps w -e -o pid,ppid,uid,vsz,rss,etime,time,args once a minute, then stores and reduces the output. All of the values like rss, etime etc update properly. However, with docker containers’ processes the CPU time field sometimes updates in random bursts. The CPU Time changes should be fairly even each minute since I know the workload is constant. docker ps shows the workload is constant, but ps and /proc/pid/stat does not.
CPU Time Samples for a process (taken once a minute with ps): 00:12:55, 00:12:55, 00:12:55, 00:12:55, 00:12:55, 00:13:53, 00:13:53, 00:13:53, 00:13:53, 00:13:53, 00:15:04, 00:15:04,
This has happened to me with different processes in docker. It seems to start happening when the process first gets “busy” (although by busy I still mean less than 1 cpu core on an 8 core system with not much else happening). I confirmed that the problem is with the /proc/pid/stat data as well as ps. I’ve had this happen on CentOS 7.1.1503 and Ubuntu 15.10.
As I adjust to working with docker I’m learning the other and better ways to check CPU. This was supposed to be a quick and basic way to check usage that I was already familiar with. Has anyone seen anything similar with docker or have any ideas why? Thanks!