隨筆-11  評論-10  文章-8  trackbacks-0
          多謝 erlang-china 的提醒,今天從 mailing list 中翻出了關(guān)于RPC的討論,深有感觸 -- 牛人就是牛人!!!

          關(guān)于 RPC is bad 的主要論點如下:
          The fundamental problem of RPC, which is trying to make remote calls look local, is based on essentially trying to ignore the problems covered by the fallacies or trying to pretend they don't even exist

          嚴(yán)重同意,理由如下:

          Network partitions are real, timeouts are real, remote host and service
          crashes are real, the need for piecemeal system upgrade and handling
          version differences between systems is real, etc. The distributed
          systems programmer
          *must* deal with these and other issues because
          they affect different applications very differently.


          這一點非常贊同,也深有同感。在做FileServer的時候所有的節(jié)點都是通過RMI進(jìn)行通訊,最初使用RMI的目的就是
          簡化網(wǎng)絡(luò)部分的開發(fā),對于一般的開發(fā)人員無須理解RMI,動態(tài)代理,只需要像使用本地方法一樣就可以訪問遠(yuǎn)程
          節(jié)點。這種方案確實很好的隱藏了網(wǎng)絡(luò)細(xì)節(jié),使網(wǎng)絡(luò)對開發(fā)人員完全透明,但有個問題始終無法很好的處理:異常。
          網(wǎng)絡(luò)錯誤是隨時都有可能發(fā)生的,對于不同的錯誤需要根據(jù)環(huán)境和需要做具體的處理,比如,多試幾次,嘗試下一個
          節(jié)點,對于無法處理的還可以直接拋出。而這種策略的選擇和使用必須由應(yīng)用邏輯層完成,可是應(yīng)用層假設(shè)是不知道
          網(wǎng)絡(luò)存在的,它甚至無法知道自己調(diào)用的方法中哪個是遠(yuǎn)程調(diào)用,哪個是本地調(diào)用。這種矛盾從根本上說明了網(wǎng)絡(luò)的
          復(fù)雜性和多樣性是開發(fā)分布式應(yīng)用的程序員必須面對的,是逃不掉的,要直面這慘淡的人生T_T

          下面闡述了使用類型系統(tǒng)的缺陷:
          Such systems also have problems with impedance mismatch between the
          IDL and whatever languages you're translating it to. If the IDL is
          minimal so that it can be used with a wide variety of programming
          languages, it means advanced features of well-stocked languages like
          Java and C++ can't be used. OTOH if you make the IDL more powerful so
          that it's closer to such languages, then translating it to C or other
          more basic languages becomes quite difficult.
          On top of all that, no matter how you design the IDL type system, all
          the types won't -- indeed, can't -- map cleanly into every desired
          programming language.

          類型系統(tǒng)一直都在進(jìn)化,從弱到強(qiáng)到動態(tài),你相信會有一種類型系統(tǒng)可以和所有
          的其他語言進(jìn)行完美的映射嗎?如果真存在,類型系統(tǒng)的進(jìn)化就毫無意義了。定義
          一個新的語言,然后映射到其他語言,最后號稱“我是跨語言跨平臺的!”,這種
          解決問題的方式根本就是有問題的。WSDL使用XML描述,有著更好的可擴(kuò)展性,只是
          酒瓶換新酒,根爛了,再換也沒用。

          Ultimately, RPC is a leaky abstraction. It can't hide what it tries to
          hide, and because of that, it can easily make the overall problem more
          difficult to deal with by adding a lot of accidental complexity.

          下面對為什么 message queuing system 適合分布式系統(tǒng)做了很好的總結(jié):
          Message queuing systems work well because (in no particular
          order):

          * they don't pretend to be programming language procedure or method
          calls, so they avoid the associated impedance mismatch problems
          * they don't try to hide distributed systems issues
          * coupling is low -- drop a message into a queue here, pick up a
          message from a queue there
          * queues can be persistent, or more generally, delivery guarantees can
          be varied as needed
          * asynchrony
          * payloads need not conform to some made-up IDL type system
          * getting two different messaging systems to interoperate is easier
          than getting two different RPC or distributed object systems to
          interoperate
          這和我在自己的碩士論文中的觀點有些相似:完全使用消息機(jī)制進(jìn)行構(gòu)件間的通訊。構(gòu)件可以
          是分布式的或在容器中的,基于消息的通訊都是完全適用的。對于網(wǎng)絡(luò)應(yīng)用同樣如此。對于流行
          的網(wǎng)絡(luò)協(xié)議,HTTP,F(xiàn)TP,LDAP 等等都是消息式的,完全經(jīng)歷了時間的考驗。

          posted on 2008-05-28 00:32 JBahamut 閱讀(482) 評論(1)  編輯  收藏

          評論:
          # re: 讀 Erlang mailing list 有感 2008-06-24 01:55 | mier
          你java好強(qiáng)大  回復(fù)  更多評論
            

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 泉州市| 柯坪县| 邢台市| 璧山县| 开阳县| 偃师市| 南开区| 望谟县| 麻阳| 星子县| 平安县| 牡丹江市| 陆良县| 景泰县| 平顶山市| 台南市| 十堰市| 云南省| 鹤山市| 六盘水市| 田阳县| 余庆县| 光泽县| 射阳县| 夏津县| 洮南市| 西盟| 永昌县| 高青县| 边坝县| 安徽省| 隆德县| 郯城县| 陈巴尔虎旗| 壤塘县| 霸州市| 天门市| 乌鲁木齐市| 永州市| 西畴县| 若羌县|