Essential characteristics of the microservice architecture: independently deployable

application architecture  

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

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.

Independently deployable = production-ready after being tested in isolation

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.

Rethinking user acceptance tests

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.

An independently deployable service requires a well-defined specification

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.


application architecture  


Copyright © 2024 Chris Richardson • All rights reserved • Supported by Kong.

About Microservices.io

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.

ASK CHRIS

?

Got a question about microservices?

Fill in this form. If I can, I'll write a blog post that answers your question.

NEED HELP?

I help organizations improve agility and competitiveness through better software architecture.

Learn more about my consulting engagements, and training workshops.

LEARN about microservices

Chris offers numerous other resources for learning the microservice architecture.

Get the book: Microservices Patterns

Read Chris Richardson's book:

Example microservices applications

Want to see an example? Check out Chris Richardson's example applications. See code

Virtual bootcamp: Distributed data patterns in a microservice architecture

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 NPXJKULI to sign up for $95 (valid until December 25th, 2024). There are deeper discounts for buying multiple seats.

Learn more

Learn how to create a service template and microservice chassis

Take a look at my Manning LiveProject that teaches you how to develop a service template and microservice chassis.

Signup for the newsletter


BUILD microservices

Ready to start using the microservice architecture?

Consulting services

Engage Chris to create a microservices adoption roadmap and help you define your microservice architecture,


The Eventuate platform

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.


Join the microservices google group