Skip to content

runtime: batch ps -p in list -f instead of one call per entry - #274

Open
liayan wants to merge 1 commit into
NVIDIA:mainfrom
liayan:fix/list-batch-ps-snapshot
Open

runtime: batch ps -p in list -f instead of one call per entry#274
liayan wants to merge 1 commit into
NVIDIA:mainfrom
liayan:fix/list-batch-ps-snapshot

Conversation

@liayan

@liayan liayan commented Aug 17, 2026

Copy link
Copy Markdown

runtime::list() calls "ps -p" separately for each rootfs entry, in alphabetical order, after the initial lsns scan that found the pids. Entries later in that order get checked further away in time from when lsns saw them running, so the staleness window #126/#220 already deal with is not fixed size, it grows with the number of running containers.

Measured on an idle VM with N containers running: the gap between the lsns scan and each entry per-entry ps call went from ~46ms (1st entry) to ~286ms (40th entry), growing roughly linearly with N. Batching a single "ps -p" call right after the lsns scan and having the rest of the function work off that one snapshot keeps this at a flat ~40ms regardless of N.

Ran the #126 repro (owner exits mid-list) 8x against this, still degrades gracefully to a name-only row like #220 intended, no regression there.

runtime::list() calls "ps -p" separately for each rootfs entry, in
alphabetical order, after the initial lsns scan that found the pids.
Entries later in that order get checked further away in time from
when lsns saw them running, so the staleness window NVIDIA#126/NVIDIA#220 already
deal with is not fixed size, it grows with the number of running
containers.

Measured on an idle VM with N containers running: the gap between the
lsns scan and each entry per-entry ps call went from ~46ms (1st entry)
to ~286ms (40th entry), growing roughly linearly with N. Batching a
single "ps -p" call right after the lsns scan and having the rest of
the function work off that one snapshot keeps this at a flat ~40ms
regardless of N.

Ran the NVIDIA#126 repro (owner exits mid-list) 8x against this, still
degrades gracefully to a name-only row like NVIDIA#220 intended, no
regression there.

Signed-off-by: Liang Yan <lyan@coreweave.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant