First, micro Services Architecture
1, micro Services Architecture Overview
1.1 Distributed: different functional modules deployed on different servers, reduce the pressure on the site to bring high concurrency.
1.2, the cluster: a cluster deploy the same application configuration on multiple servers, load balancing together by outward to provide services.
1.3, Micro services: micro-services architecture model is to be split into a series of small web application service modules that can be independently compile, deploy, and their communication through the API interface exposed, together make up a web application.
1.4, SpringCloud is based on a set of micro-services framework SpringBoot, providing a range of configurable components, such as configuration management , service discovery , load balancing , fuses , circuit breakers , intelligent routing , micro broker , a control bus , a global lock , decision-making campaign , distributed session and cluster status management and so on.
2, micro-service features
- Single Responsibility: Each service module corresponds to a single business to achieve
- Micro: small particle size split service
- Service-oriented: each service is only exposed External Services Interface API you can, do not care about technology services, regardless of technology, language and platform
- Autonomy: room service independent of each other without disturbing each other
- Independent team
- Independent technology: Provides Rest interfaces, service-oriented to
- Separate front and rear ends
- Database Separation: Each service uses its own data sources
- Deployment is independently: each service is independent components, reusable, alternatively, reduce the coupling between services,
3, the three relations
Micro service is a structural concept, design principles, provide theoretical guidance;
Spring Boot focus on fast, easy integration of a single individual micro-services, based on Spring Boot quickly develop a single micro services;
Spring Cloud is a service-based tool Spring Boot achieve governance package, focused on serving the global governance framework.
二、Spring Cloud
1, Spring Cloud Component Architecture
Figure above components and processes run the components as follows:
-
- All requests to access internal services through the API Gateway;
- After the gateway receives requests to obtain available services module from the registry;
- After balancing the load Ribbon, specific examples of the distribution of the background;
- Between each service module through the communication processing service Feign;
- Hystrix responsible for handling service timeout fuse;
- Blown call and related indicators among Turbine monitoring service.
Let's look at Spring Cloud service process on a specific example:
2, Spring Cloud components Introduction
2.1 Introduction to major components
- Eureka, the service registry
- Zuul, API Gateway service
- Config, distributed configuration center, support local warehouse, SVN, Git, and other models in the Jar package configuration
- Dashboard, Hystrix dashboard, monitoring trunked mode and single mode, which mode requires the cluster with the collector Turbine
- Ribbon, client load balancing
- Feign, declarative service call
- Bus, message bus
2.2, the main function of the components
Eureka and Ribbon, a registrar, a consumer services.
Hystrix, in order to optimize Ribbon, prevent the entire micro-services architecture as a service node issues cause crashes, it acts as a fuse.
Dashboard, to Hystrix with statistics and display, and monitor overall service node pressure and health.
Turbine, cluster collector, serving the Dashboard.
Zuul, plus at the forefront of the whole micro-firewall and proxy services, a hidden micro-service node IP port information, strengthen security.
Config, in order to solve all their micro service maintains its own configuration, set up a unified configuration center, easy to modify the configuration.
Bus is because each node must refresh to finish modifying the configuration take effect after config is too much trouble, so be notified to the bus service node refresh configuration.