One to Many: The Story of Sharding at Box

Average: 9.3 (3 votes)

When web applications take off and gain traction, the database infrastructure is often one of the most difficult components to scale horizontally. In this talk we present a step-by-step description of our transition from one monolithic MySQL database to a fully sharded MySQL architecture. This transition was made over the course of several months, all the while continuously serving over 1.7B queries per day. We emphasize the incremental steps and best practices, which enabled us to successfully make this fundamental change, and touch on the mistakes and difficulties we encountered along the way. We also describe our utilization of open source technologies, such as MySQL, and Tungsten Replicator, and present techniques that are relevant to both web application architects and DBAs who are trying to make the initial transition to a sharded solution.

We begin with an overview of our database architecture both before and after the sharding project. We then walk through the modifications we made to our ORM layer to support this new architecture, including support for cross-shard queries and online moving of data between shards. We continue with a detailed description of the technique we developed for migrating live data to shards without downtime, which also supports table by table migration for added flexibility. We then describe how we used similar migration techniques to move and split shards for rebalancing purposes. Throughout the talk we demonstrate how to make changes such as these in an incremental fashion, without adversely affecting functionality, and most importantly without downtime.

Trends in Architecture and Design
Experience level: 

Schedule info

Time slot: 
11 April 13:00 - 13:50
Ballroom G

Schedule Info

11 April 13:00 - 13:50 @
Ballroom G


Tamar Bercovici's picture
Senior Software Engineer, Box

Tamar Bercovici is a Senior Software Engineer at Box where she specializes in scaling Box's database architecture and ORM layer. Prior to Box, Tamar was an early-stage employee at XMPie (now a Xerox company), where she drove the development of the award winning uImage product. Tamar holds a Ph.D. in Computer Science from the Technion - Israel Institute of Technology.

Florian Jourda's picture
Principal Architect, Box

Florian Jourda is a software architect at Box focusing on all aspects of the object oriented frameworks. He supervises both the web app side (ORM, MVC, ACL) and the infrastructure side (MySQL sharding, memcached strategy). He studied engineering at both Ecole Polytechnique and UC Berkeley.


Sponsored By