Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Why free, docker stats and ps disagree about memory on your VPS (measured on a 1 GB box)

Description and use

On a 1 GB VPS, free, docker stats, and ps report different memory values because they measure different aspects. free’s available column best indicates readiness for shortage, docker stats omits swap, and RSS/PSs give different views of process consumption.

Problem

Different system tools report conflicting memory usage on a 1 GB VPS, leading to misinterpretation of resource consumption.

Outcome

The article demonstrates that free’s available column, docker stats, ps RSS, and PSS each measure different aspects of memory, and that misreading them can lead to under‑ or over‑provisioning of RAM.

Workflow

  • 1. Run free -m to view used, available, and swap usage.
  • 2. Run docker stats --no-stream to sum container RAM (excluding swap).
  • 3. Sum RSS from ps or /proc/<pid>/smaps_rollup for per‑process view.
  • 4. Sum PSS from /proc/<pid>/smaps_rollup for accurate process cost.
  • 5. Read cgroup files /sys/fs/cgroup/.../memory.current and memory.swap.current for each container.
  • 6. Use vmstat 1 5 to monitor swap I/O and kernel activity.

Evidence

They count different things. free reports the whole machine, and its available column (192 MB here) is the one that tells you how close you are to trouble.

Source

docker stats added up to only 343 MB because it leaves out swap and the cache the kernel can drop: n8n showed 24.6 MiB while another 195 MB of it sat in swap.

Source

RSS is every page a process has in RAM, including pages it shares with others: libraries, and memory a parent process shares with its workers.

Source

PSS is the same pages, with each shared page split between the processes sharing it.

Source

The kernel's own estimate of what is still usable, MemAvailable, was 192 MB, and that is what free prints as available.

Source

  • Record date: 2026-10-10T15:56:03.509Z