Sponsored by RavenDB
Rakuten Kobo Evaluates RavenDB and Couchbase for its Enterprise Application
Rakuten Kobo Inc. is one of the world's biggest digital booksellers. Owned by Tokyo-based Rakuten and headquartered in Toronto, Rakuten Kobo enables millions of readers worldwide to read anytime, anywhere, on any device.
Users purchase books, store them in accounts, and even highlight parts of pages to remember important points. At any moment, tens of millions of desktops, tablets, and related devices are querying the database to access their private collection.
Millions of books quickly scale out to billions of instances of eBooks with unique owners, and even highlights for each page and lines. As the company expands its books, users, and features, it needs a database that can handle traffic expanding at an exponential pace.
Trevor Hunter, the CTO of Kobo, tested two databases to see which was up to the challenge.
High-availability and reduced latency through data replication
“When selecting a database, one looks at performance and at what it takes to achieve it.”
At the opening bell, RavenDB came out swinging.
It took Couchbase four days to ingest the data. It required 32 cores and 128 GB of RAM for each of three nodes which constituted data shards that held everything. Each Couchbase node required 6 TB of available storage.
RavenDB was good to go within 24 hours, requiring a single node using eight cores on 32 GB of RAM with the default configuration. It expanded to a three-node database cluster with each node holding the 1.35 billion documents along with all the indexes, offering high-availability and reduced latency through data replication.
The Test Environment
Rakuten knows they will be dealing with massive amounts of devices querying their database because they manufacture and sell eReaders to their users.
Along with standard scenarios, tests included how a database would react to the perfect storm bombarding their system.
What happens when a best-seller sends traffic is through the roof?
What happens when connectivity becomes weak and data requests pile up?
What happens when users get new devices and sync with the system to take all of their eBooks, highlights, and account details?
Rakuten Kobo is in the process of building the next generation of their infrastructure. How a database performs under extreme stress gives them insight into how that database will perform under extreme load and performance demands.
To make sure we got the most accurate comparison, both databases were provisioned on the cloud using Amazon EC2 instances, running in the same availability zone inside a single region.
RavenDB allows you to define indexes explicitly or let RavenDB create automatic indexes and maintain such indexes automatically. For this test, the user field on the Highlights collection was indexed explicitly as recommended practice for large production databases.
For Couchbase, two indexes were defined and saved to the system.
Test 1: Sustaining Performance Under Unpredictable Load
To gauge the durability of each system, a load spike lasting three minutes was thrown at each system to see how they sustained background operations, maintenance/cleanup, and garbage collections while continuing to execute data requests.
Under extreme load, how many requests can each database process per second completing the majority of requests under 200ms?
Couchbase failed out of the gate. Once the load spike hit, Couchbase was unable to process requests within 250ms. RavenDB was able to process 15,000 requests per second, finishing a whopping 99.9% of requests within the allotted 200ms. Even under pressure, of those 15,000 req/sec, 85% of them were done in less than 50ms.
Test 2: High-Availability and Scale Out
“We didn’t upgrade the Couchbase version for years because we were fearful of taking a node down. Additionally, if we needed to increase the capacity of the cluster, we had to add a node. And that would also cause a rebalance and outage.” - Trevor Hunter, CTO Rakuten Kobo
Rakuten Kobo wanted to know what would happen if a node did go down? How does each database handle rebooting?
A Cold-Start reboot took Couchbase 13 minutes because it scanned through 450 documents on startup. For indexes, it took even longer. A single index was still in the warmup stage after 30 minutes from the node restarting in one scenario.
RavenDB held a copy of all the data in three nodes. When one went down, the other two maintained full service to users while replicating to the new node. The impact on performance was marginal.
Test 3: ROI on New Architecture
How much provisioning can we trim down and still maintain performance? By winning with less, how much can each database boost Rakuten Kobo’s ROI?
RavenDB and Couchbase Final Score
- Under load, RavenDB outperforms Couchbase, requiring a third of the storage space, saving Rakuten 85% of their cloud storage budget.
- RavenDB outperforms Couchbase by orders of magnitude when using queries under load.
- RavenDB was resistant to failure, enabling Rakuten to scale out and update its systems at will.