Shopify increased their write throughput by 50% moving one of their MySQL keys from UUIDv4 to ULID.
But How?
When you make a purchase, Shopify guarantees idempotency by having the client uniquely tagging the request using UUID. If you accidentally replay the request and they check if the request exists or not and no-op.
UUIDs (at least version 4) are random while order placements are ordered, this leads to thrashing pages in and out of the buffer pool as it fills up dramatically slowing down writes.
Shopify replaced their primary key to ULID which is ordered and timestamped so now requests are chronologically ordered and as a result requests in a given time period live almost in the same pages and recent request (which is the common query) live in tail pages keeping those hot in memory.
Also worth mentioning that UUIDv7 and 8 are ordered and work as well, this is specific to UUIDv4.
Watch my full coverage on this amazing change, truly show engineers knowing what they are doing
The topic of UUID is surfacing again so I thought I’d share this again
Erlang docs in OTP27 rendered using ExDocs look so great <3 I had PTSD every time I needed to go through Erlang docs. It was like going back through time machine. Having a modern looking docs page make the tech look more accessible and modern too.
https://t.co/PnmT1uF8L9
@pankowecki How does it differ from option 2? It's the same idea but instead of having an OUTBOX table, it leverages that there is already a CDC log that can take its place
@GergelyOrosz I remember a project from heuristic algorithms where we were given NP-hard problem and a team had to choose algorithm, implement it and find best solution for input provided by the prof. The guy who won implemented the simplest algorithm and let it run for the whole semester
@mjrzasa Sounds an awful lot like Erlang. You can have your code on a single machine or join them in a cluster. You can communicate between actors by having their pid - which can be local or remote. Disguising network calls as local is always bad though.