Microservices and CI/CD
Creating a Working Partnership
Microservices are new to most organizations and they can take a bit of getting used to. By their very nature, they disrupt our normal ways of doing things. Continuous Integration/Continuous Deployment (CI/CD) is one of those things that can get disrupted. If you are interested, lets take look at how microservices and CI/CD can form a happy working partnership.
Organizations that do CI/CD understand the problems they solve and the value they can deliver. It would be unwise to think that microservices reduce the need for or value of CI/CD in any way — if anything, the increased number of executable artifacts, created when developing microservices, increases that need. Still, they do change some of the ways we need to implement CI/CD and we need to adapt to that fact.
What are Microservices?
Microservices are not magic, but they are an effective approach to breaking up an application into usable components that can then be connected together to form systems. Microservices have captured a great deal of attention in the software development community because they promise to:
- Enable faster, more agile software development.
- Help iterate application functionality more quickly and with less fuss and bother.
- Open up the real power and capabilities of the cloud for your applications and users.
Those are all pretty compelling benefits and well-worth a serious effort to gain them. The microservice pattern is also a great fit for Agile development practices. But there really is no free lunch when it comes to software development. The fundamental properties of microservices do affect the way you do CI/CD.
First, if you would like to take a little deeper look at what microservices really are, we recommend that you take 5 minutes to read Are Microservices Right for You?
SPOILER ALERT: True microservices are not built with Spring Boot or JAX-RS! Though both frameworks are an excellent way to build traditional Service-Oriented Architecture applications, they do not implement real microservices.
What Makes Microservices Different for CI/CD?
Don’t worry. Your investment in CI/CD software tools and training is was not in vain and they can still do the job for which you invested in them.
What makes microservices fundamentally different is their granularity, the number of artifacts you are working with, and their units of deployment. An individual microservice:
- Implements a single task within a domain bounded context — meaning that there are many more separate code units to be managed.
- Is loosely-coupled making use of little or no knowledge of the definitions of other microservices and communicating by message passing rather than RPCs, function calls or method calls — meaning that it can be deployed individually rather than in a larger executable.
- Is autonomous and can be developed and modified with less coordination among different development teams — reinforcing the requirement that it be small and focused on a single task.
- Is independently deployable and can be individually tested, rolled out, and rolled back without impacting other microservices —meaning that it must be testable alone, without an enabling framework, and must be deployable in a cloud container. Deployment, operation, and monitoring are usually best managed through a container orchestrator like Kubernetes.
What to Do?
It should be apparent that services need CI/CD to be fully microservices. It is also pretty obvious that the proliferation of deployable code units created by the microservice pattern can make CI/CD a logistical necessity. The only real choice is whether to use available commercial and/or open source tooling, or to roll your own. Barring any truly unique organizational constraints, that choice is easy.
With any new architecture, technology, or technique, it’s probably best to start small. Microservices and cloud computing may be new to your organization. It is probably risky to jump directly into the deep end of the pool. It’s usually better to start at the shallow end and take things a step at a time, beginning with small projects — focusing on learning how to adjust your CI/CD practices to the unique attributes of the microservice pattern, and emphasizing communication as you move into a new way of building and managing software. It’s worth the effort.
If you would like to read some more microservices, we recommend Software Architecture for the Cloud and Multi-Cloud Apps: Part 1, Mastering the Actor Model.