Today developers are using Docker to build modules called microservices, which decentralize packages and divide tasks into separate, stand-alone apps that collaborate with each other. Developers for a nationwide pizza chain might build microservice applications for taking an order, processing a payment, creating a ‘make’ ticket for the cooks, and a delivery ticket for the drivers. These microservices would then operate together to get pizzas cooked and delivered all over the country.
Designing with microservices in Docker requires new thinking and approaches, but it also creates unparalleled abilities for building stable, scalable apps. Here’s a look at the ins-and-outs of microservices and how to make them work for you.
The power and possibilities that can be realized through microservices come with these common areas to address in design and manage on an ongoing basis:
Services distributed across multiple hosts can be hard to track. Rather than a single stop to tweak monolithic apps, collaborating microservices scattered throughout your environment need to be inventoried and quickly accessible.
Each microservice consumes far less resources than monolithic applications, but remember that the number of microservices in production will grow rapidly as your architecture scales. Without proper management a lot of little hosts can consume as much compute power and storage or more as a monolith architecture.
If you’re utilizing the Amazon Web Services environment, there is a bottom limit to the resources you can assign to any task. Microservices may be so small that they require only a portion of a minimal EC2 instance, resulting in wasted resources and costs that exceed the actual resource demand of the microservice.
Microservices stand alone, and can be developed in a wide array of programming languages. But every language is dependent on its own libraries and frameworks, so these multiple programming languages in play will require a completely different set of libraries and frameworks. This grows resource overhead (and costs), and makes deployment a complex consideration.
But these obstacles aren’t insurmountable. This is where groundbreaking container technology like Docker can step in and fill existing gaps.
The Docker technology of the container, now emulated by other container services, helps address the biggest challenges to building a microservice architecture in the following ways.
Create a Docker container for each individual microservice. This solves the problem of resource bloat from over provisioned instances idling under the almost non-existent strain of a lone service, and multiple containers can be run per instance.
Divy all the services required to run a language, including libraries and framework information, into linked containers to simplify and manage multiple platforms.
Use containers to host one or more data volumes, then reference them from other microservices and containers. Chris Evans at ComputerWeekly explains the concept:
“The benefit of this method of access is that it abstracts the location of the original data, making the data container a logical mount point. It also allows ‘application’ containers accessing the data container volumes to be created and destroyed while keeping the data persistent in a dedicated container.”
Gain deep insights into data flow within by monitoring individual container logs with powerful tools like Sumo Logic for logging and machine learning, saving your team’s time and accelerating the continuous delivery pipeline.
Designing an efficient microservice architecture is no accident. Sumo Logic’s own Mike Mackrory outlines five patterns for staying in control of a complex environment powered by microservices:
1. Cultivate a solid foundation. Everything starts with people, so make sure yours are ready to live and breathe in a microservices world.
2. Begin with the API. Simple math: one microservice starts with one API.
3. Ensure separation of concerns. Each microservice must have a single, defined purpose. If it starts feeling like they should add a responsibility, add a new microservice (and a new API) instead.
4. Production approval through testing. Write comprehensive testing parameters for each microservice, then combine them into a full testing suite for use in your continuous delivery pipeline.
5. Automate Deployment. And everything else. Automate code analysis, security scans, pass/fail testing, and every other possible process in your microservice environment.
Build your teams themselves and your general approach to a microservice architecture gradually, carefully, and in the same DevOps spirit of continual feedback and improvement.
Microservices are a new approach to older models for making software collaborate and scale. The long term efficacy of the approach is still to be determined, but there’s no denying the capabilities it brings to designing and managing complex infrastructures in a DevOps environment. Want to dive deeper into the worlds of microservices and Docker? Learn more about benchmarking microservices and check out the power and versatility of the Sumo Logic App for Docker.