CockroachDB-More than just an invincible database! - OpenXcell
Contact us

CockroachDB-More than just an invincible database!

AgnetSmithCDB

 

App startups are nothing but precious databanks that churn and use data in a desirable manner. Data is extremely important. It needs to be safely stored and speedily retrieved whenever needed.

A lot of database architecture promise to combine both factors and provide you with a perfect solution. However, none of these can save you in an event of a catastrophe. A data center outage or permanent damage cannot be completely ruled out. Also, scaling up your infrastructure is a tough battle against latency. This is where Cockroach DB makes itself relevant.

The invincibility of Cockroach has been talked about a lot. But understand, that its virtue of being hard to kill is not the single factor contributing to its importance. Cockroach is useful because it brings goodness from all the eras of DB techs and compiles in a single package. 

Earlier Database architectures would fundamentally be composed of SQL RDBMS that allowed transactions but exhibited poor horizontal scalability as well. The recent type of architecture depends heavily upon NoSQL that supports horizontal scalability but does not support ACID transactions.

Cockroach is a blend of these three

Cockroach is a blend of these three

 

This is where Cockroach combines the best of both worlds. It can support horizontal scalability along with ACID transactions. ACID is what gives consistency to the database apart from its ability to horizontally scale up. Coupled with its formidability, the team gives you three basic reasons to choose cockroachDB.

You may be stumbling upon a lot about Cockroach DB’s invincibility but it is the mix of these three that makes it desirable. Coupling ACID and horizontal scaling are the fundamental strength of Cockroach! Invincibility comes later.

A typical distributed transaction in a transnational database. Look that when the sales node is updated, other nodes are updated too.

A typical distributed transaction in a transactional database.  When the sales node is updated, other nodes are updated too.

Why do you need horizontal Scaling ?

There are two ways you can scale up your infrastructure. Horizontal or Vertical. In horizontal scaling, you add more machines to your resources. In other words, HS will have your disk space divided into a specified number of nodes. The data can be distributed across these nodes and this is why you can dynamically scale the DB by adding more machines.

Horizontal Scaling in Cockroach DB. Data is distributed across nodes. These can be distributed across various physical locations. This leads to low latency or fast data speeds.

Horizontal Scaling in Cockroach DB. Data is distributed across nodes which can be distributed across various physical locations. This leads to low latency or fast data speeds.

 

This is good for data-intensive startups that require access to arbitrary sets of data at any point of time, irrespective of the geolocation of user(s).

Now the same thing can be done using vertical scaling too. However, it is more expensive. Upgrading an 8 processor box with 32 GB of RAM to 64 processor box with 128GB of RAM may require you to buy a new server altogether. A server supporting that many processors will be expensive.

Also, despite a muscular Vertical Scaling configuration, some level of physical data distribution cannot be avoided for modern day startups. Cockroach DB provides what is needed here. It allows you to scale horizontally while making no compromises with speed and this is what Startups need.

ACID is actually pretty basic-

 

ACID Transactions and their definition. Source-Wikipedia

ACID Transactions and their definition. Source-Wikipedia

 

Horizontal Scaling is not the only factor that gives Cockroach an edge. It is the ability to make transactions that make it special. The founders at Cockroach believe, that apps should be able to make transactions. As far as our enterprise app development experience stands we also think this to be true. ACID transactions are of paramount importance to numerous app business models these days.

Something such as Uber, that has got so many ends to serve data and co-dependent commands within the app, probably requires ACID to a great extent. ACID can also be important for apps that perform some form of financial transactions such as banking or e-commerce apps. It is also obvious that, if a startup expands, the need for ACID transaction may eventually become a necessity after a while.

Last but not the least, It is hard to Kill-

Cockroach DB is an open source SQL database which follows a distributed SQL architecture. The architecture looks something like this.

 

Cockroach DB architecture

Cockroach DB architecture

 

The SQL layer provides the highest layer of abstraction. This is dependent on an API that is in-turn based on a monolithic key value store. The monolithic map is crucial as it the level where the data is distributed across the nodes. Each node may have one or more store. These stores are then broken down into smaller key ranges using RAFT. These keyvalues are nothing but identical data copied into different geo-locations.

Key-value Ranges. These are the most basic unit of data. Note that each store may have replicas of key-values. These may be distributed across a geographical regions.

Key-value Ranges. These are the most basic unit of data. Note that each store may have replicas of key-values. These may be distributed across a geographical regions.

In case of any outage or massive failure, these keyvalues can be retrieved from any one of the nodes and multiple copies can be made. Eventually, you would be able to restore your entire DB from these keyvalues.

It is not uncommon to see startup databases being hacked at their growth stage or frequent component failures in servers. CockroachDB can prevent that and absorb all worries of a catastrophic database failure.

A Database is one of the most important components within the entire architecture. Market forces are forcing them to change, wanting them to accomplish a lot upon low latency, consistency, and dependability. Cockroach stands right in the middle of that. Besides being fast and cost effective, Cockroach manages to become a resilient Database that will never go down.

Arup Dey

Arup Dey

I am passionate about Games, Content Marketing, NLE apps and Videos. In my free time I Read, Eat and Code. I see life around me as interconnected subsets of small events. Helps me learn a lot!