<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Bhanu partap</title>
    <description>The latest articles on DEV Community by Bhanu partap (@bhanupartap13).</description>
    <link>https://dev.to/bhanupartap13</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2631826%2Ff3ddab20-818a-4339-ad1e-e8a7d7580299.JPG</url>
      <title>DEV Community: Bhanu partap</title>
      <link>https://dev.to/bhanupartap13</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bhanupartap13"/>
    <language>en</language>
    <item>
      <title>The GTA VI Launch Engineering</title>
      <dc:creator>Bhanu partap</dc:creator>
      <pubDate>Mon, 16 Nov 2026 13:19:51 +0000</pubDate>
      <link>https://dev.to/bhanupartap13/the-gta-vi-launch-engineering-2eei</link>
      <guid>https://dev.to/bhanupartap13/the-gta-vi-launch-engineering-2eei</guid>
      <description>&lt;p&gt;This week, something insane is happening.&lt;br&gt;
First of all 'Rockstar&lt;br&gt;
GTA 6 is launching. And I do not mean “a few gamers will download it” kind of insane. I mean 25 million people trying to pull 150 gigabytes of data through the same internet pipes at roughly the same time kind of insane. ^___^&lt;/p&gt;

&lt;p&gt;Let that sink in for a second.&lt;/p&gt;

&lt;p&gt;When GTA 5 launched back in 2013, around 13 million people downloaded it simultaneously. That already broke records. Servers choked. Downloads stalled. People raged on forums. And that was 13 million.&lt;/p&gt;

&lt;p&gt;Now Rockstar is expecting nearly DOUBLE that number for GTA 6. Twenty. Five. Million. Players. All hitting the download button within hours of each other. Each pulling 150 GB of game data.&lt;/p&gt;

&lt;p&gt;Do the math with me.&lt;/p&gt;

&lt;p&gt;25 million multiplied by 150 GB equals roughly 3.75 petabytes of total data that needs to move from Rockstar’s servers to living rooms across the planet. At peak concurrent download times, we are talking about hundreds of terabytes per second of bandwidth demand.&lt;/p&gt;

&lt;p&gt;For context, the entire internet infrastructure has been pushed to its limits before. During GTA 5’s launch, CDN providers reported record traffic spikes. This time? The numbers are almost double. The internet backbone itself could feel the pressure.&lt;/p&gt;

&lt;p&gt;So here is the billion dollar question. If YOU were Rockstar Games, how would you solve this? 🤔&lt;/p&gt;

&lt;p&gt;The Three Options on the Table&lt;/p&gt;

&lt;p&gt;Let us say you are sitting in Rockstar’s engineering war room. The launch is days away. Your CEO walks in and says “Make sure 25 million people can download this game without melting the internet. Go.”&lt;/p&gt;

&lt;p&gt;You have three options.&lt;/p&gt;

&lt;p&gt;Option A: One Giant Data Center&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftp1vfaj5ibqmn6qbuc9x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftp1vfaj5ibqmn6qbuc9x.png" alt="data centre's failure" width="356" height="259"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Put everything in one massive server farm. Every single player connects to this one location and downloads the game from there.&lt;/p&gt;

&lt;p&gt;Sounds simple, right? One place. One source. Easy to manage.&lt;/p&gt;

&lt;p&gt;But here is the problem. Imagine 25 million people all trying to enter the same shop at the same time. The door is 10 feet wide. The parking lot has 50 spots. The network pipes leading to that ONE data center have a fixed bandwidth ceiling. No matter how powerful your servers are inside that building, the pipe leading TO that building becomes the bottleneck.&lt;/p&gt;

&lt;p&gt;Players in Mumbai will experience the same latency as players in New York because everyone is hitting the same physical location. The single data center becomes a single point of failure AND a single point of congestion. One DDoS attack, one fiber cut, one power outage, and 25 million players stare at a loading screen forever. Not good.&lt;/p&gt;

&lt;p&gt;Option B: Buy 10 More Identical Servers&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1e95ji7ks3e5mr34uqlq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1e95ji7ks3e5mr34uqlq.png" alt="Vertical Scaling oF severs" width="390" height="243"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Okay so Option A failed. What if we just buy more servers? Same design. Same metal. Same data center. Just 10x the hardware.&lt;/p&gt;

&lt;p&gt;This is called vertical scaling or horizontal scaling within the same location. More machines, same place.&lt;/p&gt;

&lt;p&gt;Better than Option A? Slightly. You can handle more concurrent connections now. But you still have the same fundamental problem. All those servers are in ONE location. All network traffic still flows through the same regional pipes. A player in Tokyo still has to pull data from a server in Virginia. The speed of light has not changed. Latency remains brutal for anyone not geographically close to your data center.&lt;/p&gt;

&lt;p&gt;Plus, buying and setting up 10 enterprise-grade servers in days? Before a global launch? Good luck with that procurement timeline. 😅&lt;/p&gt;

&lt;p&gt;Option C: Content Delivery Network (CDN) ✅&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu1a2qc6jlyx9z53gmrhu.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu1a2qc6jlyx9z53gmrhu.jpg" alt="CDN" width="600" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we are talking.&lt;/p&gt;

&lt;p&gt;Here is what Rockstar actually does. And this is the correct answer.&lt;/p&gt;

&lt;p&gt;A CDN is a network of servers spread across hundreds of locations worldwide. Think of it like this. Instead of one giant shop in one city, you open 200 small shops in every neighbourhood. Each shop stocks the same product. Customers walk into the shop closest to their house.&lt;/p&gt;

&lt;p&gt;For GTA 6, Rockstar partners with CDN providers like Akamai, Cloudflare, or AWS CloudFront. Weeks before launch, they PRE-CACHE the entire 150 GB game file on edge servers located in Mumbai, Delhi, Bangalore, Singapore, Tokyo, London, New York, São Paulo, and hundreds more cities.&lt;/p&gt;

&lt;p&gt;When a player in Ratia, Haryana (yes, my hometown ^___^) hits download, they are NOT connecting to a server in America. They are pulling data from an edge server maybe 200 kilometres away in Delhi or Chandigarh. Fast. Local. No transoceanic latency.&lt;/p&gt;

&lt;p&gt;The CDN handles the heavy lifting. Rockstar’s origin servers barely feel the traffic because 99 percent of downloads are served from cached edge copies.&lt;/p&gt;

&lt;p&gt;But Wait. They Did Something Even Smarter.&lt;/p&gt;

&lt;p&gt;Here is where it gets really interesting.&lt;/p&gt;

&lt;p&gt;Rockstar did NOT open downloads on launch day. They gave players a 7-day early download window. The game files became available for download a full week BEFORE the actual unlock date.&lt;/p&gt;

