After the cloud revolution, two important trends have been making waves in the IT circles. The first one is DevOps and the second one is microservices.
While DevOps is more about a set of practises, microservices is more about software architectural design. According to Technavio report, global DevOps market is expected to touch $3 billion by 2019. Similarly, Market Analysis reports that the Microservices and DevOps ecosystem is expected to touch $10 billion by 2021, growing at a CAGR of 16% between 2017 and 2022.
Microservices actually evolved from a set of DevOps ideologies.
DevOps is a set of practises of software development and delivery wherein developers and operations team come together to form cross-functional teams for a greater collaboration between development, business management and operational procedures.
Microservices is a software development architecture that focuses on developing software products as a suite of independently deployable smaller services. These services are created with a unique purpose and they effectively communicate through a well-defined mechanism to achieve that purpose.
DevOps and microservices go hand in hand for two important reasons.
The first goal of DevOps is to remove the dependencies between different components of a system and different teams. It intends to reduce the time between a commit and production while not compromising on quality.
Microservices perfectly fits into this scheme of things as it focuses on decoupling components into smaller modules that minimize dependencies between teams and system components. This approach, in turn minimizes the time for updates to go live.
DevOps approach is about creating cross-functional teams comprising developers, operations and testing teams so that each team handles a product's complete lifecycle, right from:
- design and development
- production and maintenance
This approach results in small and agile cross-functional teams. Microservices uses the same approach wherein small and independent services are created here by cross-functional teams.
DevOps has an important role to play in a microservices architecture. While there are multiple things that DevOps can do, here are some important areas where DevOps is really needed.
One of the key aspects of a microservice architecture is deployment. As there are multiple services that are independently deployable, development and production in a microservices architecture is a complex task.
Each service should be deployed or un-deployed independently of other services while being able to scale up and down. The failure of a service should not affect any other service. DevOps solutions help you to automate deployments. Tools such as Puppet, Chef, Ansible and Salt allow you to automate deployments to rapidly deliver great applications.
Containerization has become popular in recent times as well. For instance, Docker helps you to package a microservice into a container image and deploy it as a container. By changing the number of container instances, you can scale the service up and down on-demand.
Kubernetes allows you to manage a cluster of Linux containers as a single system.
Microservices normally fail to deliver the objectives for two important reasons; bad deployment and bad monitoring.
A microservice environment becomes production-ready only when it is properly monitored. When key metrics are not tracked or when the state of a microservice is unknown, you fail to prevent an outage. Moreover, it becomes difficult to quickly resolve the issue.
While monitoring a microservice architecture, you should consider the following aspects.
In a microservices architecture, developers get the flexibility to quickly add new features or change existing ones. A service is not the same one that was few hours before. In such a dynamic-coding environment, understanding the state of a microservice becomes impossible.
You need to log all the information required to understand the state of microservice. In case of an outage, you can check the logs to identify the state of the microservice at the time and outage and quickly resolve the issue.
Monitoring Key Metrics
By identifying key metrics, you know what you should be monitoring on a microservice. When a microservice is created, it is deployed across hundreds of servers with hundreds of dependencies and third-party integrations.
When you are monitoring a microservice, it implies that you are monitoring a range of infrastructure. While it is not possible to monitor this entirely, you should identify metrics that are required to describe the behaviour of a service and how a change affects the overall health of a service.
Metrics are again divided into physical/hardware metrics and business metrics. When it comes to physical or infrastructural metrics, you monitor the health of the CPU, RAM, database connectors, threads, file descriptors, etc.
The logical/business metrics involve factors such as:
- endpoint response times and endpoint success
- errors and exceptions
Once the metrics are identified, you can capture them, log them and analyze them to get clear insights of performance of the entire business infrastructure.
When you identify and capture metrics, these values should be graphically displayed in a central dashboard that is updated in real-time. With a centralized dashboard, everyone across the microservice ecosystem can access the critical information of the service at any time.
Looking at these values, you can understand the health of a service. While the dashboard should include all the critical information that is required to understand the state of microservices, care should be taken to display enough information without overloading it. When there is a change in the desired state of a service, the system sends notification alerts.
Organizations should have a person or a team on 24/7 on-call rotation to monitor the microservices environment. When the key metrics are identified and monitored, changes are instantly notified to the authorized personnel through a notification system in case there is a change in the state of a service. With an on-call rotation system in place, there is always a person who can quickly attend to an outage and
DevOps configuration management tools enable you to define a desired configuration state so that these tools monitor and manage the microservices infrastructure at that desired state. Any changes to the configuration are automatically notified.
Given that you follow the tips provided here, your organization can successfully instill a DevOps methodology in your microservices architecture.
Join the Jar Tippers on Patreon
It takes a lot of time to write detailed blog posts like this one. In a single-income family, this blog is one way I depend on to keep the lights on. I'd be eternally grateful if you could become a Patreon patron today!Become a Patron!