购买
下载掌阅APP,畅读海量书库
立即打开
畅读海量书库
扫码下载掌阅APP

1.3 什么是微服务

就目前来看,微服务本身并没有一个严格的定义,每个人对微服务的理解都不同。Martin Fow ler在他的博客中是这样描述微服务的。

In short,them icroservice architectural style is an approach to developing a single application as a suite of small services,each running in itsown process and communicating with lightweight mechanisms,often an HTTP resource API.These services are built around business capabilities and independently deployable by fully automated deployment machinery.There is a barem inimum of centralized management of these services,which may be written in different programming languagesand use different data storage technologies.

用中文表述就是,微服务架构风格是一种将一个单一应用程序开发为一组小型服务的方法,每个服务运行在自己的进程中,服务间通信采用轻量级通信机制(通常用HTTP资源API)。这些服务围绕业务能力构建并且可通过全自动部署机制独立部署。这些服务共用一个最小型的集中式的管理,服务可用不同的语言开发,使用不同的数据存储技术。

从中可以看到,微服务架构应具备以下特性:

●每个微服务可独立运行在自己的进程里。

●一系列独立运行的微服务共同构建起整个系统。

●每个服务为独立的业务开发,一个微服务只关注某个特定的功能,例如订单管理、用户管理等。

●微服务之间通过一些轻量的通信机制进行通信,例如通过RESTfulAPI进行调用。

●可以使用不同的语言与数据存储技术。

●全自动的部署机制。

还是以电影售票系统为例,使用微服务来架构该应用,架构图如图1-2所示。

img

图1-2 电影售票系统微服务架构示意图

将整个应用分解为多个微服务,各个微服务独立运行在自己的进程中,并分别有自己的数据库,微服务之间使用REST或者其他协议通信。

img

Martin Fowler《微服务》博客原文: http://www.martinfow ler.com/articles/microservices.html ,译文: http://blog.cuicc.com/blog/2015/07/22/m icroservices/ . io3EyXILWdDloLCwHBUgiko/1ZoXB6pJPeAuD1qkgM8iUYG28EXmeZ3wlHpozX+A

点击中间区域
呼出菜单
上一章
目录
下一章
×