FromKSR BengaluruSBC
ToNew DelhiNDLS
Searching trains…
3AAVL 2booked—- bookings
FromKSR BengaluruSBC
ToNew DelhiNDLS
Searching trains…
3AAVL 2booked—FromKSR BengaluruSBC
ToNew DelhiNDLS
Searching trains…
3AAVL 23AAVL 2booked—Tatkal at ten: every search asks PRS itself, or reads a copy of the counts that catches up within seconds. Then the last two berths go, and Rajat taps Book. Illustrative counts and times.
For what people only look at, like a search screen, eventual is fast, and a few seconds old is fine. For anything that decides who gets what, like a booking, it must be strong. That’s why IRCTC can show two left and still waitlist you.
| Difference | Strong | Eventual |
|---|---|---|
| A read | Always the latest | Maybe a few seconds old |
| Its cost | Every read reaches the one place that writes | Reads spread over copies, in milliseconds |
| After a write | The next read sees it | Wrong for a moment, then right |
| At IRCTC | The booking: one writer per train | The count a search shows |
| Pick it for | Bookings, payments, balances, stock | Search results, counts, feeds, likes |
Ten o’clock, and Tatkal opens. Lakhs of people search for the same few berths. On the left, strong consistency: every search asks PRS, the one system that books berths, so the answer is always the latest. On the right, eventual consistency: searches read a copy of the counts, which catches up within a few seconds. Let’s follow Rajat through both.
First, Rajat searches for tomorrow’s Karnataka Express. With strong consistency, his search goes all the way to PRS.
PRS is also booking berths for lakhs of people, so his search waits in the same queue.
Seconds later the answer comes: two berths left in 3A. Right, but slow.
Now the same search with eventual consistency. It reads the copy of the counts instead, and PRS never sees it.
The answer comes back in milliseconds: two berths left. The copy agrees with PRS, because nothing has changed yet.
Next, Faf and ABD book the last two berths. PRS saves both, and 3A is now full.
Rajat searches again. PRS answers with the latest count: waitlist one. Strong means every read sees the newest write.
With eventual consistency, the copy hasn’t heard about those bookings yet. Rajat searches again, and still sees two berths left.
Within three seconds the update reaches the copy, and it says waitlist one too. Wrong for a moment, then right. That’s eventual.
Finally, Rajat taps Book. His screen already said waitlist, so there’s no surprise: PRS gives him waitlist one.
On the eventual side, say he tapped Book in those three seconds, while his screen still said two left.
Bookings never read the copy: they go to PRS, which checks the real count. Rajat gets waitlist one, not a berth someone else already has.
So which should you pick? For what people only look at, like a search screen, eventual is fast, and a few seconds old is fine. For anything that decides who gets what, like a booking, it must be strong. That’s why IRCTC can show two left and still waitlist you.