. NET Core Practices: The benefits of a microservices architecture

Source: Internet
Author: User
Tags node server

MicroServices are now the preferred cloud architecture component for a wide range of Internet applications, whether it's BAT or drip, or a group of micro services.

Compared to microservices, traditional application architectures have the following drawbacks:

1. The business code is mixed, the team members ' responsibilities are not clear, the team experience is poor and the development is inefficient.

In the traditional application architecture, the code of each business module exists in the same application, the interaction logic between each business module is complex, the code is mixed together, it is unavoidable to change the code in someone else's code.

2. Code coupling is high, becoming bloated, difficult to reconstruct, and the maintenance cost is more and more high.

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

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

4. Unable to increase resources for hot business, resulting in waste.

Overview of typical microservices architectures

The microservices architecture separates the application into several parts by function and business, freeing the parts from each other. A typical simple microservices architecture has at least the following parts:

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

2. Gateway Layer: Gateway layer similar to our home use of routers, can redirect inbound requests to the target service, and the site of the micro-services to consolidate packaging output out of the station. The UI layer typically accesses the interface exposed by the gateway to the public through the HTTP/HTTPS protocol. In addition, the gateway should also have authentication capabilities.

3. Reverse Proxy: Reverse proxy (Reverse proxy) means that the proxy server accepts connection requests on the Internet, then forwards the request to a server on the internal network and returns the results from the server to the client requesting a connection on the Internet. At this point the proxy server is represented as a server externally. By placing the reverse Proxy node server in the network, a layer of intelligent virtual network based on the existing Internet, the CDN system can re-direct the user's request to the service node closest to the user according to the network traffic and the connection of each node, the load condition and the distance and response time of the user.

4. microservices clusters: Depending on the requirements, there will be at least 1 microservices instances in the MicroServices cluster, with load balancing to allocate requests to each instance. If you use the Docker container service, there is at least one Docker instance in the MicroServices cluster, with load balancing, we can dynamically decide how many Docker instances to enable and destroy redundant instances when not needed, providing fully automated elastic computing power.

5. Interoperability: Between microservices generally choose Http/https or RPC as an interop protocol, using JSON or PROTOBUF to serialize objects. Since microservices are deployed in the same intranet, performance loss can be negligible, and if RPC + protobuf interaction is chosen, the latency will be lower.

There are a few deficiencies in the MicroServices architecture:

1. MicroServices first emphasize the small scale of services and ease of scaling and expansion of services, but this can also lead to fragmentation of services and challenges to personnel management.

2. MicroServices are a distributed system, each of which has its own database, although to a certain extent increases the overall reliability of the application, but also inevitably brings a lot of redundant data.

3. As the scale of services grows, the number of instances of microservices will grow rapidly, such as NetFlix, the famous American online television website, with about 600 instances of microservices, and this number is growing. The operation and maintenance of micro-services will continue to climb.

4. For businesses with complex business logic, one call may be related to more than 10 or even dozens of interfaces, and in order to meet performance requirements we have to introduce a notification system to handle some of the content asynchronously. Asynchronous processing immediately leads to data consistency issues.

The above is the contents of this chapter, if you have a little to fool, but also please enlighten.

In the next chapter I will analyze the pros and cons of synchronous execution and asynchronous execution through an example.

. NET Core Practices: The benefits of a microservices architecture

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.