Monolithic architecture is the classic way of software development. In a monolithic application, all components are built as a single code base and deployed as a single file. All of us, at some stage in our career, have designed and developed a monolithic architecture based application.

整体架构是软件开发的经典方式。 在单片应用程序中,所有组件都构建为单个代码库,并部署为单个文件。 在我们职业生涯的某个阶段,我们所有人都已经设计和开发了基于整体架构的应用程序。

(What is Monolithic Architecture?)

Most of the time, a software is a combination of different feature set. In the monolithic architecture, all features of a software reside in a single code base, and deployed as a single file. If any code updates are required, then those updates can’t be accommodated independently. Developer has to use the same code base, make the required code changes and then re-deploy the updated code. So even if a single change is required, the whole code base is touched and re-deployed.

大多数时候,软件是不同功能集的组合。 在整体架构中,软件的所有功能都驻留在单个代码库中,并作为单个文件部署。 如果需要任何代码更新,则不能独立容纳这些更新。 开发人员必须使用相同的代码库,进行所需的代码更改,然后重新部署更新的代码。 因此,即使需要进行单个更改,整个代码库也会被触摸并重新部署。

(Types of Monolithic Architecture:)

There are mainly two types of Monolithic Architecture:

整体架构主要有两种类型:

Single Process Monolithic Architecture:

单进程整体架构:

If all code of an application is deployed as a single process, then this type of architecture is called Single Process Monolithic Architecture.

如果将应用程序的所有代码部署为单个进程,则这种架构称为单进程整体架构。

Most of the classic applications in the industry are based on this architecture.

业界大多数经典应用程序都基于此体系结构。

Modular Monolithic Architecture:

模块化整体架构:

In this variant of monolithic architecture, a single application process consists of multiple modules. Each of these modules can work independently. The modules have interfaces and can communicate with each other through these interfaces. The underlying database is the same, and all of the modules use the same database for all operations. But still, all of the modules need to be combined in to form a single file for deployment.

在单片架构的此变体中,单个应用程序进程包含多个模块。 这些模块中的每一个都可以独立工作。 这些模块具有接口,并且可以通过这些接口相互通信。 基础数据库是相同的,并且所有模块对所有操作都使用相同的数据库。 但是,仍然需要将所有模块组合在一起以形成用于部署的单个文件。





Modular Monolithic Architecture 模块化整体架构

Modular Monolithic Architecture is considered as a better architecture than Monolithic Architecture. But if we compare Modular Monolithic with Microservices then definitely Microservices are better. But all organization don’t have skills and time to implement Microservices. So Modular Monolithic works for them and meets their requirements. Specially if module boundaries are well defined and a high degree of parallelism can be achieved then modular monolithic application architecture is considered as a good architecture. One of the great examples of the organizations who have used this architecture is Shopify. You can watch the talk on YouTube.

模块化单片架构被认为比单片架构更好。 但是,如果我们将模块化单片与微服务进行比较,那么肯定微服务会更好。 但是所有组织都没有技能和时间来实施微服务。 因此模块化单片为他们工作并满足他们的要求。 特别是,如果模块边界定义良好并且可以实现高度并行性,那么模块化单片应用程序体系结构将被认为是一种良好的体系结构。 Shopify是使用此架构的组织的一个很好的例子。 您可以在YouTube上观看演讲。

(Why Monolithic Architecture?)

Monolithic architecture has its Pros and Cons.

整体架构具有其优点和缺点。

Advantages of Monolithic Architecture:

整体架构的优势:

  • It’s simple to develop as there is either no modularity or less formal modularity.
  • It’s easy to deploy as one single file is deployed.
  • There are less security concerns as software consists of single code base.
  • Because of the single code base, there is no network latency so application has better performance.
  • It’s easy to track bugs and do end-to-end testing because of single code base.

Disadvantages of Monolithic Architecture:

整体架构的缺点:

  • When a bug affects a single aspect of the codebase, it affects everything.
  • Even if a small change is required, then whole application needs to be redeployed.
  • Thorough regression testing is required even if a small change is made.
  • You cannot scale the components, you have to scale the whole application. So if a single feature of the application is facing users load, and we have to deploy the feature on multiple servers for load-balancing then we can’t deploy that single feature/module on a separate server. We have to deploy the whole application on the separate server. This is very inefficient use of resources.
  • There are technology up-gradation barriers. If you want to use a new technology or framework, you can’t do that in part of the application. You have to re-write the whole application.
  • As codebase size increases, it becomes difficult to manage code and overall deployment time also increases.
  • If a new developer joins the project, it’s very difficult for him to understand the code and workflows.

(When to use Monolithic Architecture?)

Though there are more disadvantages of monolithic architecture, but still there are business use cases, where using monolithic architecture is a good choice. Some of them are discussed below:

尽管单片架构还有更多的缺点,但是仍然存在一些业务用例,其中使用单片架构是一个不错的选择。 其中一些将在下面讨论:

  • If you are a startup, your team is small and you don’t have architects and the team required to implement complex architecture, then it make complete sense to go for monolithic architecture. Monolithic architecture can meet your business requirements, and you can always change the architecture when you have the required resources.
  • When you are developing a business proof of concept then rather than going into too much modular approach or microservices, it’s good to use monolithic architecture to complete proof of concept as soon as possible with less complexities.
  • If your application is simple, small, does not contain much business logic and so does not need modularity and scalability, then Monolithic Architecture is for you.