> For the complete documentation index, see [llms.txt](https://aaronice.gitbook.io/system-design/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://aaronice.gitbook.io/system-design/distributed-systems/microservices-architecture.md).

# 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-修改版-极客时间-图片-杨波-微服务架构.pdf)

> ![](/files/-M63nS2DlWMN1diVtL03)

## 微服务的利和弊

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

## 康威定律 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>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://aaronice.gitbook.io/system-design/distributed-systems/microservices-architecture.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
