# Microservices Architecture

## 微服务定义

### 微服务定义（⼀）

Martin Fowler

* ⼀种架构⻛格，将单体应⽤划分&#x6210;**⼀组⼩的服务**，服务之间相互协作，实现业务功能&#x20;
* 每个服务运⾏在**独⽴的进程中**，服务间采⽤**轻量级的通信机制**协作（通常是HTTP/ JSON）
* 每个服务**围绕业务能⼒进⾏构建**，并且能够通过⾃动化机制**独⽴地部署**
* 很少有集中式的服务管理，每个服务可以使⽤不同的语⾔开发，使⽤不同的存储技术

### 微服务定义（⼆）

Adrian Cockcroft

* Loosely coupled service oriented architecture with bounded context 基于有界上下⽂的，松散耦合的⾯向服务的架构

## 微服务的适⽤性

Source: [杨波 微服务架构 pdf](https://static.geekbang.org/PDF-%E4%BF%AE%E6%94%B9%E7%89%88-%E6%9E%81%E5%AE%A2%E6%97%B6%E9%97%B4-%E5%9B%BE%E7%89%87-%E6%9D%A8%E6%B3%A2-%E5%BE%AE%E6%9C%8D%E5%8A%A1%E6%9E%B6%E6%9E%84.pdf)

> ![](https://2172869002-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M63nDeRq0OluA2VzyJc%2Fsync%2F64b385524ce1a4f36a236adebf328aefe9ebf6fc.png?generation=1588144771854035\&alt=media)

## 微服务的利和弊

| 利      | 弊        |
| ------ | -------- |
| 强模块化边界 | 分布式系统复杂性 |
| 可独⽴部署  | 最终⼀致性    |
| 技术多样性  | 运维复杂性    |
|        | 测试复杂性    |

## 康威定律 Conway's law

Organizations which design systems … are constrained to produce designs which are copies of the communication structures of these organizations.

设计系统的组织，其产⽣的架构设计等价于组织间的沟通结构

## Microservice Pattern Language

<https://microservices.io/i/MicroservicePatternLanguage.pdf>

## Reference

<https://microservices.io/>

<https://www.martinfowler.com/articles/microservices.html>

<https://microservices.io/i/MicroservicePatternLanguage.pdf>
