An Intro to Cockroach DB

Salem Alqahtani
2 min readOct 22, 2022

--

Cockroach DB was developed in 2015 by Ben Darnell and other two engineers. The Cockroach is named after a resilient species. The purpose of cockroach DB is to create an open-source version of Google Spanner, a distributed SQL DB.

As you may know, traditional SQL fails to maintain scalability and availability. To overcome these shortcomings, NoSQL was introduced but was traded off the consistency property.

Distributed databases like cockroach DB focus on OLTP workload. Cockroach DB guarantees scalability, consistency, resiliency, and SQL with transaction ACID properties.

Cockroach DB uses serializable isolation which behaves as if the transaction exclusively uses the entire cluster. Cockroach DB speaks SQL because it is used a PostgreSQL wire protocol.

A Geo-Replication feature controls where data is stored globally. Cockroach DB has a multi-cloud feature where you are not entitled to a single cloud provider.

On the cluster level, the ordering of data in Cockroach DB is based on the keyspace data structure. It is an order set of key-value pairs. The keyspace is divided into ranges where the range is the unit of replication. Cockroach DB uses Raft to maintain the replication of all writes. It is used as a leaseholder on the server to serve all read and write commits.

Database Terms:

The next blog is an intro for the SQL layer.

--

--

Salem Alqahtani
Salem Alqahtani

Written by Salem Alqahtani

I am interested in Distributed Systems!

No responses yet