1. Introduction Micro Services
1.1 What is a micro-service architecture
- Micro Services Architecture is a design style on the system architecture
- Large system to split into N small service
- These small services run in its own thread
- Small service communicates via HTTP protocol
- Has its own data storage, business development, automated testing and deployment mechanism independent
- It can be written in different languages
Summary: The idea of micro-services architecture, not just stay in the development phase, which runs through the design, development, testing, release, operation and maintenance and other software life cycle.
2. System Architecture
Architecture Example:
2.1 micro-service publishing - Continuous Integration
3. Micro Services Architecture nine characteristics
- Of service components
- is separately exchangeable component, upgrading units. Like the PC's memory, the same CPU. - By business organization team
- skills required staff full-stack - Do "product" attitude
- responsible for the entire product life cycle, rather than doing the "Project" attitude delivery - Intelligent endpoint and dumb pipes
- communication between micro service:
--- HTTP API is RESTful
--- MessageMQ message queue- Decentralized governance
- not every problem as a nail, not every solution is a hammer. - Decentralized data management
- independent maintenance of the data storage service, room service as far as possible "no-thing" called by the compensation mechanism for maintaining data consistency problems - Infrastructure Automation
- Automated testing
- Automated Deployment - Fault-tolerant design
- the critical data of each service implementation monitoring and logging components, such as service status, circuit breaker status, throughput, and other network data dashboard - Evolutionary design
- the initial monomer, and gradually split extracting common components
- Decentralized governance
4. Micro Service Selection
-
Dubbo 是阿里多年构建生产级分布式微服务的技术结晶,服务治理能力非常丰富,在国内技术社区具有很大影响力,目前 github 上有超过 16k 星。Dubbo 本质上是一套基于 Java 的 RPC 框架,当当 Dubbox 扩展了 Dubbo 支持 RESTful 接口暴露能力。
-
Dubbo 主要面向 Java 技术栈,跨语言支持不足是它的一个弱项,另外因为治理能力太丰富,以至于这个框架比较重,完全用好这个框架的门槛比较高,但是如果你的企业基本上投资在 Java 技术栈上,选 Dubbo 可以让你在服务框架一块站在较高的起点上,不管是性能还是企业级的服务治理能力,Dubbo 都做的很出色。
- 新浪微博开源的 Motan(GitHub 4k stars)也不错,功能和 Dubbo 类似,可以认为是一个轻量裁剪版的 Dubbo。
5. Spring Cloud 介绍
-
Spring Cloud技术栈提供了分布式系统和微服务中所需要的约大多数公共模块和功能
-
Spring Cloud的出现,可以说是对微服务架构巨大的支持和强有力的后盾
- 使用Spring Cloud就像直接购买品牌机一样,在Spring 社区的整合下,做了大量的兼容性测试,拥有更好的稳定性。
6. Spring Cloud 版本管理
7. Spring Cloud 组件
- 微服务基础
- 微服务构建 Spring Boot
- 服务治理 Spring Cloud Eureka
- 客户端负载均衡 Spring Cloud Ribbon
- 服务容错保护 Spring Cloud Hystrix
- 声明式服务调用 Spring Cloud Feign
- Api网关服务 Spring Cloud Zuul
- 分布式配置中心 Spring Cloud Config
- 消息总线 Spring Cloud Bus
- 消息驱动的微服务 Spring Cloud Stream
- Distributed service tracking Spring Cloud Sleuth