First, the basic component summary
1, read the article directory
1), the base component
Eureka components, service registration and discovery
Ribbon and Feign components, load balancing
Hystrix components, to achieve service fuse
Turbine components, to achieve micro-cluster monitoring service
Zuul components to implement routing gateway control
Config components, to achieve unified management configuration
Zipkin assembly, to achieve tracking request links
2), Applications
Based Shard-Jdbc sub-library sub-table, database expansion program
Expansion based on sub-library sub-table SpringCloud achieve the Shard-Jdbc
3), subsequent updates
The case is mainly based on SpringCloud2 version, application demos micro-services in the actual development.
<modules>
<!-- 客户端接口层 -->
<module>storey-client-web</module>
<!-- 公共代码块层 -->
<module>storey-block-code</module>
<!-- 中间件管理层 -->
<module>storey-middle-soft</module>
<!-- 数据 中 心层 -->
<module>storey-data-center</module>
<!-- 微服务组件层 -->
<module>storey-cloud-ware</module>
</modules>
Available version
- Spring: 5.0+
- SpringBoot: 2.0+
- SpringCloud: 2.0+
2, the concept of common components
- Eureka components
Eureka is a REST-based services, mainly for AWS cloud for location services for load balancing and failover server of the intermediate layer. This service is called EurekaServer. Client component EurekaClient, it makes it easier to interact with the service.
- Ribbon and Feign components
Ribbon is a client load balancing (Load Balancer, referred to as LB), which provides access control for a large number of HTTP and TCP clients.
Feign Web Service client is a declarative. It appears the development of Web Service client becomes very simple. Using Feign only need to create an interface coupled with corresponding annotations, such as: @FeignClient interface class notes.
- Hystrix components
When a service fails micro-micro-service architecture, to quickly cut off the service, the user is prompted, subsequent requests, do not call the service directly back, free up resources, this is the service fuse.
- Turbine Components
Micro-service architecture in order to ensure the availability of a program to prevent the program error leading to network congestion, there has been a circuit breaker model. The reaction conditions breaker availability and robustness of the program, which is an important indicator. HystrixDashboard as a component of the state of the circuit breaker, a data monitoring and intuitive graphical interface.
- Zuul components
Zuul main gateway to provide dynamic routing, monitoring, resiliency, security management and control functions. In a distributed system, the micro-service system for a plurality of micro-split service modules, to route the user's request through a gateway zuul forwarded to the specific micro-services module.
- Config components
In the micro-service system, the more services, the same configuration: Database information such as, cache, and other parameters, will appear on a different service, if a configuration change occurs, you need to modify a lot of service configuration. spring cloud provides configuration center, to solve this problem scene.
- Zipkin components
Zipkin is a component SpringCloud micro-service system, to achieve a link tracking solution. A request can be positioned in the end what specific service request. In a complex micro-services system, if requested exception occurs, you can quickly capture service where the problem lies.
Two, Boot contrast Cloud
SpringBoot focused on the rapid development of a single micro-services. SpringCloud is concerned about the global micro-services coordination framework, it will SpringBoot develop integrated single micro-management services, and to provide service between micro, configuration management, service discovery, circuit breakers, and other integrated services routing gateway, SpringCloud rely SpringBoot.
Three, Dubbo contrast Cloud
1, is called contrast
Dubbo way service invocation and Spring Cloud is an important difference, familiar with RPC / HTTP / REST concepts to help contrast Dubbo and SpringCloud. RPC is a remote procedure call, which call transfer protocol and protocol typically comprises encoding protocol. RPC calls are for package services, availability and efficiency for the service so do the optimization. http hypertext transfer protocol, RPC can also use http as the transport protocol, but is generally used as the transport protocol tcp.
2, execution performance comparison
Dubbo single long connection and NIO asynchronous communication (stay connected / polling process), use a custom TCP protocol packets, and use custom serialization Hessian2 framework, suitable for small amount of data concurrent service call, as well as consumer services when the number of machines is much greater than the number of service providers machines, but not for big data transmission service call. Spring Cloud directly using the HTTP protocol, Dubbo weaker in performance.
3, contrast registry
Here usually refers contrast ZooKeeper (Dubbo registry) and Eureka (Cloud registry) of. Distributed famous field theory CAP (C: data consistency, A: service availability, P: fault tolerance partition failure), Zookeeper ensure that the CP, but for service discovery, the availability of data is more important than consistency, AP better than CP, and Eureka is designed to follow the principles of AP.
4, the frame comparison Eco
Dubbo focus on RPC service and governance, Spring Cloud service is a micro-ecological architecture.
Fourth, the source address
GitHub地址:知了一笑
https://github.com/cicadasmile/spring-cloud-base
GitEE地址:知了一笑
https://gitee.com/cicadasmile/spring-cloud-base