分布式计算中的8个谬论

Eight-Fallacies-of-Distributed-Computing-Tech-Talk

本文是Fallacies of Distributed Computing Explained的笔记。

8个分布式计算的谬论

  1. The network is reliable.
  2. Latency is zero.
  3. Bandwidth is infinite.
  4. The network is secure.
  5. Topology doesn't change.
  6. There is one administrator.
  7. Transport cost is zero.
  8. The network is homogeneous.

先来看第一个

1. The network is reliable

网络是不可靠的,因此在软件设计的时候,我们需要考虑

  • retry
  • acknowledge important messages
  • identify/ignore duplicates(去重)或者幂等
  • reorder messages(对消息排序)
  • verify message integrity(验证消息完整性)

2. Latency is zero

延迟指数据从一个地方传递到另一个地方需要多长时间

带宽则是决定了同时可以传输多少数据

Latency is how much time it takes for data to move from one place to another

bandwidth which is how much data we can transfer during that time

延迟比带宽更难解决,延迟会由信息的传播速度决定,而光速是恒定的,意味着延迟的low bound是固定的

"B ut I think that it’s really interesting to see that the end-to-end bandwidth increased by 1468 times within the last 11 years while the latency (the time a single ping takes) has only been improved tenfold. If this w ouldn’t be enough, there is even a natural cap on latency. The minimum round-trip time between two points of this earth is determined by the maximum speed of information transmission: the speed of light. At roughly 300,000 kilometers per second (3.6 * 10E12 teraangstrom per fortnight), it will always take at least 30 milliseconds to send a ping from Europe to the US and back, even if the processing would be done in real time."

既然延迟无法避免,我们只能尽可能的去减少消息传输。

Taking latency into consideration means you should strive to make as few as possible calls and assuming you have enough bandwidth (which will talk about next time) you'd want to move as much data out in each of this calls.

3. Bandwidth is infinite

带宽无限的谬论主要有两方面原因:

  • 随着带宽的增长,我们传输的数据也在增加;
  • 丢包问题

One is that while the bandwidth grows, so does the amount of information we try to squeeze through it. VoIP, videos, and IPTV are some of the newer applications that take up bandwidth

The other force at work to lower bandwidth is packet loss (along with frame size).

带宽不是不限的事实,让我们去减少信息的传递,但是延迟的无法避免,有让我们去尽可能的传递多的数据,我们能做的只能是trade-off。

4. The Network is Secure

作为一个架构师你不必要是一个安全专家,但是你需要了解它,知道怎么去解决她。

Security is usually a multi-layered solution that is handled on the network, infrastructure, and application levels.

5. Topology doesn’t change

可能这个谬论的得来是只有在实验环境中Topology 才不会变。

"Topology doesn't change." That's right, it doesn’t--as long as it stays in the test lab.

给我们的启示:

  • 不要依赖特定的路由或节点
  • 需要同时提供位置透明性或发现服务

Try not to depend on specific endpoints or routes, if you can't be prepared to renegotiate endpoints.

You would want to either provide location transparency (e.g. using an ESB, multicast) or provide discovery services (e.g. a Active Directory/JNDI/LDAP).

6. There is one administrator

当没有出现问题的时候,我们不会去关心是否有多个administrator,但是一旦问题发生,你就抓狂了。

"Okay, there is more than one administrator. But why should I care?" Well, as long as everything works, maybe you don't care. You do care, however, when things go astray and there is a need to pinpoint a problem (and solve it).

为了防止administrators的问题,我们需要注意:

  • 在系统小的时候,就提供工具来监控系统操作

A proactive approach is to also include tools for monitoring on-going operations as well;

总结起来,当我们面对多administrator的时候,必然会收到administrator的约束,我们能做的就是帮助他们管理自己的应用。

To sum up, when there is more than one administrator (unless we are talking about a simple system and even that can evolve later if it is successful), you need to remember that administrators can constrain your options (administrators that sets disk quotas, limited privileges, limited ports and protocols and so on), and that you need to help them manage your applications.

7. Transport cost is zero

我们可以从多个方面去解释上面结论是谬误

其中一个我们从从应用层到传输层的数据传递,我们需要对数据进行编码,会消耗time and resources

One way is that going from the application level to the transport level is free. This is a fallacy since we have to do marshaling (serialize information into bits) to get data unto the wire, which takes both computer resources and adds to the latency

第二个方式则是设置和运行网络都需要代价,我们需要很多很多money 买买买!

The second way to interpret the statement is that the costs (as in cash money) for setting and running the network are free. This is also far from being true. There are costs--costs for buying the routers, costs for securing the network, costs for leasing the bandwidth for internet connections, and costs for operating and maintaining the network running. Someone, somewhere will have to pick the tab and pay these costs.

8. The network is homogeneous

网络是同构的,这是最后一个谬论。我们需要注意不用去依赖一些自营的协议,这样后续在集成的时候会遇到大麻烦。

It is worthwhile to pay attention to the fact the network is not homogeneous at the application level

Do not rely on proprietary protocols--it would be harder to integrate them later

总结

分布式系统虽然已经发展好多年了,但是面临的问题却一直是那么多,但是可怕的是好多架构师在设计时候却仍然忽略了其中的一些问题,希望上面的列举出来的谬论能帮助架构师在设计的时候,避免一些问题。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 204,732评论 6 478
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 87,496评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 151,264评论 0 338
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,807评论 1 277
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,806评论 5 368
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,675评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,029评论 3 399
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,683评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 41,704评论 1 299
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,666评论 2 321
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,773评论 1 332
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,413评论 4 321
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,016评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,978评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,204评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,083评论 2 350
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,503评论 2 343

推荐阅读更多精彩内容