Photo by Leif Christoph Gottwald on Unsplash

Introduction to TypeDB Cluster

Ganeshwara Hananda
Vaticle
Published in
5 min readMar 21, 2022

--

TypeDB empowers you to solve complex problems with its strict yet expressive query language. However, there are additional challenges which come with running your application in production:

  1. Availability: It may need to be always-on, staying operational despite routine maintenance needs and occasional infrastructure issues.
  2. Scalability: It may need to handle changes in access volumes. For example, an e-commerce application may need to be scaled up to handle special sales events such as Black Friday.
  3. Security: Sensitive user data such as passwords and credit card details must be transmitted and stored securely.

TypeDB Cluster is armed with features designed to solve these challenges. In other words, TypeDB Cluster is the TypeDB for production applications. It is designed to provide the capabilities of TypeDB in a robust, scalable, and secure way.

Let’s take a closer look at its features to see how they can help you address the needs of your application.

Features

High-availability

TypeDB Cluster becomes highly-available when deployed as a cluster.

A cluster is a group of servers collaborating together as a single unit. Should some servers become unavailable, the remaining servers can continue operating, thus achieving high-availability.

Your application will connect to the cluster using TypeDB Clients, which are able to automatically discover and transition seamlessly between one server and another, without manual intervention.

As a result, maintaining some level of availability is a well-defined exercise of ensuring there exist some active servers that the clients can connect to. In other words, we simply have to guarantee that the cluster isn’t completely down. The bigger the cluster size, the lower the chance of unavailability.

With high-availability, routine maintenance can be performed on a few servers at a time. Similarly, unplanned incidents such as server or network outages can be managed without disrupting the application.

Horizontal scalability

The other key benefit of cluster deployment is horizontal scalability.

By default, read transactions are served by a single designated server in the cluster. While this default guarantees that transactions see the most up-to-date data, throughput is limited by the capacity of that designated server.

For application functionalities that can tolerate slightly out-of-date data, you can distribute transactions across all servers in the cluster. Throughput will increase linearly to the number of servers, thus achieving horizontal scalability.

Enabling this feature is as simple as opening transactions with the “read-any-replica” option. The client will then seamlessly load-balance the transactions across all servers — there is no need to write manual load-balancing code nor to introduce a dedicated load balancer component (such as nginx or Amazon ELB), keeping your application and the infrastructure simple.

Security

TypeDB Cluster has robust security support.

For one, applications must provide a valid user credential (username / password) when connecting to the cluster, preventing unauthorised access. User accounts can be managed easily and simply — it is straightforward to add, update, and remove them.

Additionally, network traffic is fully encrypted. There are two important pathways that need to be protected: the external pathways (between application and cluster) and the internal pathways (between servers within the cluster). Both kinds of pathways are encrypted using asymmetric encryption, which is the gold standard.

Familiarity

Although not a technical feature, consistency between the TypeDB and TypeDB Cluster experience has been hugely emphasised to make the usage as familiar as possible.

To start with, the query language (TypeQL) is completely identical, and no changes are required in your application in this aspect.

Additionally, there are only minimal configuration changes required for running the servers, as well as when connecting to the cluster with Console, Studio, or the clients.

Connecting and executing a count query with the “read-any-replica” transaction in Java.

As a consequence, there will be minimal hiccups in transitioning applications to TypeDB Cluster. However, given that you will be running a cluster as opposed to a single server, the deployment strategy will be significantly different.

Deployment

TypeDB Cluster supports Windows, Linux, and Mac. Typically, it is deployed as a cluster of size 3–7 using either one of the two deployment approaches:

  • Kubernetes: You should use the official Helm package if your infrastructure is running on Kubernetes / OpenShift. The Helm package provides the ability to automatically deploy a running cluster. Various parameters such as cluster size, CPU count and encryption can be configured.
  • Bare-metal / VM: For any other infrastructure (such as bare-metal servers or virtual machines), you can use the plain archive in zip / tar.gz format. This format does not come with automation at this time, therefore deployment and management have to be done manually.

What’s next?

The features above are just the start! We’re continuously improving TypeDB Cluster and here’s what’s coming up in the near future:

  1. Improved performance: The efficiency of data distribution between servers is being improved on a daily basis with the goal of maximising throughput, especially in a large cluster.
  2. Cluster management: Managing a cluster in production can be complex, time consuming and even error-prone. Thus we will be providing management functionalities in a way that is both intuitive and robust.
  3. Improved security with role-based authorisation: Role-based authorisation allows for granularly fine-tuning user permissions. For instance, it is possible to create a role with read-only access to all databases, and write access to a select few. Having fine-grained permissions are especially useful when working with a large number of user accounts and databases.
  4. Live backup: Every enterprise-grade solution needs to guarantee some degree of resilience against disaster. The live-backup functionality will provide the ability to backup and restore data on-demand.

Get in touch

Not meeting the availability, scalability, and security expectations of users will be detrimental to your business. Fortunately, TypeDB Cluster has the capability to achieve these expectations. Feel free to reach out to us for inquiries about these features, and how to best use them for your application.

--

--

Ganeshwara Hananda
Vaticle
Writer for

Staff Engineer @ TypeDB. Original author of TypeDB Cluster. Designer of TypeDB’s actor-model implementation. Raft, Paxos, and LSM Tree are my cup of tea.