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

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.

主站蜘蛛池模板: 雅江县| 横峰县| 海阳市| 扶余县| 安宁市| 景谷| 嘉兴市| 庆云县| 紫金县| 乐都县| 永和县| 柘城县| 织金县| 龙陵县| 自贡市| 鹤庆县| 修文县| 那坡县| 汉寿县| 涟源市| 吕梁市| 若羌县| 台江县| 平潭县| 盘山县| 镇沅| 南丰县| 屏东县| 福贡县| 合山市| 康乐县| 恩平市| 麦盖提县| 茌平县| 甘孜县| 上杭县| 安宁市| 贡山| 依安县| 攀枝花市| 东丰县|