The home page of microservices.io lists several essential characteristics of the services that comprise a microservice architecture. This is the first in a series of blog posts that describes each of those characteristics starting with independently deployable.
The simplistic definition of ‘independently deployable’ is a service is packaged as a deployable or executable unit. Examples of a deployable or executable unit include: executable JAR file, WAR file, operating system executable, a Docker container image, or a Zip file that defines an AWS Lambda function. Conversely, a regular JAR file that needs to be packaged with other JARs is not a deployable or executable unit. While this meets the literal definition of ‘independently deployable’ is woefully inadequate. Let’s look at a better definition.
A much more meaningful definition of independently deployable is a service that is packaged as a deployable or executable unit and is production-ready after it has been tested in isolation. Such a service has its own source code repository and deployment pipeline. The deployment pipeline tests the service in isolation by using test doubles for its collaborators along with consumer-driven contract testing. What emerges from the deployment pipeline that is a service that can and should be deployed into production.
If you need to test your service with other services in order to verify that it’s production ready then it is not independently deployable. Moreover, you might want to consider putting those services in a single repository. It ensures that the output of your single deployment pipeline is actually production ready. It will also eliminate the complexity of developing across multiple repositories.
An important benefit of an independently deployable service is that it accelerates the deployment pipeline. It eliminates the need to slow, brittle, and complex end-to-end tests of multiple services. It also eliminates the need for teams to coordinate their and potentially obstruct one another.
One obstacle to deploying services independently are system-level user acceptance tests. Acceptance tests are usually written from the perspective of a user and often span multiple services. A straightforward implementation of such tests would require testing multiple services together. In order for services to independently deployable, you must replace system-level user acceptance tests with service-level user acceptance tests.
More generally, in order for a service to be testable in isolation it needs to have (a) a well-defined specification and (b) a test suite that verifies that its behavior conforms to that specification. If you cannot precisely specify a service’s behavior, you should probably reconsider whether it makes sense as a service.
Services must also collaborate through stable APIs in order avoid regularly changing in lockstep. That’s one aspect of another defining characteristic of the microservice architecture - loosely coupled - which I’ll describe in a later post.
Microservices.io is brought to you by Chris Richardson. Experienced software architect, author of POJOs in Action, the creator of the original CloudFoundry.com, and the author of Microservices patterns.
Take a look at my Manning LiveProject that teaches you how to develop a service template and microservice chassis.
My virtual bootcamp, distributed data patterns in a microservice architecture, is now open for enrollment!
It covers the key distributed data management patterns including Saga, API Composition, and CQRS.
It consists of video lectures, code labs, and a weekly ask-me-anything video conference repeated in multiple timezones.
The regular price is $395/person but use coupon JUNVCEJE to sign up for $195 (valid until February 1st, 2023). There are deeper discounts for buying multiple seats.
Chris offers numerous resources for learning the microservice architecture.
Chris teaches comprehensive workshops, training classes and bootcamps for executives, architects and developers to help your organization use microservices effectively.
Avoid the pitfalls of adopting microservices and learn essential topics, such as service decomposition and design and how to refactor a monolith to microservices.
Delivered in-person and remotely.
Want to see an example? Check out Chris Richardson's example applications. See code
Engage Chris to create a microservices adoption roadmap and help you define your microservice architecture,
Use the Eventuate.io platform to tackle distributed data management challenges in your microservices architecture.
Eventuate is Chris's latest startup. It makes it easy to use the Saga pattern to manage transactions and the CQRS pattern to implement queries.
Note: tagging is work-in-process
anti-patterns · application api · application architecture · architecting · architecture documentation · dark energy and dark matter · deployment · development · devops · docker · implementing commands · implementing queries · inter-service communication · loose coupling · microservice architecture · microservice chassis · microservices adoption · microservicesio updates · multi-architecture docker images · observability · pattern · refactoring to microservices · resilience · sagas · security · service api · service collaboration · service design · service discovery · service granularity · service template · software delivery metrics · success triangle · team topologies · transaction management · transactional messaging