What makes CockroachDB Unique !!

Table of contents
Reading Time: 3 minutes

In my blog today, I will be comparing CockroachDB with the existing databases like MySQL, Oracle, Cassandra, HBase and so on..

Let’s have a look at what makes CockroachDB different from other databases.

Referring the following table we can compare different databases against each other depending on their features.

As we can see, most of the features are present in CockroachDB, but the main concern is what these short terms actually means ?

  CockroachDB MySQL PostgreSQL Oracle SQL Server Cassandra HBase MongoDB DynamoDB Spanner
Automated Scaling Yes No No No No Yes Yes Yes Yes Yes
Automated Failover Yes Optional Optional Optional Optional Yes Yes Yes Yes Yes
Automated Repair Yes No No No No Yes Yes Yes Yes Yes
Strongly Consistent Replication Yes No No Optional Optional Optional No No Yes Yes
Consensus-Based Replication Yes No No No No Optional No No Yes Yes
Distributed Transactions Yes No No Yes Yes No No No No* Yes
ACID Semantics Yes Yes Yes Yes Yes No Row-only Document-only Row-only* Yes
Eventually Consistent Reads No Yes Yes Yes Yes Yes Yes Yes Yes Yes
SQL Yes Yes Yes Yes Yes No No No No Read-only
Open Source Yes Yes Yes No No Yes Yes Yes No No
Commercial Version Optional Optional No Yes Yes Optional Optional Optional Yes Yes
Support Full Full Full Full Full Full Full Full Full Full

So let’s begin by discussing each of them briefly : 

    1. Automated Scaling : CockroachDB scales horizontally with minimal operator overhead. You can run it on your local computer, a single server, a corporate development cluster, or a private or public cloud.
      Adding capacity is as easy as pointing a new node at the running cluster.

      As you put data in, the default range eventually reaches a threshold size (64MB by default). After which, the data splits into two ranges, each covering a contiguous segment of the entire key-value space. This process continues indefinitely; as new data flows in, existing ranges continue to split into new ranges, aiming to keep a relatively small and consistent range size.
      It is however generally provided in NoSQL Databases like Cassandra, HBase, MongoDB, DynamoDB etc., but still the other features are not present in every NoSql Database.
    2. Automated Failover : CockroachDB is designed to survive software and hardware failures by using the following approaches :
      1. Replication – is done for data availability, also CockroachDB guarantees consistency between replicas using the ‘Raft consensus algorithm’.
        You can locate replicas on:
        • Different servers within a rack to tolerate server failures.
        • Different servers on different racks within a datacenter to tolerate rack power/network failures.
        • Different servers in different datacenters to tolerate large scale network or power outages.

        See detailed description : Automated Failover/Replication

      2. Automated Repair – is provided to overcome failures like :
        • Short-term failures (such as a server restart) – CockroachDB uses Raft to continue seamlessly as long as a majority of replicas remain available.
        • Longer-term failures (such as a server/rack going down for an extended period of time or a datacenter outage) – New locations in the cluster are identified and the missing replicas are re-replicated in a distributed fashion using all available nodes and the aggregate disk and network bandwidth of the cluster.
    3. Automated Repair : Discussed Above.
    4. Strongly Consistent Replication / Consensus-Based Replication : CockroachDB guarantees the the highest defined SQL isolation level i.e,  “serializable”.
      It achieves –
      • Read consistency using custom time-based synchronization algorithms
      • Write consistency using Raft consensus algorithm
    5. Distributed Transactions : A distributed transaction is a database transaction in which two or more network hosts are involved.
      Usually, hosts provide transactional resources, while the transaction manager is responsible for creating and managing a global transaction that encompasses all operations against such resources.
      Whether it’s a few servers in a single location or many servers across multiple datacenters, you don’t need to know the precise location of data unlike with sharded setups. While all of the NoSQL databases are distributed databases, only CockroachDB supports distributed transactions and provides strong consistency.
    6. ACID Semantics : Every transaction in CockroachDB guarantees ACID semantics (same as for every database except for NoSQL databases) spanning arbitrary tables and rows, even when data is distributed.
    7. Eventually Consistent Reads : Optionally allows reading from replicas that do not have the most recently written data.
    8. SQL : At the lowest level, CockroachDB is a distributed, strongly-consistent, transactional key-value store, but the external API is Standard SQL with extensions.
    9. Open Source : Allow us to contribute to it by :
      • filing bugs
      • suggesting improvements
      • requesting new features, or
      • by opening an issue.

Happy Reading 🙂

References : https://www.cockroachlabs.com/docs/cockroachdb-in-comparison.html


knoldus-advt-sticker


Written by 

Neha is a Senior Software Consultant with an experience of more than 3 years. She is a Big data enthusiast and knows various programming languages including Scala and Java. She is always eager to learn new and advance concepts to expand her horizons and apply them in the project development.

1 thought on “What makes CockroachDB Unique !!4 min read

Comments are closed.