Microservice based nodes in the blockchain space are the future

vonlooten
5 min readDec 13, 2021

--

Learn what microservices are and why microservices are a great idea for blockchain nodes. What is the reason for nodes with a microservice architecture?

What are microservices all about?

A microservice architecture is a modular collection of services which, seen together, work as an entire application. The services are loosely coupled and talk with each other via REST API’s or message broker like Kafka or RabbitMQ.

This architecture comes with many opportunities for the developer team.
It is very easy to interchange, remove or add services and this approach also allows a horizontally scaling. There are many more significant advantages towards monolithic systems.

A microservice approach enables a better maintainability. Take a simple update of the service, for example. You don’t have to update the entire application. Only a service, one part of the application, will be affected. If the team works with an automated deployment process, you won’t even notice that the service got updated and rebooted. This is knows as a zero downtime deployment.

The development can also benefit from a microservice based architecture as well. Each development team can focus on the work of a specific service, for example. So nobody has to be aware of every quirk that can happen anywhere in a huge, monolithic application.

Another advantage is that you can use separate software stacks for each service. So the team can choose the stack that fits best to get the work done.

Nowadays, most microservices exist in a containerized environment, like Docker. That means a service has its own virtual machine, or at least its very own namespace, running which encapsulates the service. These virtual environments had a huge impact on development and hosting apps in recent years. You can launch multiple containers with one line in your terminal. This is what also made scaling horizontally easy.

Scaling a blockchain node

One point which is very important in the blockchain node environment is scaling.
So, how can you scale an application or service?
There are multiple ways to scale.

One way that also works for a monolithic architecture is that you scale vertically. This strategy aims to increase the resources of your current system. What needs to happen to scale this way is that you’ll have to upgrade your server with better hardware. More RAM, more storage or maybe a better CPU is necessary to handle the workload.
Many blockchain nodes will have to do it this way.

If we remember comments of the issue “BSC is a lost cause” in BSC’s GitHub repository, we see the negative aspect of monolithic validator nodes. People shared their massive Server specs and disbelief in this GitHub issue.

mcoelho80:

I’m tired of trying to keep my node synced. Even with NVME, 196Gb RAM, all possible configurations and sync modes, my node losts sync VERY quickly.

The other way to scale is scaling horizontally. If one service gets a huge amount of requests and has to perform a lot, why don’t we start many services and split the incoming requests between them. The interesting thing is that we cannot only spawn multiple services on the same machine, we can even rent an additional server that will run more instances of our services.

The Solana incident back in mid-September this year showed us how important it is to have a decentralized network with scalable nodes. The network wasn’t able to handle the huge load it received. The only solution of Solana and their validator community, was to restart the main net.

If people want to take it serious, a Koinos node can be set up with ease in a way that it can scale itself horizontally on multiple servers, if the work load becomes a real problem.

The Koinos microservice cluster

After an introduction to microservice architectures and its scaling, we will now take a tiny look at the Koinos microservice cluster. The entire network node of the upcoming Koinos blockchain has been built as a microservice cluster.

I took the diagram below from the official Koinos docs.
The diagram shows the structure of a Koinos node which is used in test net version 2.0.

This diagram helps to understand the internal data flow of the application.
Every service is connected to a RabbitMQ instance, which is a service that distributes information between the services. It is the centerpiece of the entire internal communication.

You can read more about the microservices in the official Koinos docs. There you can also find a guide to launch a test net node, or you read the guide I wrote recently.

The communication of the Koinos cluster is based on the amqp protocol, which has been implemented in the RabbitMQ service. This makes it extremely easy to add custom services to the cluster. Most languages provide packages for amqp and RabbitMQ.

In a next article, I’m going to explain what the task of each microservice in the Koinos cluster is.

Conclusion

There are various aspects showing that a microservice architecture is a very suitable concept for a node structure.
For me, scalability, maintainability and the easy way to connect my own services with the node are the most important reasons to favor the microservice based architecture.

The incident of the BSC and Solana validator nodes was (is) frightful. A blockchain project should provide nodes that follow a lightweight approach. Handle the situations in a dynamic and flexible way. This is what Koinos enables. Not the entire monolithic application inclusive it’s not used elements need to be scaled. Instead, only the service that are busy and at their capacity need a helping hand.

This article is a very brief read about microservices and how Koinos is using it in its blockchain. I didn’t talk a lot about details, what microservices and especially the Koinos microservice node have to offer. This can be seen as more of a short introduction. Be sure to follow me, so you won’t miss the next part, where I’m going to explain the Koinos microservices in detail.

I am absolutely stoked about what the Koinos team has built here, and I think this is the way to go for blockchain nodes.

Follow me and the Koinos project:

I also run the Three Things This Week newsletter where I share the 3 most interesting things I found in this week with you.

Please subscribe to the Newsletter

Twitter vonlooten
Twitter koinosnetwork
Discord Koinos
Telegram Koinos Network
Website Koinos.io

Sources

Koinos Docs
microservices.io
RabbitMQ

--

--