Topic
#concurrency
2 posts
databases
8 min read
#03
How Postgres Prevents Both Deadlock AND Livelock in Upserts
A one-line rule buried in PostgreSQL's INSERT ... ON CONFLICT code prevents two of the nastiest concurrency bugs at once: the transaction with the higher XID backs out.
systems
6 min read
#02
How nginx Tells Time Without Asking
A lock-free time cache lets millions of nginx requests read the current time without waiting for each other. 64 pre-allocated slots, a memory barrier, and a bet that your thread won't sleep for a full minute.