High-concurrency caching
medium 28 minWhen many threads or servers use one cache at once, two things go wrong: updates are lost, and everyone queues for the same lock or the same hot key.
Where it shows up
The same pattern appears across everyday software.
Caffeine for Java
Its design notes describe recording reads in striped buffers, so a read does not lock the eviction order.
Go's singleflight
A package that suppresses duplicate calls: one caller does the work and the others share the result.
Memcached
Several worker threads share one store, and check and set with a token prevents lost updates by clients.
Redis
Commands run one after another, so an increment by many clients never loses a count.
Live match pages
Application servers keep the page for a second, so a goal does not send every reader to one cache node.
Configuration in memory
Servers read settings thousands of times a second and replace the whole object with one swap when it changes.