. NET Core practice: Advantages of the microservice architecture,. netcore

Source: Internet
Author: User

. NET Core practice: Advantages of the microservice architecture,. netcore

Microservices are now the preferred cloud architecture component for various Internet applications. Both BAT, Didi, and Meituan are important components.

Compared with microservices, traditional application architectures have the following Disadvantages:

1. The business code is mixed, the team members have unclear responsibilities and boundaries, the team collaboration experience is poor, and the development efficiency is low.

In the traditional application architecture, the code of each business module exists in the same application. The interaction logic of each business module is complex, and the code is mixed together. It is inevitable that the Code should be changed in other people's code.

2. High code coupling, increasingly bloated, difficult to refactor, and increasing maintenance costs.

Have you ever felt the fear of being dominated by F12?

3. Weak fault tolerance, and a single point of failure causes a global crash.

4. resources cannot be added to hotspot services, resulting in waste.

 

Overview of typical microservice Architecture

 

The microservice architecture separates applications into several parts based on functions and services, so that each part is unbound. A typical simple microservice architecture consists of at least the following parts:

1. UI Layer: the front-end visual layer, including web pages, mobile apps, and PC clients.

2. Gateway layer: similar to the router used in our home, the gateway layer can redirect inbound requests to the target as a service, and integrate and package the on-site microservices to output them to the outside of the site. The UI Layer generally accesses the interface exposed by the gateway to the public network through the HTTP/HTTPS protocol. In addition, the gateway should also have the authentication function.

3. reverse Proxy: a Reverse Proxy is used to receive connection requests from the internet from the Proxy server, and then forward the requests to the server on the internal network, return the result obtained from the server to the Client Requesting connection from the internet. The proxy server is displayed as a server. An intelligent virtual network formed by placing reverse proxy node servers in various parts of the network on the basis of the existing Internet, the CDN system can redirect users' requests to the nearest service node in real time based on the network traffic and connection, load status, distance to the user and response time of each node..

4. microservice cluster: depending on your needs, a microservice cluster contains at least one microservice instance and distributes requests to each instance through Server Load balancer. If Docker Container Service is used, the microservice cluster contains at least one Docker instance. In combination with load balancing, We can dynamically decide how many Docker instances to enable, and destroys redundant instances when they are not needed to provide fully automated Elastic Computing capabilities.

5. Interoperability: HTTP/HTTPS or RPC is generally used between microservices to serialize objects using JSON or ProtoBuf. Because microservices are deployed in the same intranet, the performance loss is negligible. If RPC + ProtoBuf is used, the latency will be lower.

The microservice architecture also has some shortcomings:

1. microservices emphasize the small scale of services to facilitate service scaling and expansion. However, this will also lead to service fragmentation and pose a challenge to personnel management.

2. microservice is a distributed system. Every microservice has its own database. Although it increases the overall reliability of applications to a certain extent, it also inevitably brings about a large amount of redundant data.

3. as the service grows, the number of microservice instances will grow rapidly. For example, NetFlix, a famous online TV website in the United States, has approximately 600 microservice instances, in addition, the number is constantly increasing. The O & M program of microservices will keep increasing.

4. for services with complex business logic, a single call may be related to dozens or even dozens of interfaces. To meet performance requirements, we have to introduce a notification system to process some content asynchronously. Asynchronous processing brings about data consistency.

 

The above is the content of this chapter. If you have any questions, please do not give me any further advice.

In the next chapter, I will use an example to analyze the advantages and disadvantages of synchronous and asynchronous execution.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.