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

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

Описание и применение

На 1 ГБ VPS разные инструменты (free, docker stats, ps) показывают разные значения памяти, потому что они измеряют разные вещи. free’s available — лучший индикатор готовности к нехватке, docker stats игнорирует swap, а RSS/PSs дают разные представления о потреблении процессов.

Задача

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

Результат

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.

Рабочий процесс

  • 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.

Доказательства

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.

Источник

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.

Источник

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.

Источник

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

Источник

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

Источник

  • Дата записи: 2026-10-10T15:56:03.509Z