Monoliths versus Microservices
January 11, 2023

Terence Wong
Octopus Deploy

Monoliths and microservices are 2 approaches to building software. Which one you choose can significantly impact development and performance.

In this post, I discuss:
■ The difference between monoliths and microservices
■ Which is better for enterprise software applications
■ Challenges of both approaches

What Are Monoliths and Microservices?

A monolith is a singular executable software application. It contains one codebase that defines the user interface, application logic, and database required to run an application. A monolithic application is built and maintained as a single, indivisible unit and is served from a central location. For example, in-house accounting software that uses a database to store customer records, a web server for record keeping, and other components, all served from an on-premises server.

By contrast, a microservice architecture breaks down an application into smaller independent units. Microservices are connected to make the whole application through Application Programming Interfaces (APIs).

APIs let microservices communicate with one another to execute a task. For example, a microservice sends input data to a second microservice. The second microservice sends input data to several other microservices, and so on. The same accounting software can run on the cloud, with the database, web server, and other components distributed across multiple geographical regions.

Microservices are modularized. Their components are built independently and only become associated when they need to create an application. A database component built for a microservice can be part of 2 different software applications through software reuse.

The diagram below visualizes the differences between monoliths and microservices. They key dinstinction is that monoliths are large units with several services whereas an application using microservices is made up of several independent microservices.


Which One Is Better for Enterprise Software Applications?

Traditionally, software applications were built as monoliths. With the advancement of cloud technologies, though, particularly containerization, microservices have become popular in delivering software. Google Trends shows that microservices gained popularity after 2013. It was also 2013 when Docker, the leading containerization technology, was released.


Microservices are more agile than monoliths because there's more isolation between microservices. Building, testing, and deploying a monolithic application involves the entire codebase. You can build each microservice and test it independently, without building a larger application. The agility of microservices also means they're more reusable than monoliths. To reuse code from a monolith, you need to create interfaces for the new application. Through APIs, microservices have immediate interfaces with other applications, making them easier to reuse.

A container is a lightweight, portable computing environment with all the necessary files to run independently. Containerization is the process of making an application runnable as a container. Containerization helped microservices gain popularity and widespread adoption through scaling. Microservice applications leverage cloud orchestration tools like Kubernetes to schedule and scale workloads.

Imagine an application contains a database and a web front-end, but the database is also serving a second application. A Kubernetes node dynamically manages load for the front-end and database by increasing or decreasing load on each service. The Kubernetes node services 2 applications, and only uses the resources required for the task. A monolith can only scale by adding more nodes that scale the entire application, creating unnecessary costs.

Enterprise software applications operate at scale and compete with other products for market share. Our post on DORA metrics discusses how agility-based metrics like deployment frequency, lead time, mean time to recovery (MTTR) and change failure percentage are important to improving profitability, market share, and productivity. Microservices are more agile and flexible than monoliths, allowing microservice applications to be delivered faster to market and achieving cost savings at scale. Microservices can be delivered iteratively with feedback instead of delivering a monolith as a single executable. The benefits of microservices make them well-suited for enterprise software applications.

The Challenges When Using Microservices

Despite many benefits, there are challenges when using microservices over monoliths. An application using microservices can make hundreds of API calls for one function, where a monolith application only needs one. Monoliths can have higher performance at scale for applications that require several functions, as there's no need for multiple API calls per function.

Both the monolithic and microservice architecture can be complicated. When developing a monolith, you end up with a large application code base. It's unlikely that a single developer or team understands the application in its entirety.

Microservices contain multiple interacting services that can each use a different framework, making it more complex. The number of services in microservices also increases the demand for documentation as the number of services grows.

Downtime in a microservice can have cascading effects in the application. Even though microservices are independent, they're connected. If one microservice sends incorrect outputs, this can cause other microservices to behave unpredictably. Microservices are decentralized, which introduces networking problems. Firewalls, latency, and security are more significant problems in microservices than in monoliths, where an application is self-contained and runs in a central location.

Conclusion

Monoliths and microservices are two approaches to software development. Around 2013, microservices became popular with improved cloud and container technologies. Monoliths are a singular executable providing high performance but low agility. Microservices are independent services that make up a larger application providing high agility, flexibility, and scale. These benefits make microservices better suited for enterprise software applications, as long as you're aware of the challenges.

Terence Wong is a Technical Content Creator at Octopus Deploy
Share this

Industry News

February 02, 2023

Red Hat announced a multi-stage alliance to offer customers a greater choice of operating systems to run on Oracle Cloud Infrastructure (OCI).

February 02, 2023

Snow Software announced a new global partner program designed to enable partners to support customers as they face complex market challenges around managing cost and mitigating risk, while delivering value more efficiently and effectively with Snow.

February 02, 2023

Contrast Security announced the launch of its new partner program, the Security Innovation Alliance (SIA), which is a global ecosystem of system integrators (SIs), cloud, channel and technology alliances.

February 01, 2023

Red Hat introduced new security and compliance capabilities for the Red Hat OpenShift enterprise Kubernetes platform.

February 01, 2023

Jetpack.io formally launched with Devbox Cloud, a managed service offering for Devbox.

February 01, 2023

Jellyfish launched Life Cycle Explorer, a new solution that identifies bottlenecks in the life cycle of engineering work to help teams adapt workflow processes and more effectively deliver value to customers.

January 31, 2023

Ably announced the Ably Terraform provider.

January 31, 2023

Checkmarx announced the immediate availability of Supply Chain Threat Intelligence, which delivers detailed threat intelligence on hundreds of thousands of malicious packages, contributor reputation, malicious behavior and more.

January 31, 2023

Qualys announced its new GovCloud platform along with the achievement of FedRAMP Ready status at the High impact level, from the Federal Risk and Authorization Management Program (FedRAMP).

January 30, 2023

F5 announced the general availability of F5 NGINXaaS for Azure, an integrated solution co-developed by F5 and Microsoft that empowers enterprises to deliver secure, high-performance applications in the cloud.

January 30, 2023

Tenable announced Tenable Ventures, a corporate investment program.

January 26, 2023

Ubuntu Pro, Canonical’s comprehensive subscription for secure open source and compliance, is now generally available.

January 26, 2023

Mirantis, freeing developers to create their most valuable code, today announced that it has acquired the Santa Clara, California-based Shipa to add automated application discovery, operations, security, and observability to the Lens Kubernetes Platform.

January 25, 2023

SmartBear has integrated the powerful contract testing capabilities of PactFlow with SwaggerHub.

January 25, 2023

Venafi introduced TLS Protect for Kubernetes.