logoalt Hacker News

esafak • yesterday at 6:50 PM • 3 replies • view on HN

That depends on your database. Serial keys can create hot spots in distributed databases because new writes are consistently directed to the same partition.


Replies

ndriscoll • yesterday at 7:34 PM

Yeah but for nearly everyone, they'd get better performance from not using a distributed database, and benefit from "hotspots" i.e. data locality.

JoshTriplett • yesterday at 7:00 PM

There's no fundamental reason for this. Much as with per-CPU memory allocation, shards could pre-reserve chunks of the next serial space, and then only coordinate when they need a new chunk.

➕ show 2 replies
NyxWulf • yesterday at 8:20 PM

In my testing the primary bottleneck isn't about writing to the same partition. Lock coordination to increment the serial key, then send it back across a connection was the real culprit. Virtually all databases make updates into RAM and to a write ahead log, which is then spooled to disk in the background. No matter which pages are written or updated, the changes all go sequentially in order into the WAL. For me, getting rid of Serial Keys was the big hot spot in processing. YMMV.

➕ show 1 reply