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

Microservice application example

We discussed a monolithic application in the previous section, in the form of an online book shop. In this section, we are going to discuss the same example using microservice architecture. The online bookshop application has four modules; Account Service, Book Inventory Service, Order Service, and Shipping Service. This application also has a user interface application, the Shop Front UI web application, which serves user requests and sends responses.

The following diagram illustrates the architecture of the application, which consists of a set of services:

As you can see, we have divided the earlier monolithic bookshop application into several independent services: Account Service, Book Service, Order Service, and Shipping Service. This is a microservices architectural style; according to this approach, we can develop a single application as a suite of small services.

Each service is built around a business capability and is independently deployable into the server. For example, the Account Service manages the customer’s account and has its own database, Account DB. Similarly, the Book Service manages the inventory of the books and has the database Inventory DB. The Order Service manages the customer’s orders using a separate database, Order DB. Finally, the Shipping Service manages shipping orders using the Shipping DB. Each module has its own dependency without depending on other services. This means that we can choose different technologies as well as develop separate services.

The server-side application must handle requests coming from various clients, such as desktop or mobile browsers and native mobile apps. The Shop Front UI web application handles the HTTP requests that come from browsers. Some APIs are exposed to the native mobile app, so the app doesn't call these APIs directly – instead, the app communicates through an intermediary known as an API Gateway. The API Gateway is responsible for handling these requests using load balancing. The API Gateway also offers caching, access control, and API monitoring.

We'll discuss the benefits of the microservice architecture pattern in the following section.

主站蜘蛛池模板: 墨脱县| 杭州市| 文山县| 仁化县| 满城县| 廉江市| 北宁市| 融水| 疏附县| 尖扎县| 蓬溪县| 西城区| 黎川县| 湖州市| 北京市| 临邑县| 惠来县| 台州市| 晋州市| 瑞昌市| 尚义县| 临汾市| 甘谷县| 遂溪县| 金昌市| 汤阴县| 巩留县| 南通市| 承德市| 台中县| 浙江省| 大足县| 崇阳县| 井陉县| 广南县| 西林县| 隆化县| 邳州市| 台东县| 丰都县| 中超|