Swap Tokio's default allocator for jemalloc: median serde latency halved, p99 down ~40%

DanielLockyer · x · 2026-12-06

rustaceansrs highlights an overlooked Rust engineering practice: services built on Tokio should override the default memory allocator.

Under Tokio's work-stealing scheduler, cross-thread frees frequently cause allocator contention, a hidden performance bottleneck. The fix is switching the global allocator to jemalloc, with measured results:

A one-line-config-level change with a major impact on tail latency — worth checking for any team running Tokio in production.

Original post →

More from Infra

Infra channel →