What is a microservice? What is a container?

Hilda Edimo
4 min readMay 6, 2020

When I joined VMware in July 2018, people started telling me about a solution we had for containers and how difficult it was to understand. I told myself: if it’s hard then I’m not interested and what the hell is a container anyway!

Fast forward two years later, I figured out what it is. In this article, I explain in a simple way what are microservices and containers and their business benefits.

What’s wrong with a virtual machine?

Nothing is wrong with virtual machines. It depends on what you’re trying to implement.

Let’s say you launch a cooking application. On that app, people can look for different recipes with or without videos. They can leave comments and rate the recipes. Where one team is in charge of putting up new recipes, a second one is in charge of the comments and ratings and a third one is in charge of the newsletter. All these services running together is what we call a monolithic architecture.

the cooking app code

1. Your app is a big success and you start thinking of new ways to improve it. That’s when the problems start. You need more frequent releases. For each one, all the teams need to work together, so they all write the required changes and make sure that it all fits together. Now changing the app is risky. You don’t want to deliver a new version that’s broken.

2. If there’s an error somewhere in the code, the whole application is impacted. You need to rollback, debug, correct and re-deploy the application. The bigger the application, the more time consuming it is. Meanwhile your customers are still waiting…

3. You decide to add machine learning to your app to better understand your customers’ behaviour and needs so you can provide them with new recipes that they would like. However, your app wasn’t written in Python and machine learning is usually implemented with Python.

4. You start having a headache as you realise the traffic is heavy and your app keeps crashing. Unfortunately, you can’t scale up and scale down when needed so you decide to put it on a bigger virtual machine. This results in resources like CPU being used during peak hours and being wasted the rest of the time.

So, what if I told you splitting your app in smaller pieces is the solution to all your issues?

What are microservices?

Your cooking application can be seen as a set of different services. You have many different services to display the website, for the machine learning, for the comments, for the ratings and another to send the newsletter and so on.

Each of these services has its own processes and can function by itself without impacting the rest. That’s what we call a microservice. A microservice has a specific function/role and is independent from the others and its failure doesn’t impact other services.

the cooking app in microservices

This solves the 4 problems you had previously.

1. By splitting your app into services, each team will be responsible of their own services. They will be able to change them when needed to keep customers happy.

2. Since each service is independent, a change has a low impact on the app. If in a new release there’s an error with the rating service, users won’t be able to rate the recipes, but the rest of the app will still work.You can rollback that specific service and not the entire app which is faster.

3. Independent service means, you can use the languages you want. It’s now easy for you to implement your machine learning features in Python.

4. Each service is decoupled from the database so their stateless. Data is not stored on the microservices but somewhere else. Because of that, you can scale up or scale down the number of copies for each service depending on the traffic they receive.

What is a container?

Now how does all this run on your infrastructure? That’s where containers come into play. While virtual machines are compute-level virtualisation, containers are OS-level virtualisation.

Virtual Machine vs Container

A container only has binaries and libraries it needs and share OS with other containers. Since a container has no packaged OS it’s simple, lightweight and portable. It’s a good fit for microservices that needs to be spin up fast when scaling up down.

It also provides reduced downtime since it boots rapidly. By sharing a guest OS, a container can run on any infrastructure that has a container runtime which is a software that executes and manages containers. Just like how you need a hypervisor to run virtual machines. Docker is a well-known container runtime.

By splitting your application into multiple microservices, businesses gain agility, speed and are able to meet their customers’ needs faster and that is good for the business. Containers enable to run those microservices in your environment and provide you with fast delivery, reduced downtime and portability to other platforms and why not a public cloud.

Let’s not forget there are challenges in managing containers. How do you manage a great number of containers? How do you manage security and network? How do you keep visibility? How do you implement self-healing? There are a lot of orchestration solutions out there to solve these challenges.

--

--