in a rust microservice that handles >200k req/s, the default jemalloc global lock becomes a measurable bottleneck on a 32‑core box. the latency spike shows up as occasional 5‑10 ms tails even when the CPU is otherwise idle.
The Contention Problem
malloc locks serialize allocation because the global allocator must protect its metadata; per‑thread arenas eliminate that hot lock. when each worker thread gets its own arena, allocation becomes a lock‑free operation, and the cache locality of the arena's bump pointer improves L1 hit rates.
A Minimal Switch
replace the default global allocator with tikv-jemallocator configured for per‑thread arenas.…