CockroachDB Videos
← Back to all videos

Comparing CockroachDB & Google Cloud Spanner | Best of Distributed SQL

2022-01-25

CockroachDB in Comparison

Description

In this video "Comparing CockroachDB & Google Cloud Spanner" we cover the origins of both databases, some of their shared architectural principles, and then we get into the four main differences between Spanner and CockroachDB. 00:00 Introduction 00:21 What is Google Cloud Spanner? 1:10 Google Cloud Spanner & CockroachDB Architecture 1:40 Who started CockroachDB? 2:26 4 Differences between CockroachDB & Google Cloud Spanner 2:31 Google Cloud Spanner is tied to GCP instances 3:01 Data Location Control in CockroachDB vs Spanner 3:33 Using Kubernetes with Spanner 4:04 SQL Coverage in Spanner 4:30 How to get started with CockroachDB for free The Origin of Google Cloud Spanner Google Cloud Spanner is the pioneer database of the distributed SQL movement and the best way to familiarize yourself with Spanner’s origin is to go and read the Google Cloud Spanner whitepaper. In that paper Google describes Spanner as a “Google’s scalable, multi-version, globally-distributed, and synchronously-replicated database.” It distributes data at global scale and supports externally consistent, distributed transactions. Basically, out of necessity, they built on their experience with Bigtable and made it relational. Which was an amazing moment for business critical workloads that needed to be modernized. CockroachDB & Spanner Architectural Differences I would be remiss to begin without mentioning that CockroachDB’s three founders (Spencer Kimball, Peter Mattis and Ben Darnell) were all in the employee #300 range at Google. Peter and Spencer helped build Colossus, which is Google’s backend file system and Ben helped design and build Reader. They grew accustomed to working with all the internal tools at Google, including Spanner. And when they left, and moved on to new projects, they missed those tools. Particularly Spanner. While the architecture of CockroachDB is inspired by Spanner, there are a few key differences that I’d like to call out. Let’s get into them: 1. Multi-Cloud & Intra Cloud Deployment Google Spanner is tied to select GCP instances, so you can't really run it outside of GCP. By contrast, you can run CockroachDB across multiple different cloud providers on any cloud provider, or really anywhere. CockroachDB is not tied to any explicit hardware, whereas Spanner is tied to hardware that includes atomic clocks. 2. Multi-Region Simplicity & Control “Multi-region”, in this context, is the concept of putting data in different locations to survive the failure of an entire region or to keep data close to users for performance reasons. In CockroachDB the location of data is defined at the row level of each table. This degree of granular control over the location of data is powerful for latency and survival reasons. Plus, the granularity and simplicity of data location controls in CockroachDB is quite different than what you’ll find in Spanner. 3. Kubernetes Freedom & Availability for Anthos Because Spanner is tied to explicit hardware, it’s challenging to deploy it ad hoc in any Kubernetes cluster. Whereas CockroachDB was really built as a distributed system and really works beautifully in these distributed environments like Kubernetes and unlike Spanner, you can use it in a multi-cloud K8s environment like Anthos or Red Hat OpenShift. If you're going to be running Kubernetes, you’ll find that every version of CockroachDB is a great fit to run directly on it. 4. SQL Coverage & Data Types Spanner has done some really great work over the past couple months to become compatible with PostgreSQL. But there are areas like spatial data and other data types and syntax that are still not covered in Google Spanner. Which may not be a dealbreaker for you as it really comes down to your workload and what you want to accomplish. CockroachDB’s documentation is a great place to see the full extent of their SQL coverage. Getting Started with CockroachDB for free Both CockroachDB and #Spanner are great databases. Those are just four areas where the two databases are distinct from one another, hopefully those points help you choose the right tool for the job. If you’re interested in taking CockroachDB for a spin you can quickly get started with CockroachDB Serverless. That’s a free serverless database offering in which you get 5GB and 250 million request units without ever sharing your credit card. You could download the open source version of the database and just spin up a node on your laptop. Or you can take a look at CockroachDB Dedicated - the fully managed version of CockroachDB. #CockroachDB Serverless: https://www.cockroachlabs.com/serverless/ Download Open Source CockroachDB: https://www.cockroachlabs.com/docs/stable/secure-a-cluster.html Spanner White Paper: https://research.google/pubs/pub39966/ Distributed SQL Movement: https://www.cockroachlabs.com/blog/what-is-distributed-sql/