The microservice architecture
The microservice architecture is without doubt one of the most talked-about and trending software development architectural style nowadays, used by more and more teams and companies world-wide. This pattern enables rapid, frequent and reliable delivery of large and complex application by splitting the business domain into smaller, manageable parts and setting up communication between them.
The microservice architecture structures the application as an assortment of loosely coupled services where each service is self-contained and should implement a single business functionality. The main benefits of using this microservice architectural style are the followings:
- Easy to iterate: since the whole business domain is split into smaller, individual deployable parts, it is easier to add new functionality or to extend a given component without having any impact on other services;
- Clean separation into teams: since the services are self-contained and they only communicate with each other via well-defined interfaces, it makes easier to assign each of the services to different teams, letting them focus on smaller problem domains;
- Reducing complexity: by breaking down a complex application into managable components, we highly reduce complexity, making the system cleaner, more understandable and maintainable;
- Scaling: one of the biggest benefits of applying micro service architecture is that we can much easier manage the scaling of the different parts of the application, making it more robust and prepared for larger scales and loads.
To be honest I am really impressed by containerization and the marvelous idea behind it. What I mainly love about it is that we just simply put our service with all its dependencies into a container – which acts as a wrapper – and making it ready to be used in our application context. A container is basically a light weight virtual machine and we do whatever we want with it, such as shipping, replicating, running and destroying. And the best thing is that it will always run and behave according to our expectation, independently of the underlying host.
The most famous container life cycle management tool is the Docker which uses OS-level virtualization to deliver software in a packaged forms called containers. Docker containers are similar to virtual machines but containers are more lightweight and much easier manageable. The following diagram sows the main difference between a container and a virtual machine:
So why to use containers?
- Portable: run anywhere where Docker is supported;
- Lightweight: reduced dick, CPU and memory footprint;
- Consistent: consistent base of containers with expected behaviors;
- Efficient: faster deployment, less downtime and easier reproduction.
Kubernetes – The King!
Kuberentes is an open source container management and orchestration platform. Lately, it has become the de facto standard tool for running containerized applications based on microservice architecture. The name Kubernetes originates from Greek, meaning helmsman. Therefore there is a ship steering wheel sign present in its official logo:
Kubernetes provides many powerful functionalities and supports the developers’ and operators’ life in the following ways:
- Managing the communications between microservices;
- Scaling and descaling applications both in manual and automated fashion;
- Ensuring robust deployments of application components;
- Load balancing the traffic to the application;
- Automated storage orchestration;
- Auto self-healing responsibilities;
- Maintaining resilience and fault tolerance.
Furthermore, Kubernetes has a huge ecosystem, supporting everyone’s needs:
The beauty of Kubernetes is that it creates a hardware layer abstraction, enabling running of mini virtual machines (containers) talking to each other in an efficient and load-balanced way. Next to that, Kubernetes is cloud agnostic and runs on any big cloud provider like Amazon Web Services (AWS), Microsoft Azure, and the Google Cloud Platform (GCP), but you can also run it on-premise, therefore the concepts are universal. Last but not least, Kubernetes offers a much better resource utilization than different hypervisors do, resulting in a cost efficient solution.
The hype a.k.a be careful!
While more and more companies are applying Kubernetes and microservice architecture in their environments, there is definitely a hype around it and it should be picked up and applied wisely and with responsibility. By using it we introduce a lot of added complexity which can be simply not beneficial or efficient in our specific domains. So avoid cracking a nut with a sledgehammer!
As we saw, with the approach of developing a application as a suite of small services we can gain many benefits and it is definitely one of the best state-of-the-art technology in the software-engineering space. The containers enable to manage our application components in a self-contained and portable way, resulting in behaviors according to our expectations. Finally, Kuberntes makes it easy to deploy and operate applications in a microservice architecture while providing many benefits and features for a highly available, scaleable and fault tolerant software.