1. Current situation and future of microservices

1. Evolution of service architecture

1.1 Single Architecture

The single architecture should be the first architecture implementation we touch. In the single architecture, we use the classic three-tier model, namely the presentation layer, the business logic layer and the data access layer.

Single architecture is only suitable for early application, and under the situation of traffic comparison, the advantages are high cost performance, fast development speed, low cost, but the disadvantages are also obvious, at this time, the first extension is to consider the server cluster processing.

1.2 the cluster

For a single server in the increasing volume of traffic more and more difficult situation, we can consider the cluster of the server processing.

The deployment of the cluster greatly improves the processing power of the service, while taking advantage of the load balancing mechanism provided by Nginx to distribute requests without changing the user experience.

1.3 the distance

The above cluster deployment can solve part of the server pressure, but with the increase of user visits, cluster nodes increase to a certain stage, in fact, the effect is not too big, because all services are concentrated together, resulting in a high degree of coupling, then we can consider the split of services. To improve system performance. For example, the original in a system inside the business split into the user system, order system and commodity system. That is, we talk about the vertical split as follows:

Service vertical split can greatly improve the overall service processing capacity, but there will also be a lot of redundant code, such as the user system to operate order base, to operate commodity base, order system may also need to operate user base and commodity base.

1.4 Servitization The problem with vertical splitting comes up with what we often hear about as SOA(Service-oriented Architecture). What is SOA? This is described in Microservices Design

SOA is a design approach that consists of multiple services that work together to provide a set of functions. A service usually exists as an independent operating system process, and the services communicate through network calls rather than in-process calls.

Business reuse, shared services,

1.5 Microservitization

Continuing to evolve on top of SOA is what we’re talking about in terms of microservices. The more granular fragmentation of SOA services is known as microservices. By time.

Requirements for basic operation and maintenance capabilities will become higher and higher, such as virtualization, container words, and so on.

Differences between Microservices and SOA:

1. Ideologically: The purpose of microservices is to decouple, while the purpose of SOA is to realize the interoperability and sharing of data.

2. Protocol: Microservices use lightweight communication protocols (Restful apis)

3. Infrastructure requirements, microservices are more focused on continuous delivery of development operations.

2. Requirements for microservices architecture

2.1 RPC framework

In a microservice architecture, the invocation of interfaces between services must be implemented through the Remote Procedure Call (RPC) framework.

Common RPC frameworks are :Dubbo,Google’s GRPC, Apache’s Thrift, Weibo’s Motan, JD.com’s EasyRPC and so on. We can use the RPC framework to retrieve the service provided by the invocation service provider, but only if we can find the service. Often our service deployments are clustered multi-node deployments, so it is not possible to write directly in code on the consumer side, which is where service discovery comes in, and another component registry is needed

2.2 Registry

The registry implements the function of service address management and solves the dynamic awareness of service (online and offline).

2.3 Load Balancing

We see the application of load balancing in the introduction to service registries. The Ribbon can be used to implement load balancing for clients. Load balancing strategies can be: polling, random, polling based on response time, etc.

2.4 Configuration Center

In a microservice architecture we have many services, and each service has a separate profile. There are a lot of configuration information associated, and for the later update and maintenance will be very inconvenient, then the configuration center will play. Commonly used configuration center: Apollo/Nacos/disconf/zookeeper/diamond/Spring Cloud Config

2.5 the gateway

Gateway can help us complete the user request entry, routing. Complete unified authorization, log recording, permission authentication, traffic limiting and fusing operations.

2.6 Traffic limiting, degradation, and Caching

Performance in a real-world microservice architecture is difficult to meet all user requests, so there are steps we can take to keep our core services running.

Flow limiting: Sentinel and Hystrix

Downgrade: active downgrade (order review, ads closed), passive downgrade

Cache: reduce data source access frequency, Redis, etc

Fault tolerant mechanism: the processing mechanism after the service hangs up or breaks down.

2.7 Bus

Bus Message Bus, which implements asynchronous communication mechanism.

2.8 Link Monitoring

Because there are so many services in microservices, in order to better monitor the situation of each service, link monitoring service is definitely needed. We can use Sleuth + Zipkin to achieve this, application layer monitoring and system level monitoring

3. SpringCloud ecology

The SpringCloud ecosystem provides technical components to quickly build microservices. Spring. IO/projects/sp…

3.1 Version Description

  • SR (release)
  • RC (later releases)
  • M1/M2 (PRE) milestone
  • The GA stable version
  • The BUILD – XXX development version

3.2 Association Between SpringCloud and SpringBoot

Large version corresponds to:

In the actual development process, we need a more detailed version of:

The SpringCloud version is associated with SpringBoot, which can be viewed in the official website:Docs. Spring. IO/spring – clou…

By now, we also know that SpringBoot is a prerequisite for learning the relevant components in SpringCloud.

Read three things ❤️

If you found this post helpful, I’d like to invite you to do three small favors for me:

  1. Likes, retweets, and your “likes and comments” are what drive me to create.

  2. Follow the public account “Java rotten pigskin”, irregularly share original knowledge.

  3. 【666】 Scan the code to get the learning materials package

  4. At the same time, look forward to the following article ing🚀