Menu

1 / 2

How I built a flash-sale engine that can't oversell

DEV Community·M Rayhan Khan·5 months ago
#3Dfb1sJb
#dev#h0hackathon#dsql#rows#available
Reading 0:00
15s threshold

I created this piece of content for the purpose of entering the H0: Hack the Zero Stack hackathon. #H0Hackathon

The problem (that's harder than it sounds)

"Don't sell more tickets than you have" sounds trivial until 10,000 people click Buy in the same second.

The naive fix — a single remaining counter you decrement on every purchase — falls apart under load. And when you try to go multi-region, it gets worse: with eventual consistency across regions you can oversell during the replication window.

I wanted a flash-sale engine that is globally fast AND strongly consistent AND operationally simple — all three. That combination is precisely what Amazon Aurora DSQL is built for, so I built DropZero on it for the hackathon.

The trap I almost walked into

Aurora DSQL is a serverless, PostgreSQL-compatible, multi-region active-active SQL database.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.