From cee9a6cd04af182fc9c3a9ee8c112b52eb562613 Mon Sep 17 00:00:00 2001 From: Kevin Mingtarja Date: Fri, 4 Dec 2026 15:31:49 -0800 Subject: [PATCH] Recommend a memory-backed directory for multiprocess mode Every metric update in multiprocess mode writes into a memory-mapped file under PROMETHEUS_MULTIPROC_DIR. On a disk-backed filesystem that write can wait in a page fault while the disk is busy, and the thread holds the GIL while it waits, so every thread of the process stops. Say so on the multiprocess page and recommend tmpfs, /dev/shm or a memory-backed emptyDir volume. Signed-off-by: Kevin Mingtarja --- docs/content/multiprocess/_index.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/content/multiprocess/_index.md b/docs/content/multiprocess/_index.md index cd129930..6c23f2ad 100644 --- a/docs/content/multiprocess/_index.md +++ b/docs/content/multiprocess/_index.md @@ -41,6 +41,14 @@ Windows-mounted path (e.g. `/mnt/c/...`). On Windows-mounted filesystems the per-process metric files can be written with an incorrect internal offset, causing the collector to silently read no data. +Prefer a memory-backed filesystem for this directory: a `tmpfs` mount, +`/dev/shm`, or in Kubernetes an `emptyDir` volume with `medium: Memory`. +Every metric update writes into a memory-mapped file in this directory. On a +disk-backed filesystem the kernel can make that write wait while the disk is +busy, for a second or more, and the thread holds the GIL while it waits, so +every thread of the process stops. Files on a memory-backed filesystem count +against the memory of the machine or container. + **2. Metrics collector**: The application must initialize a new `CollectorRegistry`, and store the