Martin Fowler:简而言之,微服务架构风格这种开发方法,是以开发一组小型服务的方式来开发一个独立的应用系统的。其中每个小型服务都运行在自己的进程中,并经常采用HTTP资源API这样轻量的机制来相互通信。这些服务围绕业务功能进行构建,并能通过全自动的部署机制来进行独立部署。这些微服务可以使用不同的语言来编写,并且可以使用不同的数据存储技术。对这些微服务我们仅做最低限度的集中管理。
微服务具备的特性
1. 每个微服务可独立运行在自己的进程里;
2. 一系列独立运行的微服务共同构建起了整个系统;
3. 每个服务为独立的业务开发,一个微服务一般完成某个特定的功能,比如:订单管理、用户管理等;
4. 微服务之间通过一些轻量的通信机制进行通信,例如通过REST API或者RPC的方式进行调用。
微服务优点
- 易于开发和维护
- 启动较快
- 局部修改容易部署
- 技术栈不受限
- 按需伸缩
- DevOps
微服务带来的挑战
- 运维要求较高
- 分布式的复杂性
- 接口调整成本高
- 重复劳动
微服务设计原则
- 单一职责原则
- 服务自治原则
- 轻量级通信原则
- 接口明确原则
Martin Fowler: In short, Microsoft Architecture Style is a way to develop an independent application system by developing a set of small services. Each small service runs in its own process and often uses lightweight mechanisms such as HTTP resource API to communicate with each other. These services are built around business functions and can be deployed independently through a fully automated deployment mechanism. These microservices can be written in different languages and can use different data storage technologies. We only manage these micro services centrally at a minimum.
Characteristics of Micro Services
1. Each micro-service can run independently in its own process.
2. A series of independent micro-services construct the whole system together.
3. Each service is an independent business development. A micro-service usually completes a specific function, such as order management, user management, etc.
4. Microservices communicate with each other through lightweight communication mechanisms, such as REST API or RPC.
Advantages of Micro Services
Easy to develop and maintain
Start faster
Local modifications are easy to deploy
Technology stack is unrestricted
Telescopic on demand
DevOps
Challenges posed by microservices
Higher requirements for operation and maintenance
Distributed complexity
High cost of interface adjustment
Repetitive labor
Design Principles of Micro Services
Principle of Single Responsibility
Principle of Service Autonomy
Lightweight Communication Principles
Principle of Clear Interface