本文是Google院士jeff dean在今年SOCC大会上的一次演讲的笔记,主要介绍了一些用于设计分布式系统的模式,原文地址,这次演讲的视频地址(需要安装Silverlight)。
-
- 将一个大而复杂系统切分为多个服务,而且服务之间依赖尽可能的少,这样有助于测试,部署和小团队独立开发。例子:一个google的搜索会依赖100多个服务。ike:需要一套机制来确保服务的fault-tolerant,不能让一个服务的成败影响全局。
- 需要有Protocol Description Language,比如protocol buffers。ike:这样能降低通信方面的代码量。
- 有能力在开发之前,根据系统的设计来预测性能,在最下面有一些重要的数字。ike:这样数字需要记牢。
- 设计系统时,不要想做的很全面,而是需要抓住重点。
- 为了增量做设计,但不为无限做设计,比如:要为5-50倍的增量做设计,但超过1000倍了,就需要重写和重新设计了。
- 使用备份请求来降低延迟,比如一个处理需要涉及1000台机器,通过备份请求这个机制来避免这个处理被一台慢机器延误。ike:这个机制非常适合MapReduce。
- 使用范围来分布数据,而不是Hash,因为这样在语义上比较简单,并且容易控制。
- 灵活的系统,根据需求来伸缩,并且当需求上来的时候,关闭部分特性,比如:关闭拼写检查。
- 一个接口,多个实现。
- 加入足够的观察和调式钩子(hook)。
图1. 重要的数字