官术网_书友最值得收藏!

Monolithic application example

Suppose we are working on an e-commerce application that provides an online bookshop portal. It takes orders from customers, verifies the availability of the ordered book, places an order, and ships the ordered book to the customer. To build this application, we have to create several modules.

These include a Shop Front UI module, which provides a user interface to customers, and backend services, such as an Account Service, a Book Service, an Order Service, a Shipping Service, and so on. These services have various responsibilities, including verifying the customer, checking the availability of books, placing an order, and shipping the order.

All of these modules will be deployed as a single monolithic application either as a WAR file or JAR file. A Java web application as a WAR file runs on a web container such as Tomcat. This web application serves all HTTP requests that come from various clients, such as desktop or mobile browsers. The request comes first to Apache or Nginx and then to Tomcat.

You can also create multiple instances of this monolithic application to handle millions or billions of requests, or include a load balancer to scale and improve availability.

The following diagram illustrates the architectural design of a monolithic application:

As you can see in the preceding diagram, all modules of this traditional web application, such as Shop Front UI, Account Service, Order Service, Book Service, and Shipping Service, are single artifacts in the Tomcat container. This monolithic application has a massive codebase that includes all modules. If you introduce new modules to this application, you have to make changes to the existing code and then deploy the artifact with a different code to the Tomcat server.

Server-side application developers can include the following components in the architecture design:

  • Presentation: This layer handles HTTP requests and responds with HTML, JSON, or XML
  • Business logic: This is the business logic written into services such as the Account Service or Customer Service
  • Data access: These objects are responsible for accessing the database for business logic
  • Application integration: This component is responsible for integrating the application with other external services via messaging or the REST API

In monolithic application architecture, we place such components as a single artifact in the server-side application. This application architecture means that a new team member can be introduced to the application easily due to the close nature of the team. However, when you have to change the application due to scalability or availability requirements, you have to run multiple copies of the application on multiple machines.

Monolithic application architecture can be made logically modular by dividing it into different layers according to the types of components. All modules and different layers are packaged and deployed as a single artifact monolithic application. Let's now move on and look at the benefits of monolithic application architecture.

主站蜘蛛池模板: 德阳市| 故城县| 荥经县| 全椒县| 米易县| 耒阳市| 横峰县| 扎兰屯市| 东乌珠穆沁旗| 得荣县| 湘乡市| 原平市| 谷城县| 泽库县| 准格尔旗| 新竹市| 泗水县| 老河口市| 社会| 宿州市| 五指山市| 东丽区| 桦川县| 泰和县| 易门县| 左云县| 文登市| 保山市| 清镇市| 宜川县| 彰化县| 准格尔旗| 木兰县| 神池县| 中卫市| 敖汉旗| 金山区| 清苑县| 尤溪县| 宁德市| 三河市|