avatarTeenage Programmer

Summary

Uber's engineers have developed a sophisticated payment system capable of handling trillions of transactions securely and accurately by leveraging microservices, double-entry accounting, immutable databases, and a specialized Ledger Store.

Abstract

Uber's payment system evolution is a response to the massive scale of operations, with the platform facilitating billions of rides and transactions. Initially struggling with instability and delays, Uber transitioned from a monolithic architecture to a microservices-based approach, allowing for independent scaling and more efficient transaction processing. The adoption of double-entry accounting ensures financial integrity, while the use of immutable databases and an append-only system maintains a clear audit trail. A key component of Uber's solution is the Ledger Store, a specialized database designed for transaction management that provides validation and security for the vast amount of data. The migration of 250 billion records to the new system was managed without service interruption using a checkpoint system and the 'Shadow Rider' tool, which ensured data consistency and accuracy. Additionally, Uber employs extensive indexing to quickly navigate through trillions of transactions, ensuring the system's scalability and performance.

Opinions

  • The initial payment systems at Uber were insufficient, leading to instability and payment discrepancies, which were deemed unacceptable.
  • The shift to microservices was crucial in handling the complexities of Uber's growing transaction volume, allowing for a more resilient and scalable system.
  • Double-entry accounting was a strategic choice to maintain financial accuracy, reflecting the importance of trust and reliability in payment processing.
  • The decision to use immutable databases demonstrates a commitment to transparency and traceability in financial transactions.
  • The development of the Ledger Store signifies Uber's dedication to creating robust in-house solutions to meet its unique challenges.
  • The meticulous migration process, including the use of 'Shadow Rider' for data comparison, underscores the importance of a seamless transition and uninterrupted service.
  • The emphasis on indexing at a massive scale showcases Uber's focus on maintaining high performance and quick data retrieval despite the enormous volume of transactions.

How Uber Handles TRILLIONS of Transactions — The Secret

Non-Member Friends Click Here:

How can software handle TRILLIONS of payments without missing a single transaction? In this post, I’ll reveal the secret of the Uber engineer's solution and easily explain how it all works.

Now we all know how Uber works.

Click a button that pays money for a ride from one place to another — Wait for your driver — Get in the car and arrive at your destination. Leave, and then Uber pays the money the driver is owed. Pretty simple, right?

Now add 100 million users!

Behind the scenes, Uber is handling an unimaginable volume of transactions every second, Billions of rides and hundreds of billions worth of money being passed around the world.

How does Uber manage this complexity smoothly and securely?

The Challenge of Billions of Payments

As Uber grew, so did the volume of transactions it needed to process. In the early days, Uber’s initial payment systems struggled, facing issues like instability and delays in their payments.

However, if there’s one thing that Uber just can’t mess up was it’s dealing with money.

Their system was messing up big time. Payment discrepancies and just major delays were everywhere

Imagine being an Uber driver, driving and giving rise for two days straight. Then a cyberattack happens and then all your payments that you’ve been expecting for the last few days, it’s just gone.

Handling billions of transactions wasn’t easy, and Uber needed a solution that could keep up with their fast-growing scale.

That’s when Uber made a big decision: to move to a more robust payment system.

The Shift to a Robust Payment System

To handle this growing demand, Uber transitioned from a monolithic (single or just one big application) system to microservices — smaller, independent services that can work together but function separately.

By breaking the system into smaller parts, Uber could scale each part independently, ensuring smoother transactions for every user.

For example,

One microservice might be responsible for handling ride payments, another for processing refunds, and another for applying promotions.

This separation of tasks meant that each microservice could handle a specific part of the transaction process, making the entire system more flexible and efficient by distributing the load.

Double-Entry Accounting: Ensuring Financial Integrity

When dealing with so many payments, financial accuracy is crucial. Uber adopted double-entry accounting to make sure every transaction is correctly recorded.

Think of it like balancing your personal checkbook: every time you spend money, you note it down, but you also keep track of where it went. This way, if something looks off, you can trace back to see what happened.

Same goes here

Have read the Uber Driver case above? Here’s Uber’s solution, for every fare charged, there’s a corresponding record set elsewhere to verify it.

This makes it easier to catch and fix any discrepancies.

Basically, It’s a system commonly used in finance, helping Uber maintain financial accuracy even with huge transaction volumes.

The Importance of Immutable Databases

Well, first, most databases aren’t immutable.

If I wanted to change my name on any website, once I change it on the form, the database goes to the existing entry and then updates it, removing the previous value. This is because it is mutable (can be changed).

If I went to try this on an immutable database, it would have to create a brand new row with the new information and duplicate existing information. Then in the UI, I would have to grab the latest version of this. So obviously this is just not good and so wasteful.

Uber created an append-only system, meaning records are only added, not deleted.

What if I made a mistake in a transaction?

Imagine I took a ride for $10, but due to an error, the system charged me $15. Instead of simply deleting and updating the transaction to correct it, Uber’s append-only system would add a new entry, refunding $5 to my account.

You fix things by adding or subtracting to the end, not by replacing

Introducing the Ledger Store for Efficient Data Management

To manage trillions of transactions, Uber developed a Ledger Store — a specialized database designed for transaction management.

Think of it as a giant ledger or record book for all Uber transactions. This ledger not only stores each transaction but also includes extra steps to validate and secure the data.

This means that for transactions that happened last month, you can look at and validate that they are correct, making them now read-only. Uber’s system uses sealing to confirm that each transaction is genuine and unaltered. It also has manifest validation to ensure all transactions are accounted for. This makes Uber’s Ledger Store a super-secure.

They migrated their old transaction records of 250 Billion to this ledger!

Overcoming the Migration Challenge

When Uber switched to its new payment system, it had to move 250 billion records without interrupting ongoing payments.

It's something like moving a huge library collection from one building to another while keeping every book available to readers.

To pull this off, Uber used a checkpoint system, like taking snapshots of the library at each stage to make sure nothing was lost.

Each “checkpoint” ensured that data was transferred safely before moving to the next batch, allowing Uber to migrate data smoothly without causing disruptions. This careful approach ensured that users never experienced any payment issues during the migration.

The Shadow Rider for Smooth Data Comparison

When shifting from old to new systems, Uber created a tool called Shadow Rider. The Shadow Rider sits in between two databases, the current one and the one they wanted to migrate over to.

For example, if the old database shows a user paid $10 for a ride, the new database must also show $10.

If there’s a mismatch, Shadow Rider flags it before it can cause any issues for the user. This ensures data accuracy and consistency across systems during the transition.

Indexing for Massive Scale

Uber manages trillions of transactions, which means it has to shift through an enormous amount of data quickly.

To make this process faster, Uber created TRILLIONS of indexes.

Like If you needed to find a specific page in a book quickly, flipping through every single page would be exhausting and slow. That’s where indexes come in — they act like bookmarks or labels, allowing the system to jump straight to the information it needs.

Conclusion: The Engineering Behind Seamless Transactions

Uber’s engineers have crafted a payment system that’s both powerful and resilient, managing trillions of transactions while keeping them secure and accurate.

By creating tools like the Ledger Store, and Shadow Rider, and using methods like double-entry accounting and immutable databases, Uber ensures that each payment is processed seamlessly.

Handling trillions of transactions isn’t just about scale — it’s about precision, consistency, and security.

THANK YOU!

Follow — Clap — Share Your Thoughts

Uber
Technology
Software Development
Fintech
Data Science
Recommended from ReadMedium