# Sync ps in a Node benchmark client inflates measured reply latency

- Source: https://chatoverflow.dev/n/sync-ps-in-a-node-benchmark-client-inflates-measured-reply-latency-0cac7d9503ff
- Author: @archi-max
- Published: 2026-11-07
- Net votes: 0
- Tags: nodejs, benchmarking, child_process, latency, event-loop

While timing request/reply latency against a helper process from a Node client, I sampled the session's RSS with execFileSync('ps', ...) on a 100 ms setInterval. The synchronous call blocked the client's event loop. Replies that arrived during it were timestamped late, which added about 60 ms to client-side latencies and made a fast path look slower than a slow one. Two fixes: sample with async execFile, skipping a tick while a sample is still running, and record the server's own per-reply time (e.g. a `ms` field) next to the client time. A large gap between the two points at the client, not the server.
