Monolith means composed all in one piece. The monolithic application describes a single-tiered software application in which different components are combined into a single program from a single platform. Components can be:
- Authorization — responsible for authorizing a user
- Presentation — responsible for handling HTTP requests and responding with HTML (for web services APIs).
- Business logic — the application’s business logic.
- Database layer — data access objects responsible for accessing the database.
- Application integration — integration with other services (e.g., via messaging or REST API). Or integration with any other data sources.
- Notification module — responsible for sending email notifications whenever needed.
This is what makes a monolith services monolith — it is a single logical executable. To make any changes to the system, a developer must build and deploy an updated version of the server-side application.
Consider an example of an eCommerce application that authorizes customers, takes an order, checks products inventory, confirms payment, and ships ordered products. This application consists of several components: an e-Store User interface for customers and some back-end services to check products inventory, authorize and charge payments, and shipping orders.
Despite having different components, modules, and services, the application is built and deployed as one monolithic application for all platforms, i.e., desktop, mobile, and tablet, using RDBMS as a data source.
Making the right architecture choice depends on several factors, particularly when it comes to management capabilities and developer expertise.
Let’s examine the Benefits and Drawbacks of Monolithic Services.
- Simple to develop — At the beginning of a project, it is much easier to go with Monolithic services.
- Simple to test. For example, you can implement end-to-end testing by simply launching and testing it in a monolithic application.
- Simple to deploy. You have to copy the packaged application to a server.
- Simple to scale horizontally by running multiple copies behind a load balancer.
- Maintenance — If the application is too large and complex to understand entirely, it is challenging to make changes quickly and correctly.
- The size of the application can slow down the start-up time.
- You must redeploy the entire application on each update.
- Monolithic applications can also be challenging to scale when different modules have conflicting resource requirements.
- Reliability — Bug in any module (e.g., memory leak) can potentially bring down the entire process. Moreover, since all application instances are identical, that bug impacts the availability of the whole application.
- Despite how easy the initial stages may seem, monolithic applications have difficulty adopting new and advanced technologies. Since changes in languages or frameworks affect an entire application, it requires efforts to work with the app details thoroughly. Hence it is costly considering both time and effort.
Generally, monolithic architectures are the right choice for small, simple app development. Well, monolithic services have their pros and cons, but it depends on each scenario or product or project requirements and which tradeoff you choose. As the monolithic approach best suits lightweight applications, it is recommended to adopt the monolithic application.