&lt;p&gt;Why? Because if 25 million people all download on Day 1, the peak bandwidth demand is catastrophic. But if you spread those downloads across 7 days, the daily load drops dramatically. Instead of 3.75 petabytes in 24 hours, you get roughly 500 terabytes spread over a week. Much more manageable. Much less likely to melt anyone’s infrastructure.&lt;/p&gt;

&lt;p&gt;Smart, right? Distribute the load over time, not just over geography. ^___^&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fghr7d8tgxnsty1jn24ti.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fghr7d8tgxnsty1jn24ti.jpg" alt="GTA 6" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Download is Done. Now the REAL Test Begins.&lt;/p&gt;

&lt;p&gt;Here is the part most people miss.&lt;/p&gt;

&lt;p&gt;Downloading the game is only half the battle. The game UNLOCKS on November 19, 2026. That means on that specific date and time, 25 million people who already downloaded the game will press “Play” at almost the same moment.&lt;/p&gt;

&lt;p&gt;Now Rockstar’s authentication servers need to validate 25 million unique license keys simultaneously. 25 million “Am I allowed to play this game?” requests hitting their servers within minutes.&lt;/p&gt;

&lt;p&gt;If those servers go down? 25 million angry gamers. Twitter meltdown. Stock price wobble. Support ticket tsunami. You get the picture. 🚨&lt;/p&gt;

&lt;p&gt;So what do they do?&lt;/p&gt;

&lt;p&gt;Load Balancers: The Traffic Cops of the Internet&lt;/p&gt;

&lt;p&gt;Rockstar places load balancers in front of their authentication servers. Think of a load balancer as a traffic cop at a massive intersection.&lt;/p&gt;

&lt;p&gt;25 million requests arrive. The load balancer does NOT send them all to one server. It distributes them across 50, 100, maybe 200 backend servers. Each server handles a small chunk. No single server gets overwhelmed. Request comes in, load balancer says “You go to Server 7. You go to Server 23. You go to Server 142.” Smooth. Even. No crashes.&lt;/p&gt;

&lt;p&gt;If one server gets overloaded or crashes, the load balancer instantly stops sending traffic to it and redistributes to healthy servers. Players never even notice. This is what big companies do. This is how Netflix streams to 200 million people. This is how Amazon handles Black Friday. This is how Rockstar will handle GTA 6 launch day.&lt;/p&gt;

&lt;p&gt;Sharding: Divide and Conquer by Geography&lt;/p&gt;

&lt;p&gt;But load balancers alone are not enough at this scale.&lt;/p&gt;

&lt;p&gt;Rockstar also SHARDS their authentication and game servers by region. Players in India hit Indian servers. Players in Europe hit European servers. Players in North America hit American servers.&lt;/p&gt;

&lt;p&gt;Each regional cluster handles its own subset of the 25 million players. The load is not just balanced across machines. It is balanced across CONTINENTS.&lt;/p&gt;

&lt;p&gt;This is sharding in action. You take one massive problem (25 million concurrent users) and break it into smaller, geographically isolated problems (2 million users per region, 10 regions). Each smaller problem is solvable. Each regional cluster can independently scale, fail, and recover without affecting other regions.&lt;/p&gt;

&lt;p&gt;If the Indian server cluster has a hiccup, players in Brazil do not even notice. That is the beauty of distributed systems. ^___^&lt;/p&gt;

&lt;p&gt;The Bigger Lesson Here&lt;/p&gt;

&lt;p&gt;GTA 6’s launch is not just a gaming event. It is one of the largest real-time distributed systems stress tests on the planet. Every single concept you study in system design comes alive here.&lt;/p&gt;

&lt;p&gt;CDNs for content distribution. Load balancers for traffic management. Sharding for regional isolation. Pre-caching for latency reduction. Staggered access windows for bandwidth smoothing. Authentication at scale. Graceful degradation under extreme load.&lt;/p&gt;

&lt;p&gt;The next time you open a system design textbook and see a diagram with arrows pointing to “Load Balancer” and “Edge Servers” and “Shards”, remember this. Somewhere in a server room, an engineer at Rockstar is making sure 25 million people can simultaneously steal virtual cars without the internet breaking.&lt;/p&gt;

&lt;p&gt;And that, my friend, is distributed systems in its purest, most beautiful form. 🚀&lt;/p&gt;

&lt;p&gt;Thank you for reading. If you are downloading GTA 6 this week, enjoy the game. But also take one second to appreciate the engineering miracle happening behind that download button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvd72k4h1z2ztwejsh84q.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvd72k4h1z2ztwejsh84q.jpg" alt="GTA 6" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now go. The streets of Vice City are waiting. ^___^&lt;/p&gt;

&lt;p&gt;LIKE, SUPPORT:)))))))))))))))))))))))))))))))))))))(Hire Me as DevRel/SDE))))))))))))))))))))))))&lt;/p&gt;

</description>
      <category>gamedev</category>
      <category>gta6</category>
      <category>gta6systemdesign</category>
      <category>cdn</category>
    </item>
    <item>
      <title>Read/Write Controversy</title>
      <dc:creator>Bhanu partap</dc:creator>
      <pubDate>Mon, 02 Nov 2026 10:26:57 +0000</pubDate>
      <link>https://dev.to/bhanupartap13/readwrite-controversy-42a5</link>
      <guid>https://dev.to/bhanupartap13/readwrite-controversy-42a5</guid>
      <description>&lt;p&gt;Imagine you run a busy restaurant kitchen.&lt;/p&gt;

&lt;p&gt;PostgreSQL -&amp;gt; chefs, waiters -&amp;gt; cache/Redis&lt;/p&gt;

&lt;p&gt;The Write Side (Chefs) need things organized perfectly. Ingredients are in separate labeled containers. &lt;br&gt;
Sauces here, &lt;br&gt;
vegetables there, &lt;br&gt;
meats in the fridge. &lt;br&gt;
Everything has its own place so chefs can prep fast and never mix up orders.&lt;/p&gt;

&lt;p&gt;This is your normalized Postgres schema. Clean, strict, no duplicates. Perfect for writing new orders.&lt;br&gt;
OK:)&lt;/p&gt;

&lt;p&gt;Now,&lt;br&gt;
The Read Side (Waiters &amp;amp; Managers) need the opposite. &lt;br&gt;
When a customer asks “Where is my order?”, the waiter does not want to check 7 different containers. &lt;br&gt;
They want one single plate with everything ready to serve. &lt;/p&gt;

&lt;p&gt;When the manager asks “How many biryanis did we sell yesterday?”, they do not want to open every container and count manually.&lt;br&gt;
They want a pre-made summary sheet. This is your dashboard and reporting queries.&lt;/p&gt;

&lt;p&gt;Right now your restaurant is using the same setup for both. Chefs are happy but waiters are running everywhere. Managers are counting ingredients at 9am and slowing down the entire kitchen. &lt;/p&gt;

&lt;p&gt;You already added more shelves (indexes) and hired extra helpers (caching), but the fundamental problem remains. Writing needs structure. Reading needs speed. You have been pretending they are the same thing for two years.&lt;/p&gt;

