PayPal recently open-sourced JunoDB, a distributed key-value store that uses RocksDB as the underlying storage engine. A highly available and security-focused database, JunoDB serves daily 350 billion requests at PayPal.
Written in Golang, JunoDB has a proxy-based architecture that enables linear horizontal connection scaling. The database uses consistent hashing to partition data and minimize data movement when clusters are expanded or shrunk. To achieve zero downtime, JunoDB uses within-data center and cross-data center replication. It ensures data consistency with a quorum-based protocol and two-phase commit. Yaping Shi, principal MTS at PayPal, writes:
Virtually every core back-end service at PayPal relies on JunoDB, from login to risk to final transaction processing. With JunoDB, applications can efficiently store and cache data for fast access and load reduction on relational databases and other services.
Source: https://medium.com/paypal-tech/unlocking-the-power-of-junodb-paypals-key-value-store-goes-open-source-ee85f935bdc1
The database has three main components: the JunoDB client library (available in different languages); the JunoDB client proxy, a load balancer connecting with the storage servers and responsible for sharding; and the JunoDB storage, powered by the high-performance embedded database RockDB that provides both in-memory and disk for persistence storage.
In the event of a node malfunction, an automatic and instantaneous failover eliminates the need for leader re-election or data redistribution.
Among the suggested use cases for the new NoSQL solution are caching, storing information like user preferences, account details, and API responses, idempotency, ensuring that an operation is idempotent and removing any duplicate processing, and latency bridging, helping address replication delays due to geographically distributed databases. Shi explains how the project evolved internally:
It started as a single-threaded C++ program but has since been rewritten in Golang to be highly concurrent and multi-core friendly. JunoDB has also evolved from an in-memory short TTL (Time To Live) data store to a persistent data store that supports long TTLs, providing improved data security via on-disk encryption and TLS in transit by default.
Nahim Felicito Gomez, senior software engineer at Mercado Libre, comments:
By rewriting JunoDB in Golang, PayPal takes advantage of the language's concurrency and multi-core capabilities, making it an ideal choice for building the JunoDB client library.
On Hacker News, many users discuss the benefits of the project and key-value stores, comparing JunoDB to other databases like FoundationDB, while user gregwebs questions the lack of data in the announcement:
It would be nice to see some benchmarks or just a mention of any kind of number. TiKV is a CNCF-donated project with roughly the same architecture and has been deployed in larger clusters than 200 nodes.
JunoDB is available as an open-source project on GitHub under an Apache 2 license. To help developers utilize the database effectively, PayPal released server setup and client-building tutorial videos. Clients in Golang and a JunoDB operator for Kubernetes are on the roadmap.