1 of 16

CAP THEOREM & EVENTUAL CONSISTENCY

System Design Session - DevCongress Meetup [MAY 2026]

2 of 16

The Big Picture: Blacko's Detty December Concert

Blacko (Black Sherif) is hosting an epic, end-of-year homecoming concert at El-Wak Stadium during Detty December. Demand is off the charts.

What Blacko wants to do is simple: He wants to sell tickets online. He wants the website to be lightning-fast so fans don't get frustrated, and he wants to make sure that if a fan pays for a ticket, they actually get a valid seat.

​

To make this happen, the tech team sets up a standard, simple system:

  • The Main Database (Accra): This is the single source of truth that processes final payments and deducts tickets from the total count.
  • The Local Helpers (Kumasi and Tamale): To prevent the Accra database from crashing under heavy traffic, copycat databases (read replicas) are placed in Kumasi and Tamale. These local nodes quickly show fans the ticket prices and seat maps without bothering the main Accra database.

This simple idea sounds perfect, but as traffic spikes, the laws of physics kick in and things get complicated fast.

3 of 16

Step 1: The Sneaky Latency Window

​

​

Everything is running normally. The concert is almost sold out, and there is exactly 1 VIP Backstage Pass left.

How it breaks

Kojo is in Accra. He clicks buy, his payment clears, and the Accra database drops the ticket count from 1 to 0.

​

Think about what breaks in this scenario.

Imagine if Kojo, located in Accra decides to buy that last one, What happens to the fans in Kumasi and Tamale.

Also, what happens to the copycat databases in Kumasi and Tamale?

What options are available to the tech team?

4 of 16

Step 1: The Sneaky Latency Window

​

​

How it breaks

Kojo is in Accra. He clicks buy, his payment clears, and the Accra database drops the ticket count from 1 to 0.

Because the system needs to be fast, the Accra database doesn't wait around; it instantly tells Kojo his purchase was successful. Only after confirming Kojo's ticket does Accra start sending an electronic message across the country to update the helpers in Kumasi and Tamale.

This update takes time—maybe 50 milliseconds. In that exact split second, Abena in Kumasi refreshes her app. Her phone talks to the local Kumasi helper, which hasn't received the update from Accra yet. Abena sees "1 ticket left!", pulls out her mobile money wallet, and hits buy.

5 of 16

The Trade-off

To prevent this, you could force the Accra database to pause Kojo's checkout until every helper database in Ghana confirms they updated their count to 0. But doing this means the app becomes incredibly slow. If the network in Tamale experiences a minor hiccup, the entire checkout system freezes for everyone across the country.

​

The Reality: Even when the network is healthy, databases take time to talk to each other. This delay means parts of your app will occasionally lie to your users.

6 of 16

Step 2: The Storm (When You Must Choose Your Poison)

A massive December storm rolls in and physically cuts the fiber internet cables linking the Tamale database to Accra. The system is now experiencing a Network Partition. The Tamale database is completely isolated.

​

Think about the consequences of this downtime.

Imagine Aminu in Tamale also decides to buy the last VIP ticket. What happens to each of the 3 database instances?

What options are available in this case?

7 of 16

Step 2: The Storm (When You Must Choose Your Poison)

​

How it breaks

While the network is down, Aminu in Tamale opens his app to buy that last VIP ticket. The Tamale database checks its local records and sees 1 ticket available. But because the internet line is cut, Tamale cannot talk to Accra to verify if that ticket was already sold to someone else.

​

​

8 of 16

The Tamale server is forced to make an instant choice between two options:

Option 1: Choose Consistency (Lock the App). The Tamale server realizes it cannot verify the true ticket count with Accra. It refuses to guess, blocks the transaction, and shows Aminu an error screen. The data stays perfectly clean (no double-selling), but the app looks broken to an entire region of fans.

Option 2: Choose Availability (Take the Money). The Tamale server decides that the show must go on. It trusts its local data, accepts Aminu's payment, and confirms his ticket. Aminu is happy because the app is fast and responsive, but the system has now officially sold the exact same physical ticket to two different people.

The Reality (The CAP Theorem): When a network split happens, you cannot have a system that is both perfectly accurate and 100% available. You must choose whether you prefer a broken user experience or duplicated data.

9 of 16

Step 3: Cleaning Up the Mess