&lt;p&gt;So,&lt;br&gt;
Technical Example:&lt;/p&gt;

&lt;p&gt;Your orders service is a Postgres monolith doing 8K writes per minute and 40K reads per minute. Same tables. Same schema. Everything is grinding.&lt;/p&gt;

&lt;p&gt;The write side needs a clean normalized schema with separate tables for orders, line items, payments, shipments, and addresses. Clean foreign keys, ACID compliance, no duplicated data. Beautiful for inserting new orders.&lt;/p&gt;

&lt;p&gt;But the read side wants the exact opposite. Your dashboard joins 7 tables just to render one order card. Your reporting queries light up the CPU at 85% every morning at 9am.&lt;/p&gt;

&lt;p&gt;You have already tuned indexes. You have already added caching. The fundamental problem is not hardware. The read model and the write model want different shapes of the same data, and you have been pretending they are the same thing for two years.&lt;/p&gt;

&lt;p&gt;So here is the decision on the table:&lt;/p&gt;

&lt;p&gt;A) Full CQRS with separate read/write models and eventual consistency&lt;br&gt;
B) Add read replicas and point dashboards there&lt;br&gt;
C) Denormalize the write schema itself so reads stop joining&lt;br&gt;
D) Keep the schema and add GraphQL plus DataLoader to batch N+1 reads&lt;/p&gt;

&lt;p&gt;First of all drop your answers from the given options (A, B, C, D).&lt;/p&gt;

&lt;p&gt;FOLLOW&lt;/p&gt;

&lt;p&gt;All four are real patterns you will see in production. Three of them dodge the actual problem. One of them is the senior engineer trap that looks correct for about 6 months until it does not.&lt;/p&gt;

&lt;p&gt;Let me walk you through each one like I am sitting next to you.&lt;/p&gt;

&lt;p&gt;Option A: Full CQRS ✅ (The Right Answer)&lt;/p&gt;

&lt;p&gt;Think of this like having two separate notebooks. One notebook is for chefs (writes). It is perfectly organized with separate sections for ingredients, recipes, and plating. The other notebook is for waiters (reads). It has pre-written summaries like “Table 5 ordered biryani at 1pm” ready to serve instantly.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq0lke0dx457bi980kyt7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq0lke0dx457bi980kyt7.png" alt="CQRS" width="800" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Writes go to your clean normalized Postgres. A background process projects that data into a flat denormalized read store like ElasticSearch or a separate read-optimized Postgres database. Dashboards and reports query only the flat store. Reads become instant because there are zero joins. Writes stay clean because nothing changed there.&lt;/p&gt;

&lt;p&gt;The tradeoff is eventual consistency. The read store might lag by milliseconds to seconds. But for dashboards and reports, that is perfectly acceptable. Nobody expects real-time analytics down to the millisecond.&lt;/p&gt;

&lt;p&gt;This solves the root cause. Read and write models finally get the shape they actually need.&lt;/p&gt;

&lt;p&gt;Option B: Read Replicas ❌ (Moving Pain, Not Solving It)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0se2jidmq2n1t17hqinw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0se2jidmq2n1t17hqinw.png" alt="Read replica" width="800" height="286"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You copy the same normalized schema to another server and point all reads there. Primary handles writes only. Sounds easy right?&lt;/p&gt;

&lt;p&gt;But here is the thing. The replica still has the same 7-table joins. The same slow aggregation queries. The same CPU spike at 9am. You just moved the pain to a different machine. The underlying mismatch between read shape and write shape remains untouched.&lt;/p&gt;

&lt;p&gt;Replicas help when your bottleneck is write contention. Your bottleneck is query complexity. Different problem.&lt;/p&gt;

&lt;p&gt;Option C: Denormalize the Write Schema ⚠️ (The Senior Engineer Trap)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fns8k9nxz5l32ppvh8u9m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fns8k9nxz5l32ppvh8u9m.png" alt="Write chema denormailzation" width="798" height="155"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Flatten everything into one wide table. Line items embedded inside orders. Customer data duplicated everywhere. Reads become blazing fast single-table scans. No more joins. Dashboard loads in milliseconds.&lt;/p&gt;

&lt;p&gt;Feels amazing for 6 months. Then reality hits.&lt;/p&gt;

&lt;p&gt;A customer updates their address. Now you have to update it in 50 flattened rows across millions of records. A product name changes. Same nightmare. Data drifts silently. Anomalies creep in. Debugging becomes hell because you can no longer trust your source of truth.&lt;/p&gt;

&lt;p&gt;This is the trap. It optimizes for today’s read performance at the cost of tomorrow’s data integrity. Senior engineers know this feels good now but hurts later. Junior engineers ship it and celebrate. Six months later everyone is firefighting.&lt;/p&gt;

&lt;p&gt;Option D: GraphQL plus DataLoader ❌ (Optimizing the Wrong Layer)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu62f6et37scn3itgasbp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu62f6et37scn3itgasbp.png" alt="GraphQL + DataLoader" width="799" height="105"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You batch N+1 queries at the application layer. Instead of 100 round trips, you make 1. Network latency drops. Feels like progress.&lt;/p&gt;

&lt;p&gt;But each batched query still hits the same 7-table join on the same overloaded database. You optimized the network call, not the actual bottleneck. The database is still crushing under complex joins at 40K reads per minute. DataLoader makes inefficient queries less wasteful. It does not make them efficient.&lt;/p&gt;

&lt;p&gt;Why This Matters Right Now&lt;/p&gt;

&lt;p&gt;You are at a 1:5 write-to-read ratio. That screams read-heavy workload. Your read model deserves its own optimized shape. Pretending one schema serves both masters is how monoliths die slowly and painfully.&lt;/p&gt;

&lt;p&gt;Thank you, SUBBSCRIBEEEEEEEEEE :))))))))))))))))))))))) | OPEN TO WORK&lt;/p&gt;

</description>
      <category>redis</category>
      <category>postgres</category>
      <category>awss3</category>
      <category>systemdesign</category>
    </item>
    <item>
      <title>Big Billion Days - System Design</title>
      <dc:creator>Bhanu partap</dc:creator>
      <pubDate>Sun, 01 Nov 2026 07:26:17 +0000</pubDate>
      <link>https://dev.to/bhanupartap13/big-billion-days-system-design-30mg</link>
      <guid>https://dev.to/bhanupartap13/big-billion-days-system-design-30mg</guid>
      <description>&lt;p&gt;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.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;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? 😅&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is exactly what happens in production when your cache holds stale data.&lt;/p&gt;

&lt;p&gt;Your system flows like this: Client → Node.js → Redis → PostgreSQL. &lt;/p&gt;

&lt;p&gt;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?&lt;/p&gt;

&lt;p&gt;Let us break it down simply.&lt;br&gt;
Visualize the Problem (The Shop Window Analogy)&lt;/p&gt;

