Counting the files waiting to download reads every enclosure, every 30 seconds #489

Closed
opened 2026-11-22 05:53:13 -08:00 by rays · 1 comment
Owner

The status counts (Db::counts, behind /api/status, ipxd status and the daemon's own count for /metrics every 30 s) count enclosures WHERE state = 'pending' with no index to use: a parallel sequential scan of all ~690,000 rows, 32,397 buffers, 92 ms in production (EXPLAIN ANALYZE, 2026-11-22), to find a handful. The counts step is 73 ms at the median, 107 ms at p90 and once 1.1 s (trace 2c78fb5bad23f3d4c034fba50ad00dc9); /api/status is the slowest route at p95 (~230 ms). Every 30 s that is three Postgres processes reading 250 MB from shared buffers, on the server production's database shares.

$Q spans '{resource.service.name="ipx" && name="step" && span.of="counts"}' 7d

The downloaded count beside it uses enclosures_on_disk and takes 1 ms. Found by a speed check.

The status counts (`Db::counts`, behind /api/status, `ipxd status` and the daemon's own count for /metrics every 30 s) count `enclosures WHERE state = 'pending'` with no index to use: a parallel sequential scan of all ~690,000 rows, 32,397 buffers, 92 ms in production (EXPLAIN ANALYZE, 2026-11-22), to find a handful. The `counts` step is 73 ms at the median, 107 ms at p90 and once 1.1 s (trace 2c78fb5bad23f3d4c034fba50ad00dc9); /api/status is the slowest route at p95 (~230 ms). Every 30 s that is three Postgres processes reading 250 MB from shared buffers, on the server production's database shares. $Q spans '{resource.service.name="ipx" && name="step" && span.of="counts"}' 7d The downloaded count beside it uses `enclosures_on_disk` and takes 1 ms. Found by a speed check.
rays added the bug label 2026-11-22 05:53:13 -08:00
Author
Owner

Fixed in 33b5959, deployed in ipx: a partial index enclosures_pending on the pending rows, made by the daemon at start. EXPLAIN ANALYZE in production now: index-only scan, 1 buffer, 0.15 ms, from 92 ms and 32,397 buffers.

Fixed in 33b5959, deployed in ipx: a partial index `enclosures_pending` on the pending rows, made by the daemon at start. EXPLAIN ANALYZE in production now: index-only scan, 1 buffer, 0.15 ms, from 92 ms and 32,397 buffers.
rays closed this issue 2026-11-22 06:00:12 -08:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: rays/ipx#489