Blogginlägg -

Cockroach DB - the surviving database

Websteps last “competence evening” before the summer vacations gathered 14 consultants, that despite the beautiful weather had decided to stay inside for some quality time together learning about CockroachDB. Kai Niemi had agreed to share his knowledge on the topic.

Kai started with a summary of the evolution of databases and the reasons behind the rise of the so-called NoSQL databases in the second half of the 90’s. That rise was as you might suspect caused by the growing popularity of internet and the increasing demand for accessible information. The traditional databases weren’t able to keep up so new and more flexible ones were developed. I always appreciate some (historical) context, so this introduction was perfect.

It soon became clear that Kai is very passionate and knowledgeable about databases in general and CockroachDB in particular. I for once did not expect such a well-prepared talk. Kai had loads of material and knew what parts to focus on to tailor the talk to the audience. He kept us interested and focused for over two hours, which I think is quite impressive.

What did I learn?

A lot, but if I must list three things it would be that CockroachDB is:

  • A highly scalable and distributed SQL database
  • Extremely resilient, can even handle outages of entire data centers
  • Very easy to get started with

Architecture

CockroachDB is designed to be both scalable and consistent. Is that possible you may ask yourself, start by reading this to make up your mind:

https://www.cockroachlabs.com/docs/stable/architecture/overview.html

If you are not up for reading that or any of the many blog post about CockroachDB you could just have a look at the diagram below to get an idea of the concept.

One key component that is not mentioned in this picture is RAFT, the consensus protocol that enables the consistency between the nodes. Follow the link to read more about it.

Try it yourself

Kai underlined that one objective of the creators of CockroachDB was to make it as easy as possible to install and start using. I encourage you to try this and see for yourself.

Install CockroachDB:

https://www.cockroachlabs.com/docs/stable/install-cockroachdb-mac.html

And follow this guide:

https://www.cockroachlabs.com/docs/stable/start-a-local-cluster.html

Kai had set up a CockroachDB cluster with three different regions/zones US, Europe (AWS) and Åkersberga (on premise). He then showed how CockroachDB handles nodes going down and finally entire data centers/regions. As long as the majority of the nodes were still up the database just kept on going as nothing had happen from a client’s point of view. It should take you only 5–10 minutes to set up and test a local cluster. I did this and tried out the same thing Kai demoed at the end of his talk (but on my local cluster).

Final words

This talk gave me a great introduction to CockroachDB and also quite a few deep dives and explanations of interesting issues that you need to pay attention to when working with databases: ACID, clock skew, true time, serialization and linearization etc. Time well spent.

Thanks to Kai for an interesting talk and a great evening!

Written by: Magnus Andersson

Relaterade länkar

Ämnen

  • Utmärkelser

Kategorier

  • kompetens
  • konsult
  • webstep
  • utveckling
  • databaser
  • cockroachdb

Kontakter

Relaterat innehåll

  • Tech-Lead Training

    Every spring and every fall Webstep organize a “Competence Weekend” (kompetenshelg) for employed consultants. Organizing such a weekend is a quite simple but long process.

  • Fatta först, lös se'n!

    “If I had an hour to solve a problem I'd spend 55 minutes thinking about the problem and 5 minutes thinking about solutions.” - Albert Einstein.

  • A Tour of Exercism

    The best way to get better at something is to teach it to others This is the first of two articles about Exercism written by Uzi Landsmann. This article will give an introduction to the platform and to solving some exercises and getting mentor help. The other article will discuss being a mentor yourself, and how much you can learn by helping others.

  • Apache Kafka in a nutshell

    This is first in series of articles about Apache Kafka written by Vajo Lukic. Webstep has recently become a partner with the company Confluent, one of the distributors of Kafka and one of the reasons behind this blog serie. The purpose of this article is to help everyone who is interested in Kafka, to understand what it is and to reduce the learning curve of learning Kafka.

  • Challenges of AI-projects

    The purpose of this article is two-fold, first to help organisations better understand the challenges of starting AI-projects and second how to systematically approach them. The intended target audience are C-level executives and managers who are considering to invest in AI-solutions for their business.