&lt;p&gt;Think of PostgreSQL as your warehouse (Godown). This is where the real stock and real prices live. It is slow but accurate.&lt;/p&gt;

&lt;p&gt;Now think of Redis as your shop's display window. Customers look at the window to decide what to buy. Looking at the window is very fast (20ms), but going to the warehouse takes time.&lt;/p&gt;

&lt;p&gt;So what went wrong?&lt;/p&gt;

&lt;p&gt;A customer bought the last pair of shoes. The warehouse (Postgres) updated the stock to zero. But the display window (Redis) still shows "Stock Available: 5" because nobody updated it.&lt;/p&gt;

&lt;p&gt;The next customer sees the window, places an order, and gets angry when the system says "Out of Stock" at checkout. They feel cheated! 😤&lt;br&gt;
In production terms, Redis has stale data and Postgres has fresh data. They are out of sync.&lt;/p&gt;

&lt;p&gt;Key Terms Made Simple&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cache Hit means the customer found what they needed in the display window. Fast and cheap. &lt;/li&gt;
&lt;li&gt;Cache Miss means the window was empty so you had to run to the warehouse. Slow but accurate.&lt;/li&gt;
&lt;li&gt;Stale Data means the window shows old info. Like displaying "$100" when the warehouse price already changed to "$120".&lt;/li&gt;
&lt;li&gt;Invalidation means removing or marking old data in the cache so nobody trusts it anymore.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What caching strategy does your team use? Drop your answer below 👇&lt;/p&gt;




&lt;p&gt;Decoding the Options&lt;br&gt;
Now let us figure out what to do when a write happens (like stock changing or price updating).&lt;/p&gt;

&lt;p&gt;Option A: Write-through ❌ (Performance Killer)&lt;br&gt;
Every time you update stock, you update both Redis AND Postgres at the same time. Only when both succeed do you tell the user "Done".&lt;br&gt;
Sounds perfect right? Cache is never stale.&lt;br&gt;
But here is the problem. Every single write now waits for two systems. At 40K RPS during a sale, this becomes a massive bottleneck. Latency shoots up and users start abandoning carts. Not good..&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F14whv2klua4x9sgwsjg5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F14whv2klua4x9sgwsjg5.png" alt="Write through" width="800" height="510"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Option B: Write-behind ⚠️ (Risk of Data Loss)&lt;br&gt;
You update only Redis and instantly tell the user "Success!". A background worker slowly syncs Redis changes to Postgres later.&lt;br&gt;
Writes feel lightning fast. User experience is smooth.&lt;br&gt;
But if Redis crashes before the worker syncs to Postgres, that data is gone forever. In e-commerce, losing stock or payment data is unacceptable. This creates financial nightmares 💸&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ff1vsep1nybtzn0furxka.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ff1vsep1nybtzn0furxka.png" alt="write behind" width="800" height="459"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Option C: Cache-aside plus Explicit Invalidation ✅ (The Winner)&lt;br&gt;
For reads, check Redis first. If missing, fetch from Postgres and populate Redis.&lt;br&gt;
For writes, update Postgres directly (it is your source of truth). Then immediately delete that key from Redis.&lt;br&gt;
When the next customer checks that product, they get a cache miss. The app fetches fresh data from Postgres and repopulates Redis automatically.&lt;br&gt;
Simple. Reliable. Consistent. No performance sacrifice.&lt;br&gt;
Yes there is a tiny race condition risk if two people update simultaneously, but this is the industry standard for e-commerce for a reason :)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F98ng8i6r7kocouuysm1e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F98ng8i6r7kocouuysm1e.png" alt="DB -&gt; Cache" width="799" height="724"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Option D: Read-through ❌ (Wrong Place for Logic)&lt;br&gt;
Redis itself becomes smart. If it does not have data, it connects to Postgres and fetches it without the app knowing.&lt;br&gt;
Great for reads. Terrible for writes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ff4znt39sek33zz7y27lr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ff4znt39sek33zz7y27lr.png" alt="Auto" width="800" height="661"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If an admin changes a price, how does Redis know to invalidate its own copy? Read-through alone does not solve the stale write problem.&lt;br&gt;
The Correct Answer and Logic&lt;br&gt;
Correct Answer: C) Cache-aside (lazy loading) where the app writes directly to Postgres, invalidates the cache key, and lets the next read repopulate.&lt;/p&gt;

&lt;p&gt;The logic is beautifully simple.&lt;br&gt;
We want writes to be fast, so we write directly to Postgres.&lt;br&gt;
We want data to stay consistent, so we delete the Redis key.&lt;br&gt;
We want the next read to be fresh, so the cache miss triggers a clean repopulation.&lt;/p&gt;

&lt;p&gt;Stale data disappears because the old cached value is gone before anyone can read it again.&lt;/p&gt;

&lt;p&gt;Next time you build an inventory system, remember the shoe shop. Do not let your display window lie to your customers :)&lt;/p&gt;

&lt;h1&gt;
  
  
  SystemDesign #Caching #Redis #BackendEngineering #ECommerce
&lt;/h1&gt;

</description>
      <category>bigbilliondays</category>
      <category>systemdesign</category>
      <category>redis</category>
      <category>postgres</category>
    </item>
    <item>
      <title>Suppose it is late at night and you decide to order pizza from Zomato. While making the payment, Paytm shows an invalid balance because it is month end.
From your perspective, you created the order, paid, and then it got cancelled......... read :)</title>
      <dc:creator>Bhanu partap</dc:creator>
      <pubDate>Sat, 31 Oct 2026 06:55:05 +0000</pubDate>
      <link>https://dev.to/bhanupartap13/suppose-it-is-late-at-night-and-you-decide-to-order-pizza-from-zomato-while-making-the-payment-2noo</link>
      <guid>https://dev.to/bhanupartap13/suppose-it-is-late-at-night-and-you-decide-to-order-pizza-from-zomato-while-making-the-payment-2noo</guid>
      <description>&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/bhanupartap13/zomato-system-design-4hml" class="crayons-story__hidden-navigation-link"&gt;Zomato - System Design&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;

          &lt;a href="/bhanupartap13" class="crayons-avatar  crayons-avatar--l  "&gt;
            &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2631826%2Ff3ddab20-818a-4339-ad1e-e8a7d7580299.JPG" alt="bhanupartap13 profile" class="crayons-avatar__image" width="800" height="1067"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/bhanupartap13" class="crayons-story__secondary fw-medium m:hidden"&gt;
              Bhanu partap
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                Bhanu partap
                
                
              
              &lt;div id="story-author-preview-content-4951262" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/bhanupartap13" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&gt;
                        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2631826%2Ff3ddab20-818a-4339-ad1e-e8a7d7580299.JPG" class="crayons-avatar__image" alt="" width="800" height="1067"&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;Bhanu partap&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

          &lt;/div&gt;
          &lt;a href="https://dev.to/bhanupartap13/zomato-system-design-4hml" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;Oct 31&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/bhanupartap13/zomato-system-design-4hml" id="article-link-4951262"&gt;
          Zomato - System Design
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/zomato"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;zomato&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/systemdesign"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;systemdesign&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/sqs"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;sqs&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/onlineordersystemdesign"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;onlineordersystemdesign&lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
            &lt;a href="https://dev.to/bhanupartap13/zomato-system-design-4hml#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              

              &lt;span class="hidden s:inline"&gt;Add&amp;nbsp;Comment&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            4 min read
          &lt;/small&gt;
          
          &lt;div class="only-sidebar-menu-item trusted-visible-block print-hidden align-center"&gt;
                
                    
                
          &lt;/div&gt;

        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;


