云设计模式-Design patterns for microservices
云设计模式
https://azure.microsoft.com/zh-cn/blog/design-patterns-for-microservices/
https://www.cnblogs.com/viaiu/p/10011376.html
The AzureCAT patterns & practices team has published nine new design patterns on the Azure Architecture Center. These nine patterns are particularly useful when designing and implementing microservices. The increased interest in microservices within the industry was the motivation for documenting these patterns.
The following diagram illustrates how these patterns could be used in a microservices architecture.
MSA patterns
For each pattern, we describe the problem, the solution, when to use the pattern, and implementation considerations.
Here are the new patterns:
Ambassador can be used to offload common client connectivity tasks such as monitoring, logging, routing, and security (such as TLS) in a language agnostic way.
Anti-corruption layer implements a façade between new and legacy applications, to ensure that the design of a new application is not limited by dependencies on legacy systems.
Backends for Frontends creates separate backend services for different types of clients, such as desktop and mobile. That way, a single backend service doesn’t need to handle the conflicting requirements of various client types. This pattern can help keep each microservice simple, by separating client-specific concerns.
Bulkhead isolates critical resources, such as connection pool, memory, and CPU, for each workload or service. By using bulkheads, a single workload (or service) can’t consume all of the resources, starving others. This pattern increases the resiliency of the system by preventing cascading failures caused by one service.
Gateway Aggregation aggregates requests to multiple individual microservices into a single request, reducing chattiness between consumers and services.
Gateway Offloading enables each microservice to offload shared service functionality, such as the use of SSL certificates, to an API gateway.
Gateway Routing routes requests to multiple microservices using a single endpoint, so that consumers don't need to manage many separate endpoints.
Sidecar deploys helper components of an application as a separate container or process to provide isolation and encapsulation.
Strangler supports incremental migration by gradually replacing specific pieces of functionality with new services.
The goal of microservices is to increase the velocity of application releases, by decomposing the application into small autonomous services that can be deployed independently. A microservices architecture also brings some challenges, and these patterns can help mitigate these challenges. We hope you will find them useful in your own projects. As always, we greatly appreciate your feedback.
说到设计模式,大家一般会想到,工厂、单例等24种基本设计模式,当然也会想到并发型模式,生产-消费者模式,线程池模式等,但是微服务中用到什么设计模式了?前两篇介绍了,挎斗模式和代表模式,当然这一类设计模式属于云设计模式。AzureCAT模式和实践团队在Azure架构中心发布了九种新的设计模式。在设计和实现微服务时,这九种模式特别有用。微服务越来越变的流行是记录这些模式的动机。
下图说明了如何在微服务架构中使用这些模式:
对于每种模式,我们都会描述问题,解决方案,何时使用模式以及实现注意事项。
Ambassador(代表模式) 可用于以一种与语言无关的方式卸载常见客户端连接任务,如监视、记录、路由、安全(如 TLS)。
Anti-corruption layer (防损层模式) 实现了新旧应用程序之间的外观,以确保新应用程序的设计不受遗留系统依赖性的限制。使用此模式可确保应用程序的设计不受限于对外部子系统的依赖。 此模式最先由 Eric Evans 在 Domain-Driven Design(域驱动的设计)中描述。
Backends for Frontends (用于前端的后端模式) 创建单独的后端服务,供特定的前端应用程序或接口使用。 要避免为多个接口自定义一个后端时,此模式十分有用。后端为不同类型的客户端(如桌面和移动设备)创建单独的后端服务。这样,单个后端服务不需要处理各种客户端类型的冲突要求。通过分离客户特定的问题,这种模式可以帮助保持每个微服务的简单性。
Bulkhead(隔舱模式)之所以称为“隔舱”(Bulkhead),是因为它类似于船体的分段区。 如果船体受到破坏,只有受损的分段才会进水,从而可以防止船只下沉。为每个工作负载或服务隔离关键资源,例如连接池,内存和CPU。通过使用隔板,单个工作负载(或服务)无法消耗所有资源,使其他资源匮乏。此模式通过防止由一个服务引起的级联故障来提高系统的弹性。
Gateway Aggregation(网关聚合模式)使用网关可将多个单独请求聚合成一个请求。 当客户端必须向不同的后端系统发出多个调用来执行某项操作时,此模式非常有用使用网关可将多个单独请求聚合成一个请求。 当客户端必须向不同的后端系统发出多个调用来执行某项操作时,此模式非常有用。
Gateway Offloading(网关卸载方式)将共享或专用服务功能卸载到网关代理。 此模式可以通过将共享服务功能(如 SSL 证书的使用)从应用程序的其他部分移动到网关,简化应用程序开发。
Gateway Routing(网关路由模式)使用单个终结点将请求路由到多个服务。 如果希望在单个终结点上公开多个服务,并根据请求路由到适当的服务,则此模式非常有用。
Sidecar(挎斗模式 )将应用程序的帮助程序组件部署为单独的容器或进程,以提供隔离和封装。使用此模式还可以使用异构组件和技术来构建应用程序。
Strangler(绞杀者模式)通过将特定的功能片断逐渐取代为新的应用程序和服务,逐步迁移旧系统。 随着旧系统的功能被替换,新系统最终将取代旧系统的所有功能,抑制旧系统并使其停用。通过逐步用新服务替换特定功能来支持增量迁移。
微服务的目标是通过将应用程序分解为可以独立部署的小型自治服务来提高应用程序版本的速度。微服务架构也带来了一些挑战,这些模式可以帮助缓解这些挑战。设计模式(design pattern)是对软件设计中普遍存在(反复出现)的各种问题,所提出的解决方案。当然微服务中的云设计模式也是对微服务中普遍存在的问题,所提出的解决方案。
云设计模式-Design patterns for microservices的更多相关文章
- Java设计模式(Design Patterns In Java)读书摘要——第1章 绪论
为何需要模式 模式是做事的方法,是实现目标,研磨技术的方法.通俗点说,模式是为了解决某个行业的某个问题的有效的方法或技艺. 为何需要设计模式 为了提升代码的水准,是代码变得简洁而易用.模式是一种思想, ...
- JAVA设计模式(DESIGN PATTERNS IN JAVA)读书摘要 第1部分接口型模式——第4章 外观(Facade)模式
外观模式就类似于一个工具包,一个类对应一个功能. 外观模式的意图是为子系统提供一个接口,便于它的使用. 书中给出的例子是画一个哑弹的飞行路径, 初始的类的设计是这样的,看下图, ShowFlight类 ...
- 设计模式(Design Patterns)的简单讲解
模式的诞生与定义 模式(Pattern)起源于建筑业而非软件业(小本本记下来--) 模式之父--美国加利佛尼亚大学环境结构中心研究所所长Christopher Alexander博士; 模式 : -C ...
- Design Patterns Simplified - Part 3 (Simple Factory)【设计模式简述--第三部分(简单工厂)】
原文链接:http://www.c-sharpcorner.com/UploadFile/19b1bd/design-patterns-simplified-part3-factory/ Design ...
- Design Patterns Simplified - Part 2 (Singleton)【设计模式简述--第二部分(单例模式)】
原文链接: http://www.c-sharpcorner.com/UploadFile/19b1bd/design-patterns-simplified-part-2-singleton/ De ...
- 设计模式(Design Patterns)
设计模式(Design Patterns) ——可复用面向对象软件的基础 设计模式(Design pattern)是一套被反复使用.多数人知晓的.经过分类编目的.代码设计经验的总结.使用设计模式是为了 ...
- Design Patterns in Smalltalk MVC 在Smalltalk的MVC设计模式
Design Patterns in Smalltalk MVC在Smalltalk的MVC设计模式 The Model/View/Controller (MVC) triad ofclasse ...
- 设计模式(Design Patterns)Java版
设计模式(Design Patterns) ——可复用面向对象软件的基础 设计模式(Design pattern)是一套被反复使用.多数人知晓的.经过分类编目的.代码设计经验的总结.使用设计模式是为了 ...
- Java设计模式(Design Patterns)——可复用面向对象软件的基础
设计模式(Design Patterns) 设计模式(Design pattern)是一套被反复使用.多数人知晓的.经过分类编目的.代码设计经验的总结. 使用设计模式是为了可重用代码.让代码更容易被他 ...
随机推荐
- Linux权限控制
文件属性 权限说明 文件用户组调 权限设置建议 文件属性 在shell环境里输入:ls -l 可以查看当前目录文件.如: drwxr-xr-x. 14 root root 4096 Apr 5 18: ...
- 缓存技术内部交流_03_Cache Aside
参考资料: http://www.ehcache.org/documentation/3.2/caching-patterns.html http://www.ehcache.org/document ...
- python UI自动化测试
为了减小维护成本: 1.UI自动化测试需要有较为稳定的环境 2.代码设计合理,那么我们就需要面向对象的设计一个框架,将重复的代码模块化 一.首先总结一下 UI自动化大概要哪些模块 1.config(配 ...
- poj3348凸包面积
用叉积求凸包面积 如图所示,每次找p[0]来计算,(叉积是以两个向量构成的平行四边形的面积,所以要/2) #include<map> #include<set> #includ ...
- Codeforces Round #400
最近好像总是有点不想打,专题也刷不动,还是坚持这做了一场,虽然打到一半就没打了...(反正通常都只能做出两题) 感觉自己切水题越来越熟练了,然而难题还是不会做.. A题,水,用vector存下来就行了 ...
- IOS-小技巧总结,绝对有你想要的
1.App名称的修改 许多个人开发者或许会有和我一样的经历,开发一个App途中会想到更合适的名字,这时候变会修改工程名以达到App名称改变的目的,其实你可以一步到位—— 在info.plist中添加一 ...
- IOS-第三方开源库
我找的琐碎框架 1.HZExtend:应用快速开发架构集合了MVC和MVVM的特点https://github.com/GeniusBrother/HZExtend : 1.减少控制器压力以及耦合 2 ...
- Ubuntu 无法获得锁
使用ubuntu安装pip 时,出现以下错误: E: 无法获得锁 /var/cache/apt/archives/lock – open (11 资源临时不可用) E: 无法锁定下载目录 解决方法: ...
- 在js中做数字字符串补0
转自(http://blog.csdn.net/aimingoo/article/details/4492592) 通常遇到的一个问题是日期的“1976-02-03 HH:mm:ss”这种格式 ,我的 ...
- linux 字符串查找
获取指定目录文件名包含指定字符的文件,然后遍历是否有包含特定字符串,有的话打出文件名 #!/bin/sh COMMAND=`find /data/home/ftp/data/20/201704/27/ ...