程序猿阵线联盟-汇总各类技术干货架构设计与重构微服务架构和实践

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

2017-11-03  本文已影响0人  LeonalGU

响应式系统的目标是灵敏度高,系统稳健一直有回复,松耦合和可扩展。我们定义响应式系统的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/

上一篇下一篇

猜你喜欢

热点阅读