</description>
      <category>architecture</category>
      <category>backend</category>
      <category>systemdesign</category>
    </item>
    <item>
      <title>Zomato - System Design</title>
      <dc:creator>Bhanu partap</dc:creator>
      <pubDate>Sat, 31 Oct 2026 06:51:41 +0000</pubDate>
      <link>https://dev.to/bhanupartap13/zomato-system-design-4hml</link>
      <guid>https://dev.to/bhanupartap13/zomato-system-design-4hml</guid>
      <description>&lt;p&gt;Suppose it is late at night and you decide to order pizza from Zomato. While making the payment, Paytm shows an invalid balance because it is month end.&lt;/p&gt;

&lt;p&gt;From your perspective, you created the order, paid, and then it got cancelled.&lt;/p&gt;

&lt;p&gt;But in Zomato’s backend, there is an order service connected to SQS that is still processing events.&lt;/p&gt;

&lt;p&gt;SQS is a data structure that works like a queue. Standard SQS does not guarantee FIFO ordering. It maintains best-effort ordering and is much cheaper than FIFO queues.&lt;/p&gt;

&lt;p&gt;So there are 5 workers processing messages ahead of yours.&lt;/p&gt;

&lt;p&gt;Suppose the cancellation event reaches Chef1 first because standard SQS does not guarantee order. Chef1 sees the order was cancelled but finds nothing in the database. Then Chef2 receives the creation event and creates the order in the DB. Now you have a paid order that you never actually paid for. 😅&lt;/p&gt;

&lt;p&gt;Then you ordered the same pizza again and enjoyed a movie. 📽️&lt;/p&gt;

&lt;p&gt;Comment your favourite movie name below!&lt;/p&gt;

&lt;p&gt;Meanwhile the finance team tells engineers to stop vibe coding and fix this mess. You have until Monday. What do you do?&lt;/p&gt;

&lt;p&gt;A) Switch to SQS FIFO plus MessageGroupId per order_id and let AWS handle ordering per order.&lt;br&gt;
B) Keep standard SQS, add a sequence number plus reorder buffer in the consumer, and hold out-of-order events until earlier ones arrive.&lt;br&gt;
C) Replace the event stream with a Saga where each step waits for the previous step’s completion signal before firing the next.&lt;br&gt;
D) Add an event version or timestamp and make the state machine idempotent plus order-agnostic by rejecting stale transitions and accepting any arrival order.&lt;/p&gt;

&lt;p&gt;All four are patterns I have seen in real production systems. Only one actually fits this problem. One of them is the trap that catches senior engineers on the whiteboard.&lt;/p&gt;

&lt;p&gt;Pick one, A, B, C, or D, and tell me why. Full breakdown in the comments.&lt;/p&gt;

&lt;p&gt;Drop your answer 👇&lt;/p&gt;

&lt;p&gt;Explanation&lt;/p&gt;

&lt;p&gt;SQS Standard vs FIFO&lt;/p&gt;

&lt;p&gt;Standard SQS is like a normal line where people can sometimes get slightly out of order. It gives best-effort ordering, meaning 99% of the time the sequence is correct but 1% of the time messages may arrive out of order. It is cheap and very fast.&lt;/p&gt;

&lt;p&gt;FIFO SQS is a strict line. Whoever comes first gets served first. But it is slower and more expensive.&lt;/p&gt;

&lt;p&gt;Consumers and Workers&lt;/p&gt;

&lt;p&gt;These are background programs that pick messages from the queue and update the database. In this scenario, 5 workers are processing messages in parallel.&lt;/p&gt;

&lt;p&gt;State Machine&lt;/p&gt;

&lt;p&gt;This is a strict set of rules. For example, it says “I will only accept a Cancelled state if a Created state already exists.” This prevents data corruption.&lt;/p&gt;

&lt;p&gt;Decoding the Options&lt;/p&gt;

&lt;p&gt;Now let us fix this problem by looking at each option.&lt;/p&gt;

&lt;p&gt;Option A: Switch to SQS FIFO plus MessageGroupId per order_id ❌ (The Senior Engineer Trap)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2589hzsf61ctheocg9lg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2589hzsf61ctheocg9lg.png" alt="FIFO concept, while the order will processs seuqntially" width="799" height="576"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You replace the standard queue with a FIFO queue. MessageGroupId ensures all messages for one order_id stay in the same line.&lt;/p&gt;

&lt;p&gt;AWS will guarantee that Created processes first, then Paid, then Cancelled.&lt;/p&gt;

&lt;p&gt;But here is the trap. FIFO queues have much lower throughput than standard queues, around 3000 messages per second per group. If you have 2000 orders per minute with 3 messages each, the FIFO queue becomes a bottleneck. The system slows down. This is a band-aid solution, not a permanent fix.&lt;/p&gt;

&lt;p&gt;Option B: Add a sequence number plus reorder buffer in the consumer ⚠️ (Too Complex)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fopy7sfz2k10f7rdjc5an.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fopy7sfz2k10f7rdjc5an.png" alt="Sequence Ordering for SQS, taht can become too heavy" width="800" height="855"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You send a sequence number with every message and keep a buffer in the consumer. If Cancelled arrives first, you store it in the buffer and wait for Created to arrive.&lt;/p&gt;

&lt;p&gt;But this is very hard to implement correctly. If the Created message never arrives due to a network issue, the Cancelled message stays stuck in the buffer forever causing memory leaks or deadlocks. Distributed systems avoid such complex buffers.&lt;/p&gt;

&lt;p&gt;Option C: Replace the event stream with a Saga ❌ (Wrong Use Case)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2xv7ou3wvb148dh5jdag.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2xv7ou3wvb148dh5jdag.png" alt="SAGA Archiectecture" width="800" height="551"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Saga pattern is used when you have multiple microservices like Order Service, Payment Service, and Inventory Service and need to manage distributed transactions between them.&lt;/p&gt;

&lt;p&gt;But here the problem is queue ordering, not distributed transactions. Saga is overkill for this situation.&lt;/p&gt;

