Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Cockroach DB Reaches 1.0

Cockroach DB Reaches 1.0

This item in japanese

Cockroach DB, the distributed SQL database that follows the pattern of software products being named after animals, announced earlier this month the release of its first production ready version, 1.0.

Cockroach DB is regarded by many as the open source equivalent to Google Spanner, the strongly consistent, horizontally scalable RDBMS that after being an internal project serving Google services, has recently made its way to the Google Cloud. In the same league as NuoDB, these databases are trying to fix the same issues that NoSQL databases have tried to resolve in the past decade from a different standpoint. High availability, linear scalability, strong consistency, ongoing replication all together with fast response times and exponentially growing datasets are all issues that database vendors are trying to resolve for many decades.

One approach taken by NoSQL vendors is to relax some of the constraints imposed by relational databases either in consistency, availability or partition tolerance, as described by CAP theorem. SQL support is most of the times limited if practically existent.

The approach by the sometimes called "NewSQL" databases on the other side is to design from the ground up a database system that is fully SQL compliant and still tries to meet all of the above requirements.
One of the biggest challenges when building a distributed database is the ordering of events. Ordering operations within a transaction guarantees that readers and writers will have a consistent view of the data.
Google Spanner is using GPS and atomic clocks to achieve synchronisation in the order of few milliseconds between different nodes in a concept called TrueTime in their published paper. Cockroach’s approach in global ordering is to employ Hybrid Logical Clocks as described in their blog post. Both approaches are claiming to be denying CAP theorem’s axiom that we can’t have all three Consistency, highly Availability and Partition tolerance in a distributed system, with a slightly different implementation.

Cockroach’s first production ready version is also offering zero downtime (live) schema changes, secondary indexes and foreign key support. High Availability is provided with an emphasis on consistency using three or more active replicas of each dataset, all of which can get reads/writes at the same time. Apart from increasing high availability, this "multi active availability" model can be helpful in cases where geographically dispersed clients can connect to the closest server for writes and make sure that every client’s state is consistent across the globe. One of Cockroach’s customer as a major gaming company is actively using this feature in production. Cockroach’s major customers also include Baidu which is actively using it for more than 23000 writes per second.

One of the strong selling points for Cockroach DB is that it doesn’t require rewriting MVC code or using some intermediate layer to translate ORM and database queries as it has connectors along with sample code examples for many popular frameworks like Ruby on Rails, Hibernate, Python and Node’s sequelize. There is a detailed architecture diagram on GitHub and commercial support for enterprise customers. Complex SQL JOINs are still not optimal and many users are having mixed feelings about the name, none of which stopped Cockroach from raising 27 million USD earlier this month in a Series B round led by Redpoint Ventures..

Rate this Article