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

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.

主站蜘蛛池模板: 濮阳市| 铁岭县| 赣州市| 祁阳县| 灵丘县| 青铜峡市| 丹棱县| 曲周县| 启东市| 隆安县| 仙桃市| 邵阳市| 娱乐| 丰宁| 常德市| 灵武市| 元谋县| 芷江| 鹿邑县| 金川县| 扶沟县| 基隆市| 义乌市| 前郭尔| 华坪县| 镇康县| 娄烦县| 突泉县| 宁德市| 赤城县| 万年县| 富川| 务川| 贵阳市| 盐山县| 垫江县| 阳新县| 龙江县| 闵行区| 乌拉特后旗| 丹江口市|