CAP理論

Distributed Systems

  • Distributed system is a software system in which components located on networked computers communicate and coordinate their actions by passing messages.

Scalability

  • Scalability is the ability of a system, network, or process, to handle a growing amount of work in a capable manner or its ability to be enlarged to accommodate that growth.Two particularly relevant aspects
    ? Performance
    ? Availability

Permformance aspects

? Short response time/low latency for a given piece of
work
? High throughput (rate of processing work)
? Low utilization of computing resource(s)

Availability

  • Availability = uptime / (uptime + downtime)
  • Availability % Downtime per year
  • 90 % ("one nine") More than one month
  • 99.9 % ("three nines") Less than 9 hours
  • 99.9999% ("six nines") 31 seconds

Fault tolerance

  • Fault tolerance -ability of a system to behave in a well-defined manner once faults occur.
  • Failures are norm.

Replication

  • Replication is making copies of the same data on
    multiple machines.
  • image.png
  • image.png

Consistency

  • image.png

Why strong consistency is hard to achieve

Nodes
? each node executes a program concurrently
? knowledge is local
? global state is potentially out of date
? nodes can fail and recover from failure independently
? messages can be delayed or lost
? clocks are not synchronized across nodes
Links
? Asynchronous system model.
? No timing assumptions.
? No bound on message transmission delay
? Useful clocks do not exist.

ACID

? Atomic
? Consistent
? Isolated
? Durable

BASE

? Basic Availability
? Soft-state
? Eventual consistency

CAP theorem

  • It is impossible for a distributed computer system to simultaneously provide all three of the following guarantees:
    ? Consistency (all nodes see the same data at the same time)
    ? Availability (every request received by a non-failing
    [database] node in the system must result in a [non-error]
    response)
    ? Partition tolerance (the system continues to operate despite
    arbitrary partitioning due to network failures)
  • image.png
  • image.png
  • image.png
  • image.png

CP systems

  • Protocols:
    ? Strict quorum protocols (paxos, raft, zab)
    ? 2PC
  • Storages:
    ? MongoDB
    ? HBase
    ? Zookeeper

AP System

  • image.png
  • image.png

AP systems

  • Protocols:
    ? Partial quorum protocols
  • Storages:
    ? Couch DB
    ? Cassandra
    ? Amazon Dynamo

CAP fifteen years later

●Partitions are rare, there is little reason to forfeit C or
A when the system is not partitioned.
●Choice between C and A can occur many times
within the same system at very fine granularity.
●All three properties are more continuous than binary.
●Most software doesn’t neatly fit CP/AP definition.

參考來源

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末赋续,一起剝皮案震驚了整個(gè)濱河市挚币,隨后出現(xiàn)的幾起案子磅甩,更是在濱河造成了極大的恐慌萍程,老刑警劉巖,帶你破解...
    沈念sama閱讀 206,602評(píng)論 6 481
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)笔呀,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 88,442評(píng)論 2 382
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來髓需,“玉大人许师,你說我怎么就攤上這事×糯遥” “怎么了微渠?”我有些...
    開封第一講書人閱讀 152,878評(píng)論 0 344
  • 文/不壞的土叔 我叫張陵,是天一觀的道長咧擂。 經(jīng)常有香客問我逞盆,道長,這世上最難降的妖魔是什么松申? 我笑而不...
    開封第一講書人閱讀 55,306評(píng)論 1 279
  • 正文 為了忘掉前任云芦,我火速辦了婚禮,結(jié)果婚禮上贸桶,老公的妹妹穿的比我還像新娘舅逸。我一直安慰自己,他們只是感情好皇筛,可當(dāng)我...
    茶點(diǎn)故事閱讀 64,330評(píng)論 5 373
  • 文/花漫 我一把揭開白布琉历。 她就那樣靜靜地躺著,像睡著了一般水醋。 火紅的嫁衣襯著肌膚如雪善已。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 49,071評(píng)論 1 285
  • 那天离例,我揣著相機(jī)與錄音,去河邊找鬼悉稠。 笑死宫蛆,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的的猛。 我是一名探鬼主播耀盗,決...
    沈念sama閱讀 38,382評(píng)論 3 400
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼卦尊!你這毒婦竟也來了叛拷?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 37,006評(píng)論 0 259
  • 序言:老撾萬榮一對(duì)情侶失蹤岂却,失蹤者是張志新(化名)和其女友劉穎忿薇,沒想到半個(gè)月后裙椭,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 43,512評(píng)論 1 300
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡署浩,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 35,965評(píng)論 2 325
  • 正文 我和宋清朗相戀三年揉燃,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片筋栋。...
    茶點(diǎn)故事閱讀 38,094評(píng)論 1 333
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡炊汤,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出弊攘,到底是詐尸還是另有隱情抢腐,我是刑警寧澤,帶...
    沈念sama閱讀 33,732評(píng)論 4 323
  • 正文 年R本政府宣布襟交,位于F島的核電站迈倍,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏婿着。R本人自食惡果不足惜授瘦,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 39,283評(píng)論 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望竟宋。 院中可真熱鬧提完,春花似錦、人聲如沸丘侠。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,286評(píng)論 0 19
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽蜗字。三九已至打肝,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間挪捕,已是汗流浹背粗梭。 一陣腳步聲響...
    開封第一講書人閱讀 31,512評(píng)論 1 262
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留级零,地道東北人断医。 一個(gè)月前我還...
    沈念sama閱讀 45,536評(píng)論 2 354
  • 正文 我出身青樓,卻偏偏與公主長得像奏纪,于是被迫代替她去往敵國和親鉴嗤。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 42,828評(píng)論 2 345

推薦閱讀更多精彩內(nèi)容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi閱讀 7,294評(píng)論 0 10
  • 柳巖曾說過一句話:“任何不以結(jié)婚為目的的戀愛都是耍流氓硬耍÷⑺觯”網(wǎng)友對(duì)這句話毀譽(yù)參半,我深以為然默垄。 我和小七平時(shí)沒有頻繁...
    十三不裝閱讀 1,101評(píng)論 16 30
  • 女兒乖巧懂事此虑,謹(jǐn)言慎行,做事有條有理口锭;當(dāng)然和我平時(shí)嚴(yán)格要求分不開朦前,她能做的事情我放手讓她做,我只是簡(jiǎn)單關(guān)注鹃操。正在我...
    jianlindashu閱讀 271評(píng)論 0 0
  • 本周主要是搭建了自己的個(gè)人博客韭寸,使用 git pages 和 jekyll,再加上一個(gè)開源的 jekyll 模板荆隘,...
    鐵拳寶寶愛芝麻閱讀 113評(píng)論 0 0