Ben is the co-founder and Chief Architect of Cockroach Labs where he worked on the distributed consensus protocols that underpin CockroachDB’s transactional model. He started his career at Google and then went on to a series of startups where he saw firsthand the need for better scalable storage systems. When he’s not working he likes to travel the globe in search of food and adventure.
Isolation levels without the anomaly table
Forget the anomaly table. Here's what the different transaction isolation levels mean for the design and implementation of *your* app.
Ben Darnell
January 31, 2024
Engineering
What are the limits of the CAP theorem?
*Note: This blog was originally published in 2017. Everything is still true today. It is being updated to include additional capabilities in CockroachDB. Namely, bounded staleness reads. The CAP theorem is a fundamental part of the theory of distributed systems. It states that in the presence of partitions (i.e. network failures), a system cannot be both consistent and available, and must choose one of the two.
Ben Darnell
May 5, 2022
Engineering
3 basic rules for choosing indexes
3 basic rules for choosing indexes There are a few basic rules to keep in mind when choosing indexes for a database. A good index should have these three properties: Usefulness: Speed up the execution of some queries (or enforce a constraint) Clustering: Keep records that are likely to be accessed together near each other Scattering: Keep records that are unlikely to be accessed together far apart
Ben Darnell
May 3, 2022
System
How to talk about consistency and isolation in distributed DBs
The SQL standard defines four isolation levels (READ UNCOMMITTED, READ COMMITTED, REPEATABLE READ, and SERIALIZABLE). SNAPSHOT is a somewhat popular but non-standard addition to this list. People often reach for these words when they want to talk about behavior in CockroachDB in comparison to other databases, even when the behavior in question is not related to isolation.
Ben Darnell
February 11, 2022
Culture
Babyface: A parental leave project
I recently returned to work following three months of parental leave for the birth of my first child. I spent most of that time doing what you’d expect: staring at the baby for hours, changing hundreds of diapers, and generally alternating between unwarranted confidence and complete uncertainty. But I also found a little time for some other projects, and I’d like to share one of them today. We used an app called Baby Connect to track feedings, diapers, and other vital information about the baby (this is the app that got the coveted phone home screen real estate that was freed when I uninstalled Slack for my leave). I also had a Fitbit Versa 2 smartwatch, saw that it had an SDK, and decided to try building a custom watch face that would show this data.
Ben Darnell
May 8, 2020
testing
Lessons learned from 2+ years of nightly Jepsen tests
Since the pre-1.0 betas of CockroachDB, we've been using Jepsen to test the correctness of the database in the presence of failures. We have re-run these tests every night as a part of our nightly test suite. Last fall, these tests found their first post-release bug. This blog post is a more digestible walkthrough of that discovery (many of the links here point to specific comments in that issue's thread to highlight the most important moments).
Ben Darnell
February 21, 2019
Engineering
Real transactions are serializable
Most databases offer a choice of several transaction isolation levels, offering a tradeoff between correctness and performance. However, that performance comes at a price, as developers must study their transactional interactions carefully or risk introducing subtle bugs. CockroachDB provides strong (“SERIALIZABLE”) isolation by default to ensure that your application always sees the data it expects. In this post I'll explain what this means and how insufficient isolation impacts real-world applications.
Ben Darnell
September 21, 2017
Tutorials
Building an application with CockroachDB and SQLAlchemy
CockroachDB’s support for SQLAlchemy is currently in beta, but we’re actively developing new features to improve the integration. You can find the documentation here. One of the great things about CockroachDB’s support for SQL is the wide variety of frameworks and tools for working with SQL data. Today, we’ll demonstrate this by building a simple application in Python, using SQLAlchemy and Flask.
Ben Darnell
June 1, 2016
System
Scaling Raft
In CockroachDB, we use the Raft consensus algorithm to ensure that your data remains consistent even when machines fail. In most systems that use Raft, such as etcd and Consul, the entire system is one Raft consensus group. In CockroachDB, however, the data is divided into ranges, each with its own consensus group. This means that each node may be participating in hundreds of thousands of consensus groups. This presents some unique challenges, which we have addressed by introducing a layer on top of Raft that we call MultiRaft.
Ben Darnell
June 12, 2015