CockroachDB vs AWS Aurora
This article is all about comparing the feature sets of CockroachDB and Amazon Aurora. These are two of the most popular SQL and databases of the cloud era.
We will also dig into the companies history and how they were founded and give an unbiased view of both technologies.
First up let’s take a look at CockroachDB
Introducing CockroachDB
CockroachDB is a commercial distributed SQL database management system developed by Cockroach Labs.
Cockroach Labs were founded in 2015 by ex-Google employees Spencer Kimball, Peter Mattis and Ben Darnell. Cockroach labs founders Kimball and Mattis were key members of the Google file system team while Darnell was a key member of the Google reader team. While at Google all three had previously used Google DBMS Bigtable and its successor Spanner.
After leaving Google they saw a gap in the toolset of traditional and NO SQL databases and decided it was time to create a new database based loosely on Google spanner but available to run on any infrastructure.
The Team wrote the first iteration of the design in January 2014 and began an open-source project on GitHub in February 2014 allowing outside access and contribution.
Development on GitHub attracted substantial contributions which made CockroachDB one of the fastest-growing open-source databases.
The co-founders actively supported the project with networking meetups and fundraising financial rounds.
CockroachDB Overview
- CockroachDB replicates data in multiple locations and has three core principles that allow developers to Scale Fast, Survive Anything and Thrive Everywhere.
- CockroachDB is a cloud-native database with the ability to also run on any self-hosted hardware. It’s a database that is practically impossible to take down. (Hint that’s part of where the name comes from)
- Surviving node, rack, region or continental outages are all easily possible with CockroachDB
The Core Pillars of CockroachDB
The most highly evolved database on the planet was born in cloud architecture to survive. CockroachDB delivers distributed SQL combining the familiarity of relational data with limitless elastic cloud-scale and bulletproof resilience Let’s take a look at those core pillars in more detail
Scale fast
Scale your database by simply adding new nodes and avoid any manual sharding or balancing of data. CockroachDB automatically rebalances and replicates data throughout the cluster making full and effective use of all the available hardware. Gone are the days of active-passive solutions CockroachDB is truly a multi-active database
- Automated scale - Automatic and continuous rebalancing of data between nodes eliminates the pain of manual sharding. All that is required is network connectivity between all the nodes.
- Multi-cloud deployments - Run CockroachDB across multiple cloud platforms, or hybrid across clouds and on-prem data centres. This makes it easy to add new nodes, regions or even continents.
- Scaling writes and reads by simply adding more nodes or more vcpu’s. Giving both the ability to scale Vertically and Horizontally.
Survive Anything
The ability to survive different failure and disaster scenarios makes CockroachDB the most resilient database on the planet
- Multi-active availability - CockroachDB uses a consensus-based algorithm to ensure consistency and availability. as long as the majority of nodes (known as a quorum) are available CockroachDB will survive.
- Architected to withstand any outage, CockroachDB gives your application and services continuous access to data with no downtime. This allows cockroach to achieve an RTO of 0
- If a node, zone or region goes down CockroachDB will route traffic to a healthy node meaning automatic recovery from issues. This allows CockroachDB to have an RTO of around 9 Seconds
- Perform rolling upgrades of the database or Operating system with no downtime via the rolling upgrade feature.
Thrive Everywhere
With the ability to control latency and the familiarity of its SQL dialect makes CockroachDB a powerful Tool
- Ensure Transactional Consistency - In a distributed environment, competing transactions can come from a lot of different application threads. Only CockroachDB provides the highest level of isolation (serializable) in a distributed database. Meaning the accuracy of the data is always guaranteed with CockroachDB.
- Full ACID compliance even for distributed transactions.
- Give your Data Locality - Having the ability to give a locality attribute at the row, table or database level gives CockroachDB the ability to Comply with Data Sovereignty laws and Meet application performance by reducing costly network latencies
- A familiar SQL dialect in Postgres SQL makes it easy for developers to adopt CockroachDB.
- Support for the PGWIRE protocol also makes it easy to work with CockroachDB from an Application perspective.
- Cockroach DB can be consumed as a Fully managed service or can be self hosted in any environment. They even offer a free service for developers to get started
Introducing Amazon Aurora
Amazon Aurora is a relational database service that is developed by Amazon Web services and started in October 2014 as part of Amazon relational database service which is also called RDS.
Aurora offers MySQL compatibility service upon its release in 2014 and they have added PostgreSQL compatibility in October 2017.
Amazon Aurora Overview
Amazon Aurora is a fully managed Database as a Service offering by Amazon which automates time-consuming administration tasks like hardware provisioning, database setup patching and backups.
Amazon Aurora is a rearchitected version of MYSQL/Postgres on top of a new distributed storage system offered by AWS. The fundamental difference between Aurora and CockroachDB is Cockroach DB can scale both reads and writes due to its multi-active nature. Amazon Aurora still only uses a single master for writes which limits its scalability for heavy write workloads. Reads however can be scaled very very easily by adding read replicas.
Benefits of Amazon Aurora
- High performance and scalability for Read Workloads - The performance of Aurora is on par with commercial databases. You can easily scale your database deployment up and down from smaller to larger instance types as your needs change or let Aurora serverless handle scaling automatically for you. To scale read capacity and performance you can add up to 15 low latency read replicas across three availability zones. Amazon Aurora automatically grows storage as needed to add up to 128TB per database instance.
- High availability and durability - Amazon Aurora is designed to offer greater than 99.99% availability replicating 6 copies of your data across three availability zones and backing up your data continuously to Amazon S3. It transparently recovers from physical storage failure; instance failover typically takes around 30 seconds.
- MySQL and PostgreSQL compatible - The Amazon Aurora database engine is fully compatible with existing MySQL and PostgreSQL open source databases and compatibility for new releases regularly. This means you can easily migrate MySQL and PostgreSQL databases to Aurora using standard MySQL and PostgreSQL import/ export tooling. It also means the code applications driver and tools you already used with your existing databases can be used with Amazon Aurora with little or no change.
- Fully managed - Amazon Aurora is fully managed by Amazon relational database service.
- Migration support - MySQL and PostgreSQL compatibility make Amazon Aurora a compelling target for database migration to the cloud. If you are migrating from MySQL there is extensive documentation which guides you through the process
When to Use CockroachDB vs Aurora
CockroachDB should be used when you need scale for both reads and writes when Data Accuracy/Consistency is a must have attribute in your application design. CockroachDB should also be used if you need to run your application outside of AWS.
AWS Aurora should be used when you have a predominately read workload where consistency and accuracy is not as important as servicing the reads quickly. Also if you are an "AWS Shop" and are mandated to use AWS services is where AWS aurora really shines as it integrates with other AWS services easily.
Comparison Chart
Conclusion
Both AWS Aurora and CockroachDB are fantastic database technologies with both a similar and unique feature set. Aurora can only be run in AWS and has limited scalability for write throughput where CockroachDB can be run in any cloud or self-hosted environment and has the ability to scale both read and write workloads linearly. That is the biggest and most fundamental difference. The other major difference is one of Data Accuracy CockroachDB uses serializable isolation levels which guarantees the accuracy of your data. I hope this Blog was informative for you