Ritesh Roushan

21.3K posts

Ritesh Roushan banner
Ritesh Roushan

Ritesh Roushan

@devXritesh

Software Engineer at Startup • System Design • Microservices • AI Infrastructure | Creating real-world content for devs

✉️ DM for Collab & Work เข้าร่วม Şubat 2018
894 กำลังติดตาม5.3K ผู้ติดตาม
ทวีตที่ปักหมุด
Ritesh Roushan
Ritesh Roushan@devXritesh·
Backend Interview Question: Which API design scales better? What's your choice?
Ritesh Roushan tweet media
English
191
54
1.8K
512.7K
Aditya
Aditya@Aditya_181105·
be honest, As a developer Is there any replacement better than Claude for coding ??
Aditya tweet media
English
10
0
12
64
Tanuj
Tanuj@tanujDE3180·
A. GET /posts?page=10000 B. GET /posts?cursor=eyJpZCI6... One of these works fine at 1 million rows. The other still works at 1 billion rows. Which one are you choosing for scale ?
Tanuj tweet media
English
9
2
13
206
Samay
Samay@Samaytwt·
Vibe coders, what’s your backup plan if Ai writes better code than you in the next 1–2 years?
Samay tweet media
English
23
0
20
130
Ritesh Roushan
Ritesh Roushan@devXritesh·
Most people answer: A) Database That's usually wrong. The first thing that fails is often the cache. Here's why 👇 1. Celebrity posts a tweet 50M followers. Millions immediately refresh. Everyone requests the same tweet. 2. Cache Miss Storm If the tweet isn't cached yet: Millions of requests hit Redis simultaneously. This is called a cache stampede. Suddenly: • Redis CPU spikes • Network saturation increases • Database gets hammered 3. Database Becomes the Next Victim After cache misses: - Millions of requests fall back to the database. - Now the database becomes overloaded. - Not because it's slow. Because the cache stopped protecting it. 4. How X/Twitter Handles This Request Flow: User ↓ CDN ↓ Load Balancer ↓ API Gateway ↓ Redis Cache ↓ Database Most reads never reach the database. 5. Celebrity Problem Normal users: - Fan-out on Write - Tweet gets pushed to follower timelines. - Fast reads. Celebrity users: - Fan-out on Read - Store the tweet once. - Generate timelines dynamically. Otherwise you'd write tens of millions of timeline entries. 6. Protection Layers • Redis caching • CDN edge caching • Request coalescing • Rate limiting • Read replicas • Queue-based timeline generation Production lesson: The database isn't usually the first thing that fails. The system fails when too many requests bypass the cache. Protect the cache. The cache protects everything else.
Ritesh Roushan tweet media
Ritesh Roushan@devXritesh

System Design Interview Question: A celebrity with 50M followers posts a tweet. Within seconds: • Millions open the app • Millions refresh feeds • Millions request the same content What fails first? A) Database B) Cache C) API Servers D) Message Queue And how would you prevent it? Explain your architecture 👇

English
19
3
25
278
Mr Ash
Mr Ash@ash_twtz·
iPhone Models and Their Release Year • 🍏 iPhone - 2007 • 🌐 iPhone 3G - 2008 • 🚀 iPhone 3GS - 2009 • 💎 iPhone 4 - 2010 • ⭐ iPhone 4S - 2011 • 🎵 iPhone 5 - 2012 • 🌈 iPhone 5c - 2013 • 👑 iPhone 5s - 2013 • 📘 iPhone 6 - 2014 • ➕ iPhone 6 Plus - 2014 • ✨ iPhone 6s - 2015 • 🏆 iPhone 6s Plus - 2015 • 🎯 iPhone SE - 2016 • 🎧 iPhone 7 - 2016 • 📷 iPhone 7 Plus - 2016 • 🔋 iPhone 8 - 2017 • ⚡ iPhone 8 Plus - 2017 • 🔟 iPhone X - 2017 • 🌈 iPhone XR - 2018 • 💫 iPhone XS - 2018 • 🦅 iPhone XS Max - 2018 • 📸 iPhone 11 - 2019 • 🎬 iPhone 11 Pro - 2019 • 🚁 iPhone 11 Pro Max - 2019 • 🎯 iPhone SE (2nd generation) - 2020 • 🤏 iPhone 12 mini - 2020 • 🧲 iPhone 12 - 2020 • 💠 iPhone 12 Pro - 2020 • 🏅 iPhone 12 Pro Max - 2020 • 🪶 iPhone 13 mini - 2021 • 🎥 iPhone 13 - 2021 • 💎 iPhone 13 Pro - 2021 • 🚀 iPhone 13 Pro Max - 2021 • 🎯 iPhone SE (3rd generation) - 2022 • 🟣 iPhone 14 - 2022 • 🌟 iPhone 14 Plus - 2022 • ✨ iPhone 14 Pro - 2022 • 👑 iPhone 14 Pro Max - 2022 • 🔌 iPhone 15 - 2023 • 🌊 iPhone 15 Plus - 2023 • 🛸 iPhone 15 Pro - 2023 • 🏔️ iPhone 15 Pro Max - 2023 • 🤖 iPhone 16 - 2024 • 🌌 iPhone 16 Plus - 2024 • 🔥 iPhone 16 Pro - 2024 • 🐉 iPhone 16 Pro Max - 2024 • 💎 iPhone 16e - 2025 • 🪶 iPhone Air - 2025 • 🎉 iPhone 17 - 2025 • 🌠 iPhone 17 Pro - 2025 • 🏰 iPhone 17 Pro Max - 2025 • 🆕 iPhone 17e - 2026 Which iPhone is your favorite?
English
38
0
46
1.3K
Kunal
Kunal@kunal_twts·
@devXritesh The first hit point is the cache
English
1
0
1
32
Neeraj
Neeraj@neerajjj6785·
Neeraj tweet media
ZXX
27
1
33
478
Kunal
Kunal@kunal_twts·
How many can do a POST request ?🙂
Kunal tweet media
English
7
0
8
125
Ray🫧
Ray🫧@ravikiran_dev7·
Hey @grok remove the most evil and controversial entrepreneur from this image!
Ray🫧 tweet media
English
17
1
17
247
Edgex
Edgex@SahilExec·
@devXritesh So the cache is the real hero here, protecting the database from a stampede of requests
English
1
0
1
39
Edgex
Edgex@SahilExec·
A junior dev validates emails like this: Works perfectly for valid emails. What's the hidden vulnerability and how does an attacker use it to take down your server?
Edgex tweet media
English
8
1
9
222
prashant varma
prashant varma@realpvarma·
Unpopular opinion: A small audience can be worth more than a big resume.
English
11
1
13
142
Suhas
Suhas@begade_suhas·
@devXritesh Mind if we join on x?? 😉😉
English
1
0
0
7
Ritesh Roushan
Ritesh Roushan@devXritesh·
System Design Question: You're designing Uber. A ride is completed. You need to update: • Billing • Driver Earnings • Notifications • Analytics What's your first choice? A) REST B) Message Queue Explain your reasoning 👇
Ritesh Roushan tweet media
English
55
3
70
1.2K
Sakshi Sugandhi
Sakshi Sugandhi@SakshiSugandhi·
Hot take: Username field is unnecessary. Change my mind.
Sakshi Sugandhi tweet media
English
47
2
47
693
Vivo
Vivo@vivoplt·
The last game built by Claude Fable 5.
English
34
2
41
716
Prajwal
Prajwal@0xPrajwal_·
Be honest, which processor is actually the best?
Prajwal tweet media
English
39
2
33
571