Sitemap
Umesh Kumar Yadav

Umesh Kumar Yadav

Seasoned software developer with 12+ years of experience, specializing in AI, DL/ML Engineering, Java, Spring Boot, Kafka, Redis, and system architecture.

Member-only story

How to Handle 5 Lakh Likes in One Minute? A Scalable Database Design Using Redis and Write-Behind Caching

9 min read4 days ago
Press enter or click to view image in full size
AI image

Your SQL query might be correct, but can your database survive 5 lakh likes in 60 seconds?

Imagine you’re building Instagram, X (Twitter), or any social media platform.

Suddenly, one of your posts goes viral.

Within just one minute, it receives 5 lakh likes.

That’s approximately:

  • 500,000 likes in 60 seconds.
  • 8,333 likes per second.
  • 8,333 database update requests per second.

Now imagine your interviewer asks:

“How would you update the like count in the database?”

A developer with basic database knowledge might answer:

UPDATE posts
SET likes = likes + 1
WHERE post_id = 101;

Technically, this query is correct.

But there’s a big difference between writing a correct SQL query and designing a system that can handle thousands of concurrent requests.

Let’s understand the problem and build a scalable solution using Redis, Spring Boot, and PostgreSQL.

1. The Problem: Why Direct Database Updates Don’t…

--

--

Seasoned software developer with 12+ years of experience, specializing in AI, DL/ML Engineering, Java, Spring Boot, Kafka, Redis, and system architecture.