What is CockroachDB?

Introduction

If you’re looking for a database with massive scalability, but you’d prefer to stick with SQL, CockroachDB may be the logical solution. CockroachDB has been gaining traction as an open-source, cloud-native SQL database with serious scalability. If you’ve heard this product’s name and were wondering “What is CockroachDB”, we’ve got the answers for you. In this article, we’ll take a closer look at CockroachDB, its history and its features.

What is CockroachDB?

CockroachDB is an open-source, distributed SQL database developed by a team of former Google engineers at Cockroach Labs. The product is designed to run in the cloud, and it’s known for its resilience and scalability. While you can run it on a single laptop, you can also scale it to hundreds or thousands of servers as the needs of your organization grow. Some aspects of CockroachDB were inspired by Spanner– Google’s globally-distributed database offering.

Recently, Object Rocket started offering manage database hosting for Cockroachdb. This offering is fully managed and fully hosted, which helps organizations get its applications up and running faster.

Scalability

When it comes to scalability, database customers are often faced with a tough choice. Relational databases such as MySQL offer strong consistency, but they don’t really scale horizontally. NoSQL databases, on the other hand, scale horizontally like a dream, but users need to deal with the issue of eventual consistency. Eventual consistency refers to the condition where, after updates, you may or may not see the changes that were just made if you immediately read the data.

CockroachDB offers users a best-of-both-worlds solution: a SQL database that can scale horizontally. If you need to support higher volumes, you can simply add more machines. With CockroachDB, the servers automatically replicate and rebalance themselves, which keeps your system available as it grows and evolves.

Surviving failures

The cockroach is notorious for being nearly impossible to kill. That ability to survive inspired the name for CockroachDB, which was designed to survive both hardware and software failures. Its resiliency is due in large part to its use of replication and automatic repair. Let’s talk about how both these processes work:

  • Replication: CockroachDB makes sure your data is available at all times by replicating it, and it guarantees that data remains consistent among these replicas by making use of the Raft consensus algorithm. You can design your replica locations in a variety of ways, depending on your network’s arrangement and the type of failures you’re safeguarding against. For example, you can locate your replicas on different servers within the same rack to survive server failures, or you can locate them on different servers that are also on different racks if you’re looking to tolerate network or power failures.

  • Automatic repair: CockroachDB uses the Raft consensus algorithm to keep things running smoothly among a group of replicas, in the event of a short-term failure. Once a failed replica is back online, it quickly rejoins the group. Longer-term failures and outages are also handled seamlessly, with CockroachDB automatically rebalancing the working replicas to deal with any missing nodes.

Compatibility

CockroachDB was designed to be highly compatible with PostgreSQL. This is an important point, and not just because it means that users don’t have to learn as many new things just to work with CockroachDB. This means that some applications written to work with PostgreSQL may be able to work with CockroachDB with no changes necessary. It also means that you can use a wide variety of existing PostgreSQL client drivers to talk to CockroachDB. It’s been tested from a number of languages, including:

  • Python
  • Ruby
  • Java
  • Go
  • PHP
  • Node.js
  • C and C++
  • Rust
  • Clojure

When to choose CockroachDB

While there’s no doubt that CockroachDB is a smart choice for a wide variety of applications, there are certain use cases that the product is especially well-suited for, such as:

  • Multi-datacenter deployments
  • Cloud migrations
  • Replicated or distributed online transaction processing

When you need response times in the milliseconds regardless of scale, combined with available, reliable data, CockroachDB is a viable solution. However, the product isn’t the best choice for heavy analytics.

Summary

CockroachDB has a name you’re not likely to forget, but that’s hardly the only thing that makes this product notable. It’s clear that CockroachDB is an attractive solution for organizations that prefer the consistency of a SQL database but want the massive scalability typically relegated to NoSQL database systems. Ultimately, you’ll need to examine your organization’s needs and requirements to determine if CockroachDB is the right solution for you.

Pilot the ObjectRocket platform free for 30 Days

It's easy to get started. Imagine the time you'll save by not worrying about database management. Let's do this!

PILOT FREE FOR 30 DAYS

Keep in the know!

Subscribe to our emails and we’ll let you know what’s going on at ObjectRocket. We hate spam and make it easy to unsubscribe.