&lt;p&gt;Option D: Add event version or timestamp and make the state machine idempotent plus order-agnostic ✅ (The Winner)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fs78uprovxesxmj5kr2bj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fs78uprovxesxmj5kr2bj.png" alt="Ordeer Agnostic and Idempotent" width="800" height="799"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You make your state machine smarter and more flexible.&lt;/p&gt;

&lt;p&gt;Order-agnostic means the state machine does not care about event arrival order. If Cancelled arrives first, it accepts it and sets the order directly to Cancelled state even if Created comes later.&lt;/p&gt;

&lt;p&gt;Idempotent means even if the same event arrives 10 times, the result stays the same.&lt;/p&gt;

&lt;p&gt;You fixed the root cause which was a fragile state machine. Now you can use standard SQS for high throughput without worrying about out-of-order messages crashing the system.&lt;/p&gt;

&lt;p&gt;The Correct Answer and Logic&lt;/p&gt;

&lt;p&gt;Correct Answer: D) Add an event version or timestamp and make the state machine idempotent plus order-agnostic.&lt;/p&gt;

&lt;p&gt;The logic is simple. There is a golden rule in distributed systems: Never trust the network. The network can delay messages or deliver them out of order at any time.&lt;/p&gt;

&lt;p&gt;If your state machine is so strict that it rejects out-of-order messages, your system will always be fragile.&lt;/p&gt;

&lt;p&gt;:))))))))))))))))) SUBSCRIBE :))))))))))))))))))))))))))&lt;/p&gt;

</description>
      <category>zomato</category>
      <category>systemdesign</category>
      <category>sqs</category>
      <category>onlineordersystemdesign</category>
    </item>
    <item>
      <title>You went to bathroom.... and got crashed</title>
      <dc:creator>Bhanu partap</dc:creator>
      <pubDate>Fri, 30 Oct 2026 05:33:08 +0000</pubDate>
      <link>https://dev.to/bhanupartap13/you-went-to-bathroom-and-got-crashed-4cp</link>
      <guid>https://dev.to/bhanupartap13/you-went-to-bathroom-and-got-crashed-4cp</guid>
      <description>&lt;p&gt;Imagine you are in a bathroom with a 5 minute timer. &lt;/p&gt;

&lt;p&gt;You go in but crash at minute 3. The lock is still on for 2 more minutes. &lt;/p&gt;

&lt;p&gt;Your friend arrives at minute 3 and just stands outside waiting even though the bathroom is empty.&lt;/p&gt;

&lt;p&gt;That wasted time is exactly what happens in software when a process dies but the Redis lock stays alive.&lt;/p&gt;

&lt;p&gt;Now imagine three servers behind a load balancer. Every 5 minutes a cron job fires to generate a daily report and all three try to grab it. You use Redis SETNX with a 5 minute TTL. Instance A wins and thinks it owns the bathroom. But then it gets OOM killed at minute 3. The lock remains. No report runs for 2 more minutes. Then another instance grabs it. But wait, the first instance restarted and also thinks it still owns the bathroom. Now both are writing to the same output. Data corruption. 💥&lt;/p&gt;

&lt;p&gt;This is the split brain problem. Redis cannot tell if a client is working or just frozen.&lt;/p&gt;

&lt;p&gt;So what is the right pattern here?&lt;/p&gt;

&lt;p&gt;A) Redis SETNX plus short TTL plus fencing token&lt;br&gt;
B) Redlock across 5 independent Redis nodes&lt;br&gt;
C) Database pessimistic lock using SELECT FOR UPDATE&lt;br&gt;
D) Optimistic concurrency with unique key inserts&lt;/p&gt;

&lt;p&gt;All four are real patterns engineers ship. But only one survives this exact failure mode. One of them is what Martin Kleppmann publicly tore apart 8 years ago and people still argue about it today.&lt;/p&gt;

&lt;p&gt;Firstly, What would you pick? Drop your answer below. 👇&lt;/p&gt;

&lt;p&gt;Let us break it down simply.&lt;/p&gt;

&lt;p&gt;Option B, Redlock&lt;/p&gt;

&lt;p&gt;This sounds bulletproof. Acquire locks on 5 separate Redis nodes and proceed only if majority agree. But Martin Kleppmann proved that if system clocks drift even slightly, two instances can get the lock simultaneously. It is complex, fragile, and usually over-engineering for most teams. This is the trap.&lt;/p&gt;

&lt;p&gt;Option C, Database Pessimistic Lock&lt;/p&gt;

&lt;p&gt;You lock the row in your jobs table until the transaction completes. If Instance B dies, the connection drops and the lock releases automatically. Safe? Yes. But heavy. Holding a database connection open for a long running report job is bad practice. Your database becomes the bottleneck instead of your compute.&lt;/p&gt;

&lt;p&gt;Option D, Optimistic Concurrency&lt;/p&gt;

&lt;p&gt;No locks at all. Each instance generates the full report and tries to insert it with a unique key. Database rejects duplicates. Sounds elegant until you realize both instances just wasted 10 minutes of compute generating a report that gets thrown away. For heavy jobs, this is pure waste.&lt;/p&gt;

&lt;p&gt;Option A, Fencing Token&lt;/p&gt;

&lt;p&gt;This is your winner. Think of it like a ticket number at a government office. Every time someone gets the lock, they receive a monotonically increasing number. Token 101, then 102, then 103.&lt;/p&gt;

&lt;p&gt;When Instance B comes back from its GC pause with Token 101 and tries to write, the storage layer checks: “Current valid token is 103. You have 101. Your lock is stale. Rejected.”&lt;/p&gt;

&lt;p&gt;Instance C with Token 103 writes safely. No corruption. No wasted compute. No clock dependency.&lt;/p&gt;

&lt;p&gt;The fencing token makes the downstream resource the source of truth, not Redis. Redis just hands out tickets. The storage layer enforces order.&lt;/p&gt;

&lt;p&gt;The lesson here is simple. Distributed locks are not about preventing two workers from starting. They are about preventing a zombie worker from writing after it should be dead. TTL alone cannot do that. You need a monotonic guarantee.&lt;/p&gt;

&lt;p&gt;If your team has ever argued about Redlock versus SETNX at 3am, share this with them. The debate itself is the learning.&lt;/p&gt;

&lt;h1&gt;
  
  
  SystemDesign #DistributedSystems #Redis #BackendEngineering #shortTTL #longTTL #dailyupdates
&lt;/h1&gt;

</description>
      <category>systemdesign</category>
      <category>redis</category>
      <category>ttl</category>
      <category>distributedsystems</category>
    </item>
    <item>
      <title>Black Friday Sale: System Design</title>
      <dc:creator>Bhanu partap</dc:creator>
      <pubDate>Thu, 29 Oct 2026 06:53:11 +0000</pubDate>
      <link>https://dev.to/bhanupartap13/black-friday-sale-system-design-284h</link>
      <guid>https://dev.to/bhanupartap13/black-friday-sale-system-design-284h</guid>
      <description>&lt;p&gt;Imagine, there are 4 database sharding strategies with 4 completely different outcomes. Pick the wrong one and your primary database melts on Black Friday.&lt;/p&gt;

