整体架构为何以及何时

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.

    如果您的应用程序简单,小巧,不包含大量业务逻辑,因此不需要模块化和可伸缩性,那么Monolithic Architecture就适合您。

翻译自: https://medium.com/@adeelsarwarblog/monolithic-architecture-what-why-and-when-986dc5d5ce03

你可能感兴趣的:(python,java,算法,linux)