How do cgroup limits show up when debugging performance inside containers?
AdvancedProductionPerformance & the USE Method
Answer
Tools like top and free inside a container often show host totals, not the container's limits. Read the cgroup files instead:
cat /sys/fs/cgroup/memory.max /sys/fs/cgroup/memory.current
cat /sys/fs/cgroup/cpu.max
grep -E 'nr_throttled|throttled_usec' /sys/fs/cgroup/cpu.stat
cat /sys/fs/cgroup/memory.events # oom_kill count
Runtimes that size thread pools or heaps from host CPU/RAM (older JVMs, Node, Go before GOMAXPROCS awareness) misbehave under tight limits.
More on Performance & the USE Method
What is the USE method?BeginnerMap the USE method to concrete Linux commands.IntermediateWhat is your "first 60 seconds" checklist on a slow server?IntermediateHow do you read vmstat output?IntermediateHow do you read `iostat -xz 1`?IntermediateWhat is sar and why install sysstat on every server?Beginner