Article complete

Zerodha Migrates Kite's User Preference Storage From SSDB to Open-Source SQLite-Based System

SSDB worked reliably for several years, but it was no longer maintained and could run only on a single machine. Zerodha also had to limit blob sizes to 1 MB because latency deteriorated with larger files.

Zerodha

Key takeaways

  • Zerodha developed Blobasaur, an open-source distributed blob storage system, to manage user data for its trading platform Kite.
  • The new system addresses limitations of SSDB, which was no longer maintained and could only operate on a single machine.
  • Blobasaur supports high volumes of read and write operations with low latency, catering to customisation features for millions of users.
  • Zerodha's transition to Blobasaur was driven by the need for better performance amidst unpredictable and bursty workloads in stock trading.

Takeaways drafted with AI from the article text.

Called Blobasaur, the system is designed to handle tens of thousands of read and write operations per second, with single-digit millisecond latency for data ranging from a few kilobytes to several megabytes.

Zerodha uses Blobasaur to store JSON-based preferences for millions of users. Kite, which has around 20 million customers, allows traders to customise their screens, save multi-chart layouts, create financial indicator templates and drawings, and build workspaces by arranging widgets. The settings behind these features are stored as data blobs by the platform’s backend services.

The project was developed after the company ran into limitations with its existing storage systems. Zerodha initially used CouchDB before moving to SSDB, a disk-backed database that supported the Redis protocol.

SSDB worked reliably for several years, but it was no longer maintained and could run only on a single machine. As payloads grew, the company also had to limit blob sizes to 1 MB because latency deteriorated with larger files.

The workload also made performance difficult to predict. “These are unpredictable and bursty thanks to the volatility in stock markets,” Sarat Chandra, a software engineer at Zerodha, wrote in a blog post, describing the requests generated by users and internal services.

Explaining one reason for the choice, Chandra wrote, “SQLite is up to 35% faster than raw filesystem I/O.”

Blobasaur is written in Rust and uses SQLite to store the data. It also supports the Redis protocol, allowing Zerodha’s existing services to connect through familiar client libraries rather than requiring a wholesale rewrite. The software is packaged as a single application and has replaced SSDB in Zerodha’s production environment.

In a benchmark, a 16-shard configuration handled 29,538 combined read and write operations per second, more than twice the throughput recorded with a single shard. The test ran on a 16-core laptop, with the server and load generator sharing the machine. In production, Zerodha runs Blobasaur across three nodes, each with four virtual CPUs and 8 GB of memory.

The company reports that 99th-percentile latency stays around 2 milliseconds across commands during a full trading session.

The migration was carried out in stages, with new workloads moved first and existing services shifted after a period of parallel operation. “After running dual-writes for a month with zero discrepancies, we turned off SSDB,” Chandra wrote.

Blobasaur is released under the AGPLv3 open-source licence and is available on GitHub. Zerodha said some scaling features, including automatic failover and live redistribution of data between nodes, have not yet been implemented.

Published

Spotted an error? Tell our editors. Read our editorial standards and corrections.

More in this story

Cloud Computing · 5 stories
  1. Techno Digital Opens Mumbai Edge Data Centre in Partnership with RailTel
  2. Oracle to Raise $40 Bn to Fund AI Datacenter Ambitions
  3. IBM Opens FutureNow Centre in Visakhapatnam to Boost AI & Digital Transformation Delivery
  4. E2E Networks Launches Blaze To Offer Pay-Per-Token AI Inference Services
  5. You are here: Zerodha Migrates Kite's User Preference Storage From SSDB to Open-Source SQLite-Based System
About the author

Senior Journalist

All stories
Belamy · Daily

The day’s AI news, before your first meeting.