Disk is fast, memory is slow. Forget all you think you know
summary
Rewrites a Prometheus Ruby client to make cross-process counters practical: sets a hard one microsecond target for increments, measures real costs, and tries C extensions, PStore, Redis, SQLite, and memory maps. Finds memory maps causing segfaults with the mmap C gem, sees Redis suffer from IPC round trips, and discovers plain file writes (relying on OS buffering) run ~6–9 microseconds — slower than memory but reliable and portable. The store is fast enough, merged, and used in production.
AI-written summary · about
chapters (10)
- 0:00Start
- 1:40Prometheus polls your app for its metrics
- 2:19Pre-fork servers
- 4:03The problem
- 5:25Performance
- 6:03Separate storage
- 7:07The road ahead
- 11:55Can we even do this?
- 23:30NOPE NOPE NOPE NOPE
- 31:28Files vs MMaps








