Counting the files waiting to download reads every enclosure, every 30 seconds #489
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The status counts (
Db::counts, behind /api/status,ipxd statusand the daemon's own count for /metrics every 30 s) countenclosures 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. Thecountsstep 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.The downloaded count beside it uses
enclosures_on_diskand takes 1 ms. Found by a speed check.Fixed in
33b5959, deployed in ipx: a partial indexenclosures_pendingon 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.