Read Locks Are Not Your Friends

This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).

A hands-on investigation into why RwLock performed ~5× worse than Mutex for a read-heavy LRU tensor cache in Rust. The root cause is cache-line ping-pong: even a read lock requires an atomic increment of an internal reader counter, causing every core to fight for exclusive ownership of that cache line. For very short critical

5m read time From eventual-consistency.vercel.app
Post cover image
Table of contents
TLDRIntroductionSystem Context & WorkloadThe Conventional WisdomBenchmarksWhy This Happened: The Hardware RealityThe LessonConclusion

Sort: