Skip to content
System Design Explorer
Company architectureadvanced

PayPal System Design

PayPal-scale payments infrastructure: a key-value store and Kafka

By Ankur NayakReviewed

The platforms under a consumer payments network: JunoDB, PayPal's open-source key-value store with a proxy tier and zone-replicated storage, and a Kafka fleet that carried over a trillion messages a day at its 2022 holiday peak, feeding real-time fraud decisions.

Open in Studio· edit a copy
Users
440M active accounts (Q3 2026)
Total payment volume
$487.1B
Payment transactions
6.8B
Kafka peak
1.3T msgs/day
Kafka fleet
85+ clusters, 1,500+ brokers
PayPal system design architecture diagramComponents: PayPal Checkout, Merchant Site, API & Checkout Edge, Payment Services, Risk Platform, JunoDB (Go, RocksDB), Kafka, Analytics & ML Pipelines, Banks & Card Networks. Connections: PayPal Checkout to API & Checkout Edge (pay); Merchant Site to API & Checkout Edge; API & Checkout Edge to Payment Services; Payment Services to Risk Platform (risk decision); Payment Services to JunoDB (key-value reads/writes); Payment Services to Banks & Card Networks; Payment Services to Kafka (events); Kafka to Analytics & ML Pipelines; Kafka to Risk Platform (real-time events).PayPal CheckoutClientMerchant SiteClientAPI & Checkout EdgeAPI gatewayPayment ServicesServiceRisk PlatformML modelJunoDBGo, RocksDBKafkaStreamAnalytics & ML PipelinesData warehouseBanks & Card NetworksExternal API

Requirements

Functional

  • Let customers pay merchants and each other from a PayPal account
  • Decide in real time whether each payment is risky
  • Give core services a fast, reliable key-value store
  • Move events between services and into analytics

Non-functional

  • Low, single-digit-millisecond key-value latency at any scale
  • Survive the loss of a zone or data centre
  • Handle holiday peaks of over a trillion events a day
  • Secure access: every Kafka client authenticated and authorised

In depth

What PayPal has made public

PayPal handled $487.1 billion in payments in the third quarter of 2026 across 440 million active accounts. Its engineering teams have written openly about the shared platforms underneath (a key-value store, a Kafka fleet, a real-time risk data service) but not about the internals of checkout itself. So this design draws those platforms in detail and keeps the checkout path at the level of "this must exist", marked as inferred. That split is itself a useful lesson: in a large payments company, much of the engineering lives in platforms that every product team builds on.

JunoDB: a key-value store with a proxy tier

JunoDB is PayPal's distributed key-value store, published as open source and described in its repository as secure, consistent and highly available, with low single-digit-millisecond latency at any scale.

Its architecture has three parts:

  • Client libraries in Java, Go and C++ that stay deliberately thin
  • Proxies behind a load balancer, which receive every request and forward it to the right storage servers
  • Storage servers that keep data in memory or in RocksDB

The proxies find the right servers using a shard map held in etcd, and keys are partitioned with consistent hashing, which keeps data movement small when the cluster grows. Each piece of data is replicated across a group of storage nodes, each in a different logical zone, so losing a zone doesn't lose data.

Why a proxy tier? It lets the number of client connections grow without every storage server holding a connection from every client, and it keeps shard moves invisible to applications. The cost is an extra network hop on every request.

Kafka at a trillion messages a day

PayPal adopted Kafka in 2015 with a handful of isolated clusters. By 2023 it ran a shared platform of more than 85 clusters, over 1,500 brokers and 20,000+ topics, peaking at 1.3 trillion messages a day and 21 million messages a second on Retail Friday 2022.

Running it as a shared platform is what made that scale manageable:

  • A stateless Kafka Config Service hands clients their settings and bootstrap servers at startup, so no application hard-codes broker addresses.
  • Access is only through an authenticated port, and every application declares whether it produces or consumes.
  • MirrorMaker copies topics to clusters in other data centres for disaster recovery and to move data between security zones.
  • Patching is automated: a check confirms there are no under-replicated partitions, then one broker at a time is patched. With a replication factor of three, nothing is lost.
  • After a failure, only the partitions that are actually under-replicated are reassigned. Earlier, re-partitioning could leave a cluster unavailable for days.

See message queues and event logs.

Real-time risk

Every payment needs a fraud decision before it completes. A 2018 talk by PayPal's lead data architect describes the data service behind those decisions: it combines big-data processing with real-time access to data, handles billions of events a day and keeps dozens of petabytes. In this diagram the risk platform consumes event streams and reads features from fast storage; the exact wiring isn't public and is marked inferred.

When things fail

Because PayPal's public writing is about platforms, its failure stories are about platforms too, and they show a consistent attitude: assume components fail, and make the recovery path routine.

  • A Kafka data centre is lost. MirrorMaker has already copied topics to clusters in other data centres, so consumers can switch to the mirrored cluster. Cluster definitions live in configuration management, which PayPal says lets it rebuild a cluster in a couple of hours. Payments themselves don't wait on Kafka, so the impact is delayed events and analytics rather than failed checkouts.
  • A broker needs patching. An automated check first confirms there are no under-replicated partitions; then exactly one broker is patched at a time. Every topic has three replicas, so the remaining two keep serving.
  • A JunoDB zone goes down. Each piece of data is replicated across storage nodes in distinct logical zones, so the proxies can still reach copies of every shard in the zones that remain, and route around the failed servers.

The trade-offs

  • A proxy tier in front of storage. Client connection counts can grow without burdening the storage servers, client libraries stay thin in Java, Go and C++, and shard moves are invisible to applications. The price is an extra network hop on every request, and a proxy fleet to run. The alternative is "smart" clients that hash keys straight to storage servers, which removes the hop but couples every client to the cluster's layout.
  • One shared Kafka platform. Central configuration, authenticated access and shared client libraries give consistent security and operations, and product teams don't each run their own clusters. In exchange, a platform team has to manage more than 85 clusters and 1,500 brokers.
  • Automated, conservative operations. Patching one broker at a time and reassigning only under-replicated partitions makes maintenance safe and recovery fast, at the cost of slow rolling changes across a very large fleet.

What's not public

How a PayPal checkout request flows through PayPal's own services, which systems use JunoDB for what, and how PayPal connects to banks and card networks aren't described in the sources used here. Those parts of the diagram are shown with dashed, inferred styling.

What to take into an interview

  • A proxy tier decouples clients from storage topology at the cost of a hop
  • Replicate across failure zones, and route around failed nodes in the proxy
  • Treat streaming as a shared platform: central config, authenticated access, automation
  • Mirror event streams across data centres for disaster recovery
  • Keep fraud decisions real-time, fed by the same event streams as analytics

Components

PayPal Checkout

Client. Customers pay from the PayPal app or the checkout button on a merchant's site.

Merchant Site

Client. Integrates PayPal checkout.

API & Checkout Edge

inferred

API gateway. Receives checkout and API traffic. PayPal's engineering posts don't describe this layer.

Payment Services

inferred

Service. Checkout, wallet and transaction processing. Their internal design isn't covered in the sources used here.

Risk Platform

ML model. Real-time fraud decisions fed by a data service that combines big-data processing with real-time access; it handles billions of events a day and dozens of petabytes.

JunoDB

Go, RocksDB

NoSQL database. PayPal's open-source key-value store: client libraries talk to a proxy tier, which routes each key to storage servers using a shard map in etcd; data is replicated across nodes in different logical zones.

Why: A proxy tier lets the number of client connections grow without every storage server seeing every client, and keeps client libraries thin.

Building block: Consistent Hashing, Replication

Client Library

Java, Go, C++

Client. Thin clients that speak JunoDB's protocol to the proxies.

Load Balancer

Load balancer. Spreads client connections across proxies.

Proxy

Service. Forwards each request to the storage servers that own the key's shard.

Shard Map

etcd

Coordination. Holds the mapping from shards to storage servers.

Storage Servers

Memory or RocksDB

NoSQL database. Store the data for their shards.

Replicas in Other Zones

NoSQL database. Each piece of data is replicated across a group of storage nodes in distinct logical zones.

Kafka

Stream. Multi-tenant Kafka fleet carrying service events, tracking, logs and data pipelines. Clients connect only on an authenticated port and must declare whether they produce or consume.

Why: One shared, well-run streaming platform instead of a handful of isolated clusters per team.

Building block: Message Queue & Event Log

Kafka Config Service

Service. Stateless service that hands clients their configuration and bootstrap servers at startup, so nobody hard-codes broker addresses.

Mirrored Kafka

MirrorMaker

Stream. Topics mirrored to clusters in other data centres for disaster recovery and to move data between security zones.

Analytics & ML Pipelines

inferred

Data warehouse. Downstream consumers of the event streams, including the data used to train risk models.

Banks & Card Networks

inferred

External API. Fund payments from cards and bank accounts.

Request flows

Pay with PayPal

  1. The customer approves a payment in PayPal checkout.
  2. The request reaches the payment services (internal design not public).
  3. Services read and write fast key-value state in JunoDB.
  4. The risk platform decides in real time whether the payment looks fraudulent.
  5. The payment is funded from the customer's balance, bank or card.
  6. Events about the payment are published to Kafka.
  7. The customer sees the payment complete.

An event's path through Kafka

  1. At startup the producer asks the Kafka Config Service for its settings and bootstrap servers.
  2. It publishes on the authenticated port, as an application allowed to produce to that topic.
  3. MirrorMaker copies the topic to a cluster in another data centre for disaster recovery.
  4. Consumers such as the risk data service read the stream in real time.
  5. Analytics and model-training pipelines consume the same events.

Failure scenarios

What if: a Kafka data centre is lost?

MirrorMaker keeps copies of topics in clusters in other data centres for disaster recovery, so consumers can switch to the mirrored cluster. PayPal also keeps cluster definitions in configuration management, which it says lets it rebuild a cluster in a couple of hours.

User impact: Delayed events and analytics; payments themselves don't wait on Kafka.

  • MirrorMaker across data centres
  • Config-managed clusters that can be rebuilt quickly
  • Replication factor three within a cluster

What if: a Kafka broker goes down for patching?

Before a host is patched, an automated check confirms there are no under-replicated partitions, and only one broker is patched at a time. With every topic replicated three times, the remaining replicas keep serving with no data loss.

User impact: None.

  • Under-replication check before patching
  • One broker at a time
  • Reassign only under-replicated partitions after a failure

What if: a JunoDB zone fails?

Each piece of data is replicated across storage nodes in distinct logical zones, so the proxies can still reach copies of every shard in the zones that remain.

User impact: Little or none.

  • Replication across logical zones
  • Proxies route around failed storage servers

Trade-offs

A proxy tier in front of storage

Clients talk to JunoDB proxies, which route to storage servers.

Pros
  • Connection counts scale without burdening storage servers
  • Thin client libraries in several languages
  • Shard moves are invisible to clients
Cons
  • An extra network hop on every request
  • A proxy fleet to run

Alternatives: Smart clients that hash keys directly to storage servers

One shared Kafka platform

Run a multi-tenant Kafka fleet with central configuration, ACLs and shared client libraries.

Pros
  • Consistent security and operations
  • Teams don't run their own clusters
Cons
  • A platform team must manage 85+ clusters and 1,500+ brokers

Automated, conservative cluster operations

Patch one broker at a time after checking for under-replicated partitions, and reassign only the partitions a failure affected.

Pros
  • Routine maintenance without data loss
  • Recovery in hours instead of days of re-partitioning
Cons
  • Rolling patches across 1,500+ brokers take a long time
  • Automation must itself be trusted and tested

Frequently asked questions

What is JunoDB?

PayPal's distributed key-value store, published as open source on GitHub. Clients connect through a tier of proxies that route each key to storage servers using a shard map held in etcd; data is partitioned with consistent hashing and replicated across nodes in different logical zones, stored in memory or RocksDB.

How much data does PayPal move through Kafka?

PayPal reported a peak of 1.3 trillion messages a day, and 21 million messages a second, on Retail Friday 2022, across more than 85 clusters with over 1,500 brokers.

Has PayPal published how its checkout works internally?

Not in the engineering sources used here. Its public writing focuses on shared platforms such as JunoDB, Kafka and the risk data service, so the checkout path in this diagram is marked as inferred.

Building blocks used

Sources