What are Microservices?
Microservices are a software architecture design pattern in which applications are composed of small, independent modules that communicate with each other using well-defined contracts. Each microservice focuses on a single concept.
Why Microservices Architecture?
Microservices make it easier to develop, test, and deploy isolated parts of your application. Once deployed, each microservice can be independently scaled as needed.
Microservices provide the ideal architecture for continuous delivery. With microservices, each application resides in a separate container along with the environment it needs to run. Because of this, each application can be edited in its container without the risk of interfering with any other application.
This means zero downtime for users, simplified troubleshooting, and no disruption even if a problem is identified. The safe and rapid changes allowed by microservice architecture make it possible to update software fast enough to put the “continuous” in continuous delivery. By keeping disruption to a minimum, microservice architecture lets you update rapidly without inconveniencing customers.
Deployment for Microservices
Microservices approach calls for a large number of separate applications. Services may be RESTFul, scheduled jobs, event based, etc. They each have different server configurations and scaling requirements. Even with all of this complexity microservices need to be created and deployed quickly and often automatically as part of the CI/CD pipeline.
Here are some of the deployment options:
- Virtual Machines
This architectural pattern is probably the easiest to understand for someone transitioning from monolithic applications. In this setup, every microservice gets its own virtual machine.
This architectural pattern makes the services easy to understand because each service is isolated with its own CPU, memory, and server configuration. You can log in to a server and debug a service in the same way you would with traditional monoliths.
This pattern is shrinking in popularity due to its many drawbacks. The first is that it’s expensive. Each service now requires an entire operating system increasing the necessary size and power of each VM. If auto-scaling is available, it tends to be very slow.
Containers and virtual machines share similar use cases. Both provide resource isolation and allocation benefits, but where virtual machines virtualize the underlying hardware, containers virtualize the operating system. Removing the need to copy and configure an entire operating system makes containers portable and efficient.
Containers are fully isolated processes, they require less resources and size as there is no operating system to duplicate. This made containers an ideal option for developing and deploying applications. Docker was released in 2013 and quickly became the default standard for containerizing an application.
Blog by: Sahil Joshi