&lt;p&gt;Your Postgres orders table just hit 500 million rows. Queries that used to take 40ms are now crawling at 800ms. Vertical scaling is dead. You have to shard.&lt;/p&gt;

&lt;p&gt;But before you pick a strategy, look at your actual workload.&lt;/p&gt;

&lt;p&gt;80% of reads are customers checking their own order history from the last 30 days.&lt;br&gt;
15% are analytics queries on date ranges.&lt;br&gt;
Only 5% are new writes, around 400 requests per second, doubling on sale days.&lt;/p&gt;

&lt;p&gt;So which sharding strategy do you choose?&lt;/p&gt;

&lt;p&gt;A) Hash sharding on order_id&lt;br&gt;
B) Range sharding on created_at&lt;br&gt;
C) Directory based sharding&lt;br&gt;
D) Consistent hashing with virtual nodes&lt;/p&gt;

&lt;p&gt;What would you pick? Drop your answer below. 👇&lt;/p&gt;

&lt;p&gt;All four are real production strategies. But only one fits this specific e-commerce pattern. One of these is the senior engineer trap that looks smart in tutorials but will destroy your latency in reality.&lt;/p&gt;

&lt;p&gt;Let us break it down like we are explaining it to a friend over chai.&lt;/p&gt;

&lt;p&gt;English Breakdown: &lt;/p&gt;

&lt;p&gt;Option A, Hash Sharding on Order ID&lt;/p&gt;

&lt;p&gt;This sounds perfect because it distributes data evenly. No hotspots. But here is the problem. When a customer logs in and asks for their last 30 days of orders, their data is scattered across every single shard. Your app has to query all shards and stitch results together. This is called scatter-gather and it is painfully slow for user-facing queries. This is the trap. YouTube loves it, but your users will hate it.&lt;/p&gt;

&lt;p&gt;Option B, Range Sharding on Date&lt;/p&gt;

&lt;p&gt;Great for analytics, terrible for sales. On Black Friday, every new order hits the current month shard while older shards sit idle. That one shard gets crushed under double traffic and crashes. The rest of your infrastructure watches helplessly. This is how you melt a primary database during peak revenue moments.&lt;/p&gt;

&lt;p&gt;Option D, Consistent Hashing&lt;/p&gt;

&lt;p&gt;Amazing for rebalancing when adding servers. Terrible for customer-centric queries. Same scatter-gather problem as Option A. Your customers do not care about your elegant ring topology. They care about seeing their order history instantly.&lt;/p&gt;

&lt;p&gt;Option C, Directory Based Sharding&lt;/p&gt;

&lt;p&gt;This is your winner. Think of it like a phone directory. You maintain a fast lookup service that maps each customer to their specific shard. When Customer X asks for their orders, you check the directory, go directly to Shard 5, and return results in milliseconds. No scattering. No gathering. Just direct access.&lt;/p&gt;

&lt;p&gt;Yes, the directory itself can become a bottleneck. But you solve that by caching it in Redis with replication. High availability, low latency, perfect fit for 80% customer-centric reads.&lt;/p&gt;

&lt;p&gt;The lesson here is simple. Do not pick a sharding strategy because it sounds sophisticated. Pick it because it matches your actual query patterns. Numbers tell stories. Listen to them.&lt;/p&gt;

&lt;p&gt;If your team is debating a database migration right now, share this with them. Someone is about to make an expensive mistake.&lt;/p&gt;

&lt;p&gt;Hinglish:&lt;/p&gt;

&lt;p&gt;Step 1: Terms Ko Simple Bhasha Mein Samjho&lt;br&gt;
Question mein likha hai: "80% reads... 15% reads... 5% writes..."&lt;br&gt;
Yeh kya matlab hai?&lt;/p&gt;

&lt;p&gt;Supermarket (Database)&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Reads (Padhna/Dekhna):&lt;br&gt;
Jab customer shelf par jaakar dekhta hai ki "Mere liye kya product available hai?" ya "Mera purana bill kya tha?" — Yeh Read operation hai.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Writes (Likhna/Change karna):&lt;br&gt;
Jab customer counter par jaakar naya saman khareedta hai aur cashier usse bill mein add karta hai — Yeh Write operation hai.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;RPS (Requests Per Second):&lt;br&gt;
Har second kitne log server ko hit kar rahe hain.&lt;br&gt;
400 RPS: Matlab har second 400 naye orders aa rahe hain. Sale ke din yeh double (800) ho jata hai.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Sharding (Baantna):&lt;br&gt;
Ab tumhara Supermarket (Database) itna bada ho gaya hai ki ek hi building mein saara maal rakhna mushkil ho raha hai.&lt;br&gt;
Sharding ka matlab hai: Tum apne pure database ko chhote-chhote tukdon (Shards) mein baant do aur alag-alag servers par rakh do.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Real Question: &lt;br&gt;
Tumhare paas 50 Crore (500M) orders hain.&lt;br&gt;
Pehle jab orders kam the, toh search karna 40ms (milliseconds) leta tha.&lt;br&gt;
Ab itna data hai ki search karte waqt database ko poora table scan karna padta hai, jo 800ms le raha hai. User ko lagta hai app hang ho gayi hai! &lt;/p&gt;

&lt;p&gt;Tumhe ab decide karna hai ki in 50 Crore orders ko kaise baantein (Shard kaise karein) taaki user ko apna order history turant mile.&lt;br&gt;
Workload Yaad Rakho:&lt;/p&gt;

&lt;p&gt;80% Queries: "Customer X ke pichle 30 din ke orders dikhao." (Yeh customer-centric hai).&lt;br&gt;
15% Queries: Analytics (Date range wale).&lt;br&gt;
5% Writes: Naye orders.&lt;br&gt;
Step 3: Options Ko Decode Karein (Why &amp;amp; Where)&lt;br&gt;
Chaliye har option ko simple example se samajhte hain:&lt;/p&gt;

&lt;p&gt;Option A: Hash Sharding on order_id&lt;br&gt;
Kya hai? Computer ek mathematical formula (Hash Function) use karta hai order_id par. Jaise order_id = 101 shayad Shard 1 par jaye, aur order_id = 102 Shard 5 par.&lt;br&gt;
Fayda: Data bilkul barabar (evenly) distribute ho jata hai. Koi ek shard overload nahi hota.&lt;br&gt;
Nuksan (The Trap): Agar mujhe "Customer X" ke saare orders dhundhne hain, toh mujhe pata nahi ki uske orders kis-kis shard par bikhre hain. Mujhe saare shards ko query karna padega (Scatter-Gather problem). Yeh slow ho jayega.&lt;/p&gt;

