3 ms·
I've used auto-incrementing integers across multiple systems. There was one system responsible for allocating the integers (what should have been a relational
by deathanatos 2y ago
I've used auto-incrementing integers across multiple systems.
There was one system responsible for allocating the integers (what should have been a relational database that held our user accounts & their metadata); once that write was committed¹’² then other systems (e.g., one that kept bulk/frequent per-user metrics (lots of data), but which could shard it better) used it.
I think I'd opt for UUIDs today (the size difference is minimal, and they distribute more naturally if you shard on them), but integers are doable in this manner too.
¹which … this is its own battle. It turned out later our database was less than good here. ("So call me, maybe.")
²you need a lock here. That could matter. But "user creation" is not a frequent enough event for lock contention to matter. We only did this for user IDs.