Glossary ● What is a Microservice

Ever since the term “Microservice” made its debut in 2005, its usage has grown in popularity. However, even in 2020, a concise and accurate definition is not readily available. This article provides a definition for technical and non-technical stakeholders.

This blog post provides concise and accurate definitions of the concepts Monolith and Microservice. Note, this blog post discusses the question “What is the nature of a microservice” but does not discuss the question “What is the nature of a good microservice” or the question “What is the motivation for adopting microservices”.

Whether an application is a monolithic application or a microservice-based application is a function over the application’s relationship between its organization into components and its organization into packages:

Different Perspectives

An application may be described from multiple, concurrent perspectives. In this post, we will describe an application from the perspective of its

  • organization into components
  • organization into packages
  • organization into processes

Organization into Components

Figure 1. An Application as a Set of Components

From this perspective, an application is composed of a set of components. In this post, a component is an autonomous agent communicating with other components by exchanging messages.

Organization into Packages

Figure 2. An Application as a Set of Packages

From this perspective, an application is composed of a set of packages. In this post, a package is an executable artifact like a binary or a container image.

Organization into Processes

Figure 3. An Application as a Set of Processes

From this perspective, an application is composed of a set of processes. In this post, a process is an instance of a package like an operating system process or a container.

Monolithic vs Microservice-based

Figure 4.

Figure 4. represents the distinction between a purely monolithic application and a purely microservice-based application is drawn based on the mapping of application components to application packages:

  • An application is a purely monolithic application if all components are organized into one package.
  • An application is a purely microservice-based application if each component is organized into one package.
Figure 5.

Figure 5. represents the extremes of the spectrum, illustrating monolithic applications on the left and microservice-based applications on the right.

With almost absolute certainty, any given application is not purely monolithic or purely microservice-based but instead leans towards either category to some degree.

Why Packages? Why not Processes?

Why should components be mapped onto packages and not onto processes as the defining characteristic of monolithic and microservice-based applications?

After all, the statement “a monolithic application runs in one process/on one node” and the statement “a microservice-based application runs in many processes/on many nodes” seems reasonable at first glance.

However, the number of processes or nodes in an application is not a valid characteristic to define an application as monolithic or microservice-based because the number of processes or nodes in an application does not determine the architecture of that application.

For example, Figure 6. depicts a common 3-tier application: The application is composed of a Presentation Tier, an Application Tier, and a Database Tier.

Figure 6. 3-Tier Application

The Presentation Tier and the Application Tier scale independently to meet demand.

At any point, this application may be composed of two processes/two nodes, one hosting the Presentation Tier, one hosting the Application Tier, or many thousand processes/many thousand nodes hosting the Presentation Tier and Application Tier redundantly.

Yet independent of the number of processes this application classifies as a monolithic application because its components are organized into two packages.

Conclusion

Whether an application is a monolithic application or a microservice-based application is a function over the application’s relationship between its organization into components and its organization into packages:

  • An application is a purely monolithic application if all components are organized into one package.
  • An application is a purely microservice-based application if each component is organized into one package.

Deciding between a (mostly) monolithic or (mostly) microservice-based application architecture is not an end in itself. Instead, application developers and operators should weigh the consequences of grouping sets of components into a package together as the deciding factor.

About this post

Concise and accurate definitions are essential to communicate complex concepts, both to technical and non-technical stakeholders. If we do not share a common vocabulary, we cannot share a common understanding!

Principal Engineer at Cisco, Office of the CTO

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store