The engineering team decided to keep the system online (choosing Availability). The storm clears, the internet link heals 15 minutes later, and the databases automatically synchronize. The system immediately notices the conflict: Kojo in Accra and Aminu in Tamale both bought the exact same unique seat.

​

How it is fixed

Databases cannot solve this operational nightmare automatically. The fix has to happen at the business level:

10 of 16

Business Level Decisions

Technical Guardrails: To minimize these errors, engineers use temporary holding pools. When a fan clicks a ticket, that ticket is "locked" in a fast, shared temporary memory pool for 10 minutes. If their payment doesn't clear in time, the ticket goes back into the pool.

​

Business Compensation: Instead of showing a cold database error to the fan who lost out, the business handles the data glitch with customer service. Aminu's ticket might be canceled, but the system automatically triggers a compensation loop: he gets an automated apology email, an upgrade to a VVIP seat, a free t-shirt, and a pass to meet Blacko before the show.

​

The Reality: Eventual consistency means the data will correct itself eventually, but the business must have a plan to manage the real-world chaos that happens in the meantime.

11 of 16

Step 4: The Global Boss Level

The concert is shifted to an ultra-exclusive, intimate acoustic set. Capacity is strictly limited to 1,000 seats. Blacko says money is no object—use the best cloud infrastructure available.

Because it is Detty December, millions of diaspora fans from Tokyo to Kingston hit the website at the exact same millisecond.

12 of 16

How it breaks

At this scale, standard database tactics completely collapse, and unlimited money cannot save the system for two reasons:

​

The Database Jam: If millions of global requests try to change the exact same line of data (ticket_count = 1000) at the exact same millisecond, the database gets jammed trying to process locks sequentially. The server freezes, overheats, and crashes.

​

The Speed of Light: Data cannot travel faster than the speed of light. A transaction initiated by a fan in Tokyo takes about 200 milliseconds just to make the round trip to a server in West Africa and back. Unlimited budgets cannot change the laws of physics.

13 of 16

Step 4: The Global Boss Level

The concert is shifted to an ultra-exclusive, intimate acoustic set. Capacity is strictly limited to 1,000 seats. Blacko says money is no object—use the best cloud infrastructure available.

Because it is Detty December, millions of diaspora fans from Tokyo to Kingston hit the website at the exact same millisecond.

14 of 16

How it breaks

At this scale, standard database tactics completely collapse, and unlimited money cannot save the system for two reasons:

​

The Database Jam: If millions of global requests try to change the exact same line of data (ticket_count = 1000) at the exact same millisecond, the database gets jammed trying to process locks sequentially. The server freezes, overheats, and crashes.

​

The Speed of Light: Data cannot travel faster than the speed of light. A transaction initiated by a fan in Tokyo takes about 200 milliseconds just to make the round trip to a server in West Africa and back. Unlimited budgets cannot change the laws of physics.

15 of 16

How Global Systems Survive

To handle this ultimate scale, engineers change how traffic and data flow entirely:

​

The Virtual Waiting Room: Do not let millions of people hit the database at once. Use networks at the internet's edge to catch users before they reach the website. Put them in a digital line (like a queue) and only let 500 people into the actual checkout area at a time.

​

Inventory Sharding: Divide the 1,000 tickets into regional buckets before the sale even starts. Give 300 tickets to the American servers, 300 to European/Asian servers, and 400 to local African servers. Now, fans in Jamaica are only competing against other fans in Jamaica, eliminating the global database jam.

16 of 16

Strategy

How it Works

The Good

The Bad

Best Used For

Strict Accuracy (CP)

The system freezes checkouts until every global server agrees on the data.

Zero data mistakes; no duplicate sales.

Slow performance; if one server has a network issue, the whole app breaks.

Bank accounts, money transfers, identity passwords.

High Speed (AP)

Servers process sales instantly and sync up the details later.

Blazing fast; the website almost never goes down.

Servers will temporarily show old or incorrect data.

Social media feeds, product catalogs, video view counters.

Waiting Rooms

Holds traffic in a digital line outside the app.

Protects databases from crashing during massive rushes.

Fans have to wait in a virtual line.

Huge concert ticket drops, limited sneaker releases.

Splitting Stock (Sharding)

Divides inventory into independent regional pools.

Eliminates global system traffic jams; instant local checkouts.

Leftover tickets in one region cannot easily be bought by another region.

Global retail drops, geographically split events.

Quick Reference Summary