Menu

1 / 4

Big Billion Days - System Design

DEV Community: redis·Bhanu partap·15 days ago
#6q0Ljhj2
#devtoredis#devto#dev#caching#redis
Reading 0:00
15s threshold

Imagine you are sitting in a shoe shop with your friend. You see a pair of shoes and the display says "Only 5 left!" so you quickly buy all 5.

Your friend, sitting right beside you, sees the same sign and tries to order 5 more. But wait.. there were only 5 pairs in total! How can the system sell 10 shoes when only 5 existed? 😅

This is exactly what happens in production when your cache holds stale data.

Your system flows like this: Client → Node.js → Redis → PostgreSQL.

Redis is super fast but it can hold outdated information while PostgreSQL sits there with the actual truth. So how do you fix this without killing performance?

Let us break it down simply.

Visualize the Problem (The Shop Window Analogy)

Think of PostgreSQL as your warehouse (Godown). This is where the real stock and real prices live. It is slow but accurate.

Now think of Redis as your shop's display window. Customers look at the window to decide what to buy.…

Continue reading — create a free account

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