Effect Hot Account Ledger
Account subdivision for the merchant whose promotion day melts the ledger: the balance becomes N sub-accounts, each behind its own Semaphore row lock, and a credit locks exactly one, so concurrent credits spread across independent locks instead of queueing in a single-row convoy. The balance is the sum over sub-accounts and the demo proves it lands to the cent while finishing several times faster than the serialized row. Debits that need the full balance take every lock in fixed index order (the resource ordering that cannot deadlock), settle across shards atomically, and refuse over-drafts with a typed InsufficientFunds carrying the true balance. Solves the row-lock convoy on hotspot accounts. Pinned to effect 4.0.0-beta.98.
npx shadcn@latest add https://ui.aryank.space/r/effect-hot-account-ledger.jsonInstalls from ui.aryank.space. To add it by hand, copy the files in Files below, or register the @compronents namespace via the docs.
Promotion day: two hundred concurrent credits to one merchant, and every one of them queues on the same row lock. Throughput collapses to one write per lock hold, checkout latency climbs past a second, and the platform's biggest account becomes its slowest row.