您的位置:首页 > 其它

A Fault-Tolerant、Self-heal、Hot-upgrade、Distributed design methodology v0.1

2011-04-02 00:20 239 查看
本文描述了一种容错、自恢复、热升级、分布式系统的设计方法和框架,其在实践中被证实为一种可靠、可行的方法学。

一、Fault-Tolerant
容错最常用的思想之一是冗余redundancy,防止单点故障SPOF;最常用的机制是复制。
容错设计需要有一个清晰的容错模型Fault Model,它包括故障状态Fault State,状态取得,高级些的特性包括故障传播Failure Propagation。在Mozart-Oz系统中,有四个故障状态:
· The entity works normally (local fault state
ok
).
· The entity is temporarily not working (local fault state
tempFail
). This is because a remote site crucial to the entity is currently unreachable due to a network problem. This fault state can go away, and the entity work normally again.
· The entity is permanently not working on the given site (local fault state
localFail
). This state is enforced by the application itself and is irreversible. It does not affect other sites.
· The entity is permanently not working on all sites (local fault state
permFail
). This is because a site crucial to the entity has crashed. This fault state is permanent.
Erlang中的故障传播比较先进,基于link-supervise模型。

二、Self-heal
容错的最高境界应该是“在哪时倒了在哪里爬起来”,无人看护地自动恢复。在link-supervise模型中,有三种故障处理策略

Restart Strategy

one_for_one
If a child process terminates, only that process is restarted.



Figure 5.1: One_For_One Supervision
one_for_all
If a child process terminates, all other child processes are terminated and then all child processes, including the terminated one, are restarted.



Figure 5.2: One_For_All Supervision

rest_for_one

If a child process terminates, the 'rest' of the child processes -- i.e. the child processes after the terminated process in start order -- are terminated. Then the terminated child process and the rest of the child processes are restarted.
本文提出了一种多层次的、粒度可控的设计方法。即按业务分为进程级、工作实例级的容错方式。进程级,在JAVA领域,通常一个JAVA进程是一个JVM,在一台机器上往往只会启动一个JVM,例如一个Tomcat服务器,那么全部JAVA相关的业务逻辑就在这个JAVA进程上运行了,是最粗粒度的;这里描述的实例的概念,粒度可小可大。从多年前面向对象的中的表示某个类的运行时状态的对象实例,到Oracle数据库中的实例;跨度很大,这也给我们灵活的抽象能力。我们可以在这个框架内,支持进程级和实例级的自恢复,从而形成高级的容错机制。

三、Hot-upgrade
热升级是在不停机下升级程序,或修改配置,以改变程序的运行行为。当前支持这一特性的,在JAVA领域中,有OSGi规范下的各种实现。升级的意思还可以理解为hot-expand,热扩展;例如,在这个框架下,原来有功能A,现在要提供一个功能B,能否不大规模修改此框架的代码而实现B呢?最好的实现方式是,像最近IBM的机器“沃 森”那样,能处理自然语言描述的需求,给出答案。虽然当今计算机系统处理自然语言的能力很有限,像先进如“沃森”,也只是在处理“一句话”式的问题方面能用过人类选手;但是,显然,人类需要的是用计算机来处理复杂的问题。当然,这扯得有点远了,那咱们的这个设计方法和框架,如果能处理用简洁的次编程语言表达的、“一句话”式的需求方面,效率很高,那么就是个很好的工具了,因为复杂的需求通常能够化简为简单的需求,然后由这些简单的需求组合为复杂的需求。

四、Distributed
程序要获得高性能、高可用、可伸缩,分布式必不可少。分布式首要解决的是通信,各程序节点间的通信协议需要根据具体应用因地制宜地实施。
一个框架或平台,同时支持这些特性将是个巨大的工程,需要持久的兴趣和勇气来实践。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: