Ayushi Choudhary Profile picture
May 12, 2025 9 tweets 2 min read Read on X
Designing a URL shortener sounds trivial until you're tasked with generating 100K unique URLs per second, with low latency, strict correctness, and multi-tenant isolation.

Over the weekend, I explored a brilliant breakdown of how Rebrandly engineered for this scale 🧵 Image
📄 Based on:
"Distributed TinyURL Architecture" by @animesh3436
()

Here’s what I learned 👇rb.gy/svwros
The challenge is that you need to:
- generate 100K short URLs per second
- guarantee uniqueness
- ensure sub-100ms latency
- be fault-tolerant, horizontally scalable, and tenant-aware

Not so "Tiny" anymore?
Sol 1: Async Write Architecture

- short URLs are generated and returned instantly
- writes are pushed to DynamoDB later via SQS + Lambda

Fast! Yes, but risk of collisions lies with no uniqueness guarantee at generation time.

A great example of trading correctness for speed.
Sol 2: Sync uniqueness check

- check if short URL exists
- if not, insert and return to user
- guarantees correctness

But, doesn’t scale. It adds ~10ms latency per write, leads to bottlenecks under concurrent load. Thus, not feasible for 100K/sec.
Scaling isn't just about speed. It’s about where you enforce constraints.

To achieve correctness at scale, shift guarantees to the infra level.

That’s what the third architecture gets right.
✅ Distributed Workers + DynamoDB Transactions

- coordinator splits work across ECS workers
- each worker handles 10K+ URLs using batched DynamoDB TransactWriteItems()
- Redis is used to cache batches + recover on failure
- transactions ensure atomic uniqueness per batch Diagram from article: "Distributed TinyURL Architecture" by Animesh Gaitonde. All credit to the author.
This architecture combines:
- Cloud-native building blocks (Lambda, SQS, ECS, DynamoDB)
- Batched writes with transactional guarantees
- Fault-tolerant caching using Redis
- Concurrency-safe design choices

Really helped me understand how "simple" features evolve at scale.
Got me thinking, how would something like this be built without AWS primitives?
Would love to hear thoughts on:
- PostgreSQL + advisory locks
- Redis Streams + Lua
- Kafka with idempotent writes & deduplication

Open to perspectives, still learning my way through these ideas.

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Ayushi Choudhary

Ayushi Choudhary Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(