&lt;p&gt;Option B: Range Sharding on created_at (Date)&lt;br&gt;
Kya hai? Data ko date ke hisaab se baanta hai.&lt;br&gt;
Shard 1: Jan-Mar 2023 ke orders.&lt;br&gt;
Shard 2: Apr-Jun 2023 ke orders.&lt;br&gt;
Fayda: Agar analytics team puche "Pichle mahine kitne sale hue?", toh wo sirf ek specific shard ko query karegi. Very fast for analytics.&lt;br&gt;
Nuksan (Hotspot Problem): Black Friday ya Sale ke din, naye orders sirf "Current Month" wale shard par aayenge. Baaki shards khali padenge. Current shard par load badh jayega aur wo "melt" (crash) ho sakta hai. Ise Hotspotting kehte hain.&lt;/p&gt;

&lt;p&gt;Option C: Directory-based Sharding (Lookup Table)&lt;br&gt;
Kya hai? Ek alag se "Phone Directory" (Lookup Service) hota hai.&lt;br&gt;
Jab request aati hai "Customer X ke orders lao", pehle Directory se pucha jata hai: "Bhai, Customer X kis Shard par hai?"&lt;br&gt;
Directory batata hai: "Wo Shard 3 par hai."&lt;br&gt;
Phir direct Shard 3 se data fetch kiya jata hai.&lt;br&gt;
Fayda: Yeh exactly wahi karta hai jo humein chahiye. Kyunki 80% queries Customer-Centric hain, hum directly usi shard par ja sakte hain jahan wo customer ka data hai. No need to search everywhere.&lt;br&gt;
Nuksan: Directory service khud ek single point of failure ban sakti hai (agar wo down ho gayi toh koi kuch nahi dhundh payega), lekin ise cache karke manage kiya ja sakta hai.&lt;/p&gt;

&lt;p&gt;Option D: Consistent Hashing with Virtual Nodes&lt;br&gt;
Kya hai? Yeh Option A (Hashing) ka hi advanced version hai. Isme servers ko ring ki tarah arrange kiya jata hai taaki agar ek server add/remove ho, toh poora data reshuffle na karna pade.&lt;br&gt;
Fayda: Scaling aur rebalancing bahut aasaan hai.&lt;br&gt;
Nuksan: Yeh bhi hashing hi hai. Agar maine order_id par hash kiya, toh wahi Scatter-Gather problem aayegi. Customer ke saare orders alag-alag jagah bikhre honge.&lt;/p&gt;

&lt;p&gt;Subscribe :)&lt;/p&gt;

&lt;h1&gt;
  
  
  SystemDesign #Databases #PostgreSQL #BackendEngineering #SystemDesignInterview #SystemDesignBlog #Redis #Sharding #BlackFridaySystemDesign
&lt;/h1&gt;

</description>
      <category>blackfridaysystemdesign</category>
      <category>systemdesignhinglish</category>
      <category>redis</category>
      <category>systemdesign</category>
    </item>
    <item>
      <title>Your Smartphone can now deliver best gaming graphics, run AI directly on the device - Qualcomm's Snapdragon 8 Elite</title>
      <dc:creator>Bhanu partap</dc:creator>
      <pubDate>Sat, 10 Oct 2026 06:42:43 +0000</pubDate>
      <link>https://dev.to/bhanupartap13/your-smartphone-can-now-deliver-best-gaming-graphics-run-ai-directly-on-the-device-qualcomms-n0g</link>
      <guid>https://dev.to/bhanupartap13/your-smartphone-can-now-deliver-best-gaming-graphics-run-ai-directly-on-the-device-qualcomms-n0g</guid>
      <description>&lt;p&gt;&lt;em&gt;We first need to understand the challenges with previous mobile platforms.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Mobile devices have limited power and cooling capacity. When a game renders complex graphics at high frame rates, the GPU has to perform more work. This can increase power consumption and heat, which may cause performance to drop during long gaming sessions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;AI introduces another challenge. Running AI models directly on a smartphone requires sufficient computing power and memory. Some AI features also depend on cloud servers, which can introduce network delays and require an internet connection.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The challenge is not simply to make a smartphone faster. It is to improve performance, graphics, and AI capabilities while managing power consumption and heat.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;What Has Qualcomm Added?&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Qualcomm is improving three important parts of the mobile architecture: the CPU, GPU, and NPU.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;First, the CPU, powered by Qualcomm’s custom Oryon architecture, handles general computing, application logic, and system tasks. Improvements here are designed to support faster processing and smoother application performance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Second, the Adreno GPU handles graphics rendering for games and other visual applications.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One of the key additions is Adreno Neural Fusion. It combines AI-assisted graphics techniques, including super resolution and frame generation, within a unified graphics pipeline.&lt;/p&gt;

&lt;p&gt;Super resolution uses AI to reconstruct a higher-resolution image from a lower-resolution input. Frame generation creates additional frames between rendered frames to make motion appear smoother.&lt;/p&gt;

&lt;p&gt;Qualcomm has also introduced Adreno matrix cores for AI-related GPU workloads. For game developers, these capabilities create new opportunities to improve visual quality without requiring every graphical detail to be rendered in the traditional way.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Third, the Hexagon NPU is designed to accelerate AI workloads. Instead of relying entirely on the CPU, applications can use dedicated AI hardware for supported operations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This helps enable on-device AI, where supported models and tasks can run directly on the smartphone instead of always sending requests to cloud servers.&lt;/p&gt;

&lt;p&gt;Qualcomm is also advancing mobile imaging through Intelligent Pixel Control and Advanced Professional Video support on the Extreme platform.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;What Will Be the Results?&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For gamers, these technologies could deliver sharper graphics and smoother gameplay, depending on game support and device performance.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;For game developers, AI-assisted rendering creates more options to improve visual quality while managing the processing demands of mobile hardware.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For AI developers, on-device processing can support responsive AI features with reduced dependence on remote servers. However, the actual benefits depend on model size, memory, software optimisation, and the workload.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For content creators, improvements in image processing and video capabilities could support better mobile photography and more advanced video workflows.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The final experience will still depend on the smartphone’s cooling system, software, game-engine integration, and how developers implement these technologies.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Closing&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The biggest change is not simply a faster processor. It is the closer integration of traditional computing, graphics processing, and artificial intelligence.&lt;/p&gt;

&lt;p&gt;Qualcomm is giving developers more tools to build advanced mobile experiences.&lt;/p&gt;

&lt;p&gt;The real test, however, is how well smartphone manufacturers and developers turn these hardware capabilities into features that people can actually use.&lt;/p&gt;

&lt;p&gt;Bhanu Partap,&lt;br&gt;
&lt;a href="mailto:partapbhanu516@gmail.com"&gt;partapbhanu516@gmail.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>snapdragon</category>
      <category>qualcomm</category>
      <category>chips</category>
      <category>imc2026</category>
    </item>
  </channel>
</rss>
