细读响应式系统的4个显著特点

响应式系统的目标是灵敏度高,系统稳健一直有回复,松耦合和可扩展。我们定义响应式系统的4个显著特点:能灵敏响应请求的(Responsive),能回复的(Resilient),可伸缩扩展的(Elastic),基于消息驱动的(Message Driven)。大系统一般是由较小的子系统构成,因此势必依赖于这些构成要素的响应式属性。这意味着响应式系统需要应用一定的设计原则,使这些属性在所有不同等级的构成要素上都适用,进而使它们可组合。如今世界上最大的系统所依赖的体系结构,都是基于这些响应式属性构建的,它们每天都在服务数十亿人的需求。不要总是重新发现这些设计原则了,在开发之初就有意识地运用它们吧!现在正是时候!

下面是响应式系统4个属性的详细解读:


Responsive:The system responds in a timely manner if at all possible. Responsiveness is the cornerstone of usability and utility, but more than that, responsiveness means that problems may be detected quickly and dealt with effectively. Responsive systems focus on providing rapid and consistent response times, establishing reliable upper bounds so they deliver a consistent quality of service. This consistent behaviour in turn simplifies error handling, builds end user confidence, and encourages further interaction.

灵敏的: 只要有可能,系统就会及时响应。灵敏性是可用性和效用的基石,但还不止于此,灵敏性还意味着问题能够被更快地侦测到并得到有效地处理。灵敏的系统着眼于提供迅速和一致的响应时间,建立可靠的服务上限,因而它们可以交付一致的服务质量。这种一致的行为反过来又能简化出错处理,建立最终用户对系统的信心,并且促使他们与系统做进一步交互。

Resilient:The system stays responsive in the face of failure. This applies not only to highly-available, mission critical systems — any system that is not resilient will be unresponsive after a failure. Resilience is achieved by replication, containment,isolation and delegation. Failures are contained within each component, isolating components from each other and thereby ensuring that parts of the system can fail and recover without compromising the system as a whole. Recovery of each component is delegated to another (external) component and high-availability is ensured by replication where necessary. The client of a component is not burdened with handling its failures.

有回复性的:系统在面临故障时也能保持灵敏度。可回复性不仅适用于高可用的关键任务系统——任何系统都可以具有这种属性,一个不具可回复性的系统一旦出现故障,就会变得不灵敏。可回复性可以通过复制,围控,隔离和委派等方式实现。在可回复性的系统中,故障被包含在每个组件中,各组件之间相互隔离,从而允许系统的某些部分出故障并且在不连累整个系统的前提下进行恢复。每个组件的恢复过程都可委派给另一个(外部的)组件来完成,并且在必要的位置可借助复制机制来确保系统的高可用性。这样一来,组件的客户就不必为处理组件自身的故障而承担压力。

Elastic:The system stays responsive under varying workload. Reactive Systems can react to changes in the input rate by increasing or decreasing the resources allocated to service these inputs. This implies designs that have no contention points or central bottlenecks, resulting in the ability to shard or replicate components and distribute inputs among them. Reactive Systems support predictive, as well as Reactive, scaling algorithms by providing relevant live performance measures. They achieve elasticity in a cost-effective way on commodity hardware and software platforms.

可伸缩的:系统在变化的工作负载下保持灵敏。响应式系统能够对输入速率的变化做出反应,通过增加或减少资源分配的方式服务这些输入。这意味着系统在设计上不存在争用点或中心的瓶颈,进而让共享或复制的模块有能力应对,并可以把输入分发给这些模块。通过提供相关的实时性能测量数据,响应式系统既支持预测式量级扩展算法,也支持响应式的量级扩展算法。响应式系统可以在商业的硬件和软件平台上以经济实惠的方式实现可伸缩性。

Message Driven:Reactive Systems rely on asynchronous message-passing to establish a boundary between components that ensures loose coupling, isolation and location transparency. This boundary also provides the means to delegate failures as messages. Employing explicit message-passing enables load management, elasticity, and flow control by shaping and monitoring the message queues in the system and applying back-pressure when necessary. Location transparent messaging as a means of communication makes it possible for the management of failure to work with the same constructs and semantics across a cluster or within a single host.Non-blocking communication allows recipients to only consume resources while active, leading to less system overhead.

消息驱动的:响应式系统依赖异步的消息传递建立组件之间的界限,这一界限确保了松耦合,隔离,位置透明性等特性的实现,还提供了以消息的形式把故障委派出去的手段。利用显式的消息传递,可以通过建立和监视消息队列的方式实现负载管理、可伸缩性以及流程控制,还可以在必要时应用背压机制。位置透明的消息传递作为一种沟通手段,使得故障管理可以在相同的构造和语义下工作,无论实际的工作环境是跨集群的环境还是一个单独的主机。非阻塞沟通则允许消息接收者仅在激活的状态下消费资源,导向更少量的系统开销。


基于消息驱动的特点极好的支持了响应式系统的可扩展和高回复性,使整个系统可以灵敏响应。

如果你想更深入的了解响应式系统,可以参考下面的响应式系统宣言:https://www.reactivemanifesto.org/

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,156评论 19 139
  • 还没来得及扬帆 就挣扎它的易逝 还没准备好起航 就直播你的狼狈 立下每天做一件自己害怕做的事 期待着一天比一天强大...
    小魔欧阅读 245评论 0 0
  • 台风词 从解放路往黄孝河走所见到处是吹落的枯树枝​有些落叶是自愿的欲望实现有的却带着夭折的青春色清洁工人有如扫地僧...
    王独树阅读 247评论 0 0
  • 关键词:生活主导权题主:女 问:冷大你好,之前有向您提问,可惜没有抽中,现在有了新的问题,希望有幸得到您的解答。我...
    冷爱阅读 325评论 0 0
  • 明天学校有个大型活动,老师群里通知,参加的家长不能开车,不能造成交通堵塞,参加活动的家长要早点到,孩子也要提前过...
    博硕妈阅读 140评论 0 0