What is a micro-service architecture Spring Cloud?

1 Why micro-services architecture requires Spring Cloud

Briefly, the service of the core is applied according to the traditional stop a service split into a service, and on this basis of micro service to more fully decoupled (not share DB, KV, remove heavyweight ESB), and stressed the DevOps and fast evolution. This requires us to adopt and stop times, different technology stack pan-SOA era, and Spring Cloud is one of the best.

Next we service architecture evolution from the perspective of Spring Cloud and see why more responsive to micro-services architecture.

1.1 Speaking from using nginx

The initial service solutions is to provide the same services to provide a unified domain name and service the caller sends an HTTP request, the request Nginx responsible for the distribution and jump to the domain name.

There are many problems with this architecture:

  • Nginx as an intermediate layer, is coupled in the configuration file of the service invocation logic, which impairs the integrity of the micro and services, but also makes Nginx into a heavyweight ESB some extent.

  • Information services scattered in various systems, can not be unified management and maintenance. Every service call is the first attempt, consumers do not know which service instances to provide them with services. This is not in line with the concept of DevOps.

  • We can not visually see the service providers and service consumers current health and communication frequencies. This is not in line with the concept of DevOps.

  • Consumers retransmission failure, load balancing and so there is no uniform policy, which increased the difficulty of development of each service, is not conducive to rapid evolution. 

In order to solve the above problems, we need a central component ready for service integration, the summary information for each service, including the service component name, address and quantity. The caller services to provide this service to obtain information first instance (IP, port, etc.) when requested by a service center component, and then select a provider for the service via policy default or custom direct access. So, we introduced Dubbo.

1.2 Based on Dubbo achieve microService

Ali Dubbo is a open source SOA service management solutions, rich document, use of the country is very high.

Dubbo built using micro-services, it may have been a better solution to the problem mentioned above:

  • Call the middle layer becomes optional components, consumers can directly access the service provider.

  • Service information is concentrated in the Registry, formed a central component of service governance.

  • By Monitor monitoring system, you can visually display statistical information service call.

  • Consumer can perform load balancing, service degradation choice.

But for the micro-architecture in terms of service, Dubbo also not perfect:

  • Registry relies heavily on third-party components (zookeeper or redis), when these components there is a problem, a service call will soon be interrupted.

  • DUBBO only support RPC calls. Enables service providers and the caller had a strong reliance on the code, service providers need to continue to contain the common code out of the jar package packaged for consumer use. Once the packaging problem, it will result in a service call error.

  • Most importantly, DUBBO now has stopped maintenance, the demand for new technology development, the need to expand the upgrade by the developers themselves. Which for many small and medium software organizations that want to micro-service architecture, it is clearly not appropriate.

1.3 the best choice --Spring Cloud

As a new generation of service framework, Spring Cloud slogan put forward is to develop "cloud-oriented applications environment", which provides a more comprehensive technical support service for the micro-architecture.

Clearly, Spring Cloud is more powerful than DUBBO, wider coverage, but also as Spring fist project, it is also possible, Spring Boot, Spring Data, Spring Batch Spring and other items perfect integration with the Spring Framework, these services for micro It is crucial.

As mentioned earlier, an important micro-services behind the concept is continuous integration, fast delivery, and the use of a unified internal services in the technical framework, with clearly more efficient than the technology portfolio to disperse. More importantly, compared to Dubbo, it is an ongoing maintenance, more fiery community open source project, which uses the system to ensure that it is built, can continue to be supported by the power of open source.

2 Spring Cloud Technology Overview

Service Governance: This is the core of Spring Cloud. Currently Spring Cloud mainly realized through the integration of Netflix related products function in this regard (Spring Cloud Netflix), including Eureka for service registration and discovery, calling breaker Hystrix, call end load balancing Ribbon, Rest client Feign, intelligence service Spectator routing Zuul, for monitoring and display of the data collection, Servo, Atlas, and for providing configuration read Archaius RxJava Controller Reactive encapsulation layer.

  • Distributed Link Monitoring: Spring Cloud Sleuth provides a fully automated, configurable embedded data points to collect performance data on the micro-service call link, and sent Zipkin storage, and display statistics.

  • Message component: Spring Cloud Stream demand for a variety of distributed messaging abstracts, including publication subscriptions, consumer groups, message fragmentation functions, to achieve asynchronous communication between the micro-services. Spring Cloud Stream also integrates third-party Apache Kafka as RabbitMQ and implement a message queue. The Spring Cloud Bus-based Spring Cloud Stream, the main provider of event communication between services (such as refresh configuration).

  • Configuration Center: Based on Spring Cloud Netflix and Spring Cloud Bus, Spring also provides a Spring Cloud Config, to achieve a centralized configuration management, dynamic refresh the concept of distribution center. Configured to store or simply by Git file, supports encryption and decryption.

  • Safety Control: Spring Cloud Security based on safety standards OAUTH2 this open network, providing a single sign-on service in the micro-environment, resource authorization, token management.

  • Command-line tool: Spring Cloud Cli provides a way to command line and scripting way to manage micro services and Spring Cloud components.

  • Cluster tools: Spring Cloud Cluster provides cluster selected from primary, distributed lock (not yet implemented), time token (Write implemented), etc. Distributed clustering technology required components.

 

Guess you like

Origin www.cnblogs.com/fengyun2050/p/12601507.html