微服务简介

最近,微服务这个概念越来越流行,很多企业开始选择微服务作为自己新的架构。

那么,什么是微服务呢?

我们先来看一下架构大神martin fowler对微服务的解释。

The term "Microservice Architecture" has sprung up over the last few years to describe a particular way of designing software applications as suites of independently deployable services.

While there is no precise definition of this architectural style, there are certain common characteristics around organization around business capability, automated deployment,

intelligence in the endpoints, and decentralized control of languages and data.

在这里我需要给英文不好的朋友解释一下,其实总结下来,就这么几个关键字。

1. 微服务是系统架构上的一种设计风格

2. 它将一个独立的系统拆分成多个小型的服务,每个服务都可以独立部署

3. 去中心化

4. 服务之间通过RESTful API进行通信协作

 

微服务的好处:

1. 为了解决单体系统变臃肿之后难以维护的问题

2. 将系统拆分成不同的模块,每个服务能独立部署和扩展,由于每个服务都运行在自己的进程内,其更新

    不会影响其他服务的运行

3. 由于每个服务是独立部署的,我们可以更准确地位每个服务评估性能容量,更准确地发现服务与服务之间,以及系统中的瓶颈位置

 

由于微服务的架构根据每个公司或个人不同而不同,并没有非常通用的统一标准,但是,下面的九大特性在大家架构为服务时,起到一定的指导作用。

 

1. 服务组件化(Componentization via Services)

  组件可以独立更换和升级

 

2. 按业务组织团队(Organized around Business Capabilities)

  而不是以往的按技术层面(DBA, 运维, 后端, 前端)

 

3. 做产品的态度(Products not Projects)

  需要用做产品的态度来对待每一个微服务

  you build, you run it

 

4. 智能端点和哑通道(Smart endpoints and dumb pipes)

  由于服务不在一个进程中,互相间的通信必须简单高效

 通常两种服务调用方式:

 1) Http RESTful API

 2) 轻量级消息总线(RabbitMQ, Kafka)

 

5. 去中心化治理(Decentralized Governance)

 

6. 去中心化管理数据(Decentralized Data Management)

  把原本存储在MySql中的表拆分后,存储到多个不同的MySql实例中

 

7. 基础设施自动化(Infrastructure Automation)

 

8. 容错设计(Design for failure)

 

9. 演进式设计(Evolutionary Design)

 

posted @ 2017-08-23 22:45  Master HaKu  阅读(864)  评论(0编辑  收藏  举报