zookeeperOver.html 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <meta content="Apache Forrest" name="Generator">
  6. <meta name="Forrest-version" content="0.9">
  7. <meta name="Forrest-skin-name" content="pelt">
  8. <title>ZooKeeper</title>
  9. <link type="text/css" href="skin/basic.css" rel="stylesheet">
  10. <link media="screen" type="text/css" href="skin/screen.css" rel="stylesheet">
  11. <link media="print" type="text/css" href="skin/print.css" rel="stylesheet">
  12. <link type="text/css" href="skin/profile.css" rel="stylesheet">
  13. <script src="skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="skin/fontsize.js" language="javascript" type="text/javascript"></script>
  14. <link rel="shortcut icon" href="images/favicon.ico">
  15. </head>
  16. <body onload="init()">
  17. <script type="text/javascript">ndeSetTextSize();</script>
  18. <div id="top">
  19. <!--+
  20. |breadtrail
  21. +-->
  22. <div class="breadtrail">
  23. <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://hadoop.apache.org/">Hadoop</a> &gt; <a href="http://hadoop.apache.org/zookeeper/">ZooKeeper</a><script src="skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script>
  24. </div>
  25. <!--+
  26. |header
  27. +-->
  28. <div class="header">
  29. <!--+
  30. |start group logo
  31. +-->
  32. <div class="grouplogo">
  33. <a href="http://hadoop.apache.org/"><img class="logoImage" alt="Hadoop" src="images/hadoop-logo.jpg" title="Apache Hadoop"></a>
  34. </div>
  35. <!--+
  36. |end group logo
  37. +-->
  38. <!--+
  39. |start Project Logo
  40. +-->
  41. <div class="projectlogo">
  42. <a href="http://hadoop.apache.org/zookeeper/"><img class="logoImage" alt="ZooKeeper" src="images/zookeeper_small.gif" title="ZooKeeper: distributed coordination"></a>
  43. </div>
  44. <!--+
  45. |end Project Logo
  46. +-->
  47. <!--+
  48. |start Search
  49. +-->
  50. <div class="searchbox">
  51. <form action="http://www.google.com/search" method="get" class="roundtopsmall">
  52. <input value="hadoop.apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank (this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search the site with google">&nbsp;
  53. <input name="Search" value="Search" type="submit">
  54. </form>
  55. </div>
  56. <!--+
  57. |end search
  58. +-->
  59. <!--+
  60. |start Tabs
  61. +-->
  62. <ul id="tabs">
  63. <li>
  64. <a class="unselected" href="http://hadoop.apache.org/zookeeper/">Project</a>
  65. </li>
  66. <li>
  67. <a class="unselected" href="http://wiki.apache.org/hadoop/ZooKeeper">Wiki</a>
  68. </li>
  69. <li class="current">
  70. <a class="selected" href="index.html">ZooKeeper 3.4 Documentation</a>
  71. </li>
  72. </ul>
  73. <!--+
  74. |end Tabs
  75. +-->
  76. </div>
  77. </div>
  78. <div id="main">
  79. <div id="publishedStrip">
  80. <!--+
  81. |start Subtabs
  82. +-->
  83. <div id="level2tabs"></div>
  84. <!--+
  85. |end Endtabs
  86. +-->
  87. <script type="text/javascript"><!--
  88. document.write("Last Published: " + document.lastModified);
  89. // --></script>
  90. </div>
  91. <!--+
  92. |breadtrail
  93. +-->
  94. <div class="breadtrail">
  95. &nbsp;
  96. </div>
  97. <!--+
  98. |start Menu, mainarea
  99. +-->
  100. <!--+
  101. |start Menu
  102. +-->
  103. <div id="menu">
  104. <div onclick="SwitchMenu('menu_selected_1.1', 'skin/')" id="menu_selected_1.1Title" class="menutitle" style="background-image: url('skin/images/chapter_open.gif');">Overview</div>
  105. <div id="menu_selected_1.1" class="selectedmenuitemgroup" style="display: block;">
  106. <div class="menuitem">
  107. <a href="index.html">Welcome</a>
  108. </div>
  109. <div class="menupage">
  110. <div class="menupagetitle">Overview</div>
  111. </div>
  112. <div class="menuitem">
  113. <a href="zookeeperStarted.html">Getting Started</a>
  114. </div>
  115. <div class="menuitem">
  116. <a href="releasenotes.html">Release Notes</a>
  117. </div>
  118. </div>
  119. <div onclick="SwitchMenu('menu_1.2', 'skin/')" id="menu_1.2Title" class="menutitle">Developer</div>
  120. <div id="menu_1.2" class="menuitemgroup">
  121. <div class="menuitem">
  122. <a href="api/index.html">API Docs</a>
  123. </div>
  124. <div class="menuitem">
  125. <a href="zookeeperProgrammers.html">Programmer's Guide</a>
  126. </div>
  127. <div class="menuitem">
  128. <a href="javaExample.html">Java Example</a>
  129. </div>
  130. <div class="menuitem">
  131. <a href="zookeeperTutorial.html">Barrier and Queue Tutorial</a>
  132. </div>
  133. <div class="menuitem">
  134. <a href="recipes.html">Recipes</a>
  135. </div>
  136. </div>
  137. <div onclick="SwitchMenu('menu_1.3', 'skin/')" id="menu_1.3Title" class="menutitle">BookKeeper</div>
  138. <div id="menu_1.3" class="menuitemgroup">
  139. <div class="menuitem">
  140. <a href="bookkeeperStarted.html">Getting started</a>
  141. </div>
  142. <div class="menuitem">
  143. <a href="bookkeeperOverview.html">Overview</a>
  144. </div>
  145. <div class="menuitem">
  146. <a href="bookkeeperConfig.html">Setup guide</a>
  147. </div>
  148. <div class="menuitem">
  149. <a href="bookkeeperProgrammer.html">Programmer's guide</a>
  150. </div>
  151. </div>
  152. <div onclick="SwitchMenu('menu_1.4', 'skin/')" id="menu_1.4Title" class="menutitle">Admin &amp; Ops</div>
  153. <div id="menu_1.4" class="menuitemgroup">
  154. <div class="menuitem">
  155. <a href="zookeeperAdmin.html">Administrator's Guide</a>
  156. </div>
  157. <div class="menuitem">
  158. <a href="zookeeperQuotas.html">Quota Guide</a>
  159. </div>
  160. <div class="menuitem">
  161. <a href="zookeeperJMX.html">JMX</a>
  162. </div>
  163. <div class="menuitem">
  164. <a href="zookeeperObservers.html">Observers Guide</a>
  165. </div>
  166. </div>
  167. <div onclick="SwitchMenu('menu_1.5', 'skin/')" id="menu_1.5Title" class="menutitle">Contributor</div>
  168. <div id="menu_1.5" class="menuitemgroup">
  169. <div class="menuitem">
  170. <a href="zookeeperInternals.html">ZooKeeper Internals</a>
  171. </div>
  172. </div>
  173. <div onclick="SwitchMenu('menu_1.6', 'skin/')" id="menu_1.6Title" class="menutitle">Miscellaneous</div>
  174. <div id="menu_1.6" class="menuitemgroup">
  175. <div class="menuitem">
  176. <a href="http://wiki.apache.org/hadoop/ZooKeeper">Wiki</a>
  177. </div>
  178. <div class="menuitem">
  179. <a href="http://wiki.apache.org/hadoop/ZooKeeper/FAQ">FAQ</a>
  180. </div>
  181. <div class="menuitem">
  182. <a href="http://hadoop.apache.org/zookeeper/mailing_lists.html">Mailing Lists</a>
  183. </div>
  184. </div>
  185. <div id="credit"></div>
  186. <div id="roundbottom">
  187. <img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
  188. <!--+
  189. |alternative credits
  190. +-->
  191. <div id="credit2"></div>
  192. </div>
  193. <!--+
  194. |end Menu
  195. +-->
  196. <!--+
  197. |start content
  198. +-->
  199. <div id="content">
  200. <div title="Portable Document Format" class="pdflink">
  201. <a class="dida" href="zookeeperOver.pdf"><img alt="PDF -icon" src="skin/images/pdfdoc.gif" class="skin"><br>
  202. PDF</a>
  203. </div>
  204. <h1>ZooKeeper</h1>
  205. <div id="front-matter">
  206. <div id="minitoc-area">
  207. <ul class="minitoc">
  208. <li>
  209. <a href="#ch_DesignOverview">ZooKeeper: A Distributed Coordination Service for Distributed
  210. Applications</a>
  211. <ul class="minitoc">
  212. <li>
  213. <a href="#sc_designGoals">Design Goals</a>
  214. </li>
  215. <li>
  216. <a href="#sc_dataModelNameSpace">Data model and the hierarchical namespace</a>
  217. </li>
  218. <li>
  219. <a href="#Nodes+and+ephemeral+nodes">Nodes and ephemeral nodes</a>
  220. </li>
  221. <li>
  222. <a href="#Conditional+updates+and+watches">Conditional updates and watches</a>
  223. </li>
  224. <li>
  225. <a href="#Guarantees">Guarantees</a>
  226. </li>
  227. <li>
  228. <a href="#Simple+API">Simple API</a>
  229. </li>
  230. <li>
  231. <a href="#Implementation">Implementation</a>
  232. </li>
  233. <li>
  234. <a href="#Uses">Uses</a>
  235. </li>
  236. <li>
  237. <a href="#Performance">Performance</a>
  238. </li>
  239. <li>
  240. <a href="#Reliability">Reliability</a>
  241. </li>
  242. <li>
  243. <a href="#The+ZooKeeper+Project">The ZooKeeper Project</a>
  244. </li>
  245. </ul>
  246. </li>
  247. </ul>
  248. </div>
  249. </div>
  250. <a name="ch_DesignOverview"></a>
  251. <h2 class="h3">ZooKeeper: A Distributed Coordination Service for Distributed
  252. Applications</h2>
  253. <div class="section">
  254. <p>ZooKeeper is a distributed, open-source coordination service for
  255. distributed applications. It exposes a simple set of primitives that
  256. distributed applications can build upon to implement higher level services
  257. for synchronization, configuration maintenance, and groups and naming. It
  258. is designed to be easy to program to, and uses a data model styled after
  259. the familiar directory tree structure of file systems. It runs in Java and
  260. has bindings for both Java and C.</p>
  261. <p>Coordination services are notoriously hard to get right. They are
  262. especially prone to errors such as race conditions and deadlock. The
  263. motivation behind ZooKeeper is to relieve distributed applications the
  264. responsibility of implementing coordination services from scratch.</p>
  265. <a name="sc_designGoals"></a>
  266. <h3 class="h4">Design Goals</h3>
  267. <p>
  268. <strong>ZooKeeper is simple.</strong> ZooKeeper
  269. allows distributed processes to coordinate with each other through a
  270. shared hierarchal namespace which is organized similarly to a standard
  271. file system. The name space consists of data registers - called znodes,
  272. in ZooKeeper parlance - and these are similar to files and directories.
  273. Unlike a typical file system, which is designed for storage, ZooKeeper
  274. data is kept in-memory, which means ZooKeeper can acheive high
  275. throughput and low latency numbers.</p>
  276. <p>The ZooKeeper implementation puts a premium on high performance,
  277. highly available, strictly ordered access. The performance aspects of
  278. ZooKeeper means it can be used in large, distributed systems. The
  279. reliability aspects keep it from being a single point of failure. The
  280. strict ordering means that sophisticated synchronization primitives can
  281. be implemented at the client.</p>
  282. <p>
  283. <strong>ZooKeeper is replicated.</strong> Like the
  284. distributed processes it coordinates, ZooKeeper itself is intended to be
  285. replicated over a sets of hosts called an ensemble.</p>
  286. <table class="ForrestTable" cellspacing="1" cellpadding="4">
  287. <tr>
  288. <td>ZooKeeper Service</td>
  289. </tr>
  290. <tr>
  291. <td>
  292. <img alt="" src="images/zkservice.jpg">
  293. </td>
  294. </tr>
  295. </table>
  296. <p>The servers that make up the ZooKeeper service must all know about
  297. each other. They maintain an in-memory image of state, along with a
  298. transaction logs and snapshots in a persistent store. As long as a
  299. majority of the servers are available, the ZooKeeper service will be
  300. available.</p>
  301. <p>Clients connect to a single ZooKeeper server. The client maintains
  302. a TCP connection through which it sends requests, gets responses, gets
  303. watch events, and sends heart beats. If the TCP connection to the server
  304. breaks, the client will connect to a different server.</p>
  305. <p>
  306. <strong>ZooKeeper is ordered.</strong> ZooKeeper
  307. stamps each update with a number that reflects the order of all
  308. ZooKeeper transactions. Subsequent operations can use the order to
  309. implement higher-level abstractions, such as synchronization
  310. primitives.</p>
  311. <p>
  312. <strong>ZooKeeper is fast.</strong> It is
  313. especially fast in "read-dominant" workloads. ZooKeeper applications run
  314. on thousands of machines, and it performs best where reads are more
  315. common than writes, at ratios of around 10:1.</p>
  316. <a name="sc_dataModelNameSpace"></a>
  317. <h3 class="h4">Data model and the hierarchical namespace</h3>
  318. <p>The name space provided by ZooKeeper is much like that of a
  319. standard file system. A name is a sequence of path elements separated by
  320. a slash (/). Every node in ZooKeeper's name space is identified by a
  321. path.</p>
  322. <table class="ForrestTable" cellspacing="1" cellpadding="4">
  323. <tr>
  324. <td>ZooKeeper's Hierarchical Namespace</td>
  325. </tr>
  326. <tr>
  327. <td>
  328. <img alt="" src="images/zknamespace.jpg">
  329. </td>
  330. </tr>
  331. </table>
  332. <a name="Nodes+and+ephemeral+nodes"></a>
  333. <h3 class="h4">Nodes and ephemeral nodes</h3>
  334. <p>Unlike is standard file systems, each node in a ZooKeeper
  335. namespace can have data associated with it as well as children. It is
  336. like having a file-system that allows a file to also be a directory.
  337. (ZooKeeper was designed to store coordination data: status information,
  338. configuration, location information, etc., so the data stored at each
  339. node is usually small, in the byte to kilobyte range.) We use the term
  340. <em>znode</em> to make it clear that we are talking about
  341. ZooKeeper data nodes.</p>
  342. <p>Znodes maintain a stat structure that includes version numbers for
  343. data changes, ACL changes, and timestamps, to allow cache validations
  344. and coordinated updates. Each time a znode's data changes, the version
  345. number increases. For instance, whenever a client retrieves data it also
  346. receives the version of the data.</p>
  347. <p>The data stored at each znode in a namespace is read and written
  348. atomically. Reads get all the data bytes associated with a znode and a
  349. write replaces all the data. Each node has an Access Control List (ACL)
  350. that restricts who can do what.</p>
  351. <p>ZooKeeper also has the notion of ephemeral nodes. These znodes
  352. exists as long as the session that created the znode is active. When the
  353. session ends the znode is deleted. Ephemeral nodes are useful when you
  354. want to implement <em>[tbd]</em>.</p>
  355. <a name="Conditional+updates+and+watches"></a>
  356. <h3 class="h4">Conditional updates and watches</h3>
  357. <p>ZooKeeper supports the concept of <em>watches</em>.
  358. Clients can set a watch on a znodes. A watch will be triggered and
  359. removed when the znode changes. When a watch is triggered the client
  360. receives a packet saying that the znode has changed. And if the
  361. connection between the client and one of the Zoo Keeper servers is
  362. broken, the client will receive a local notification. These can be used
  363. to <em>[tbd]</em>.</p>
  364. <a name="Guarantees"></a>
  365. <h3 class="h4">Guarantees</h3>
  366. <p>ZooKeeper is very fast and very simple. Since its goal, though, is
  367. to be a basis for the construction of more complicated services, such as
  368. synchronization, it provides a set of guarantees. These are:</p>
  369. <ul>
  370. <li>
  371. <p>Sequential Consistency - Updates from a client will be applied
  372. in the order that they were sent.</p>
  373. </li>
  374. <li>
  375. <p>Atomicity - Updates either succeed or fail. No partial
  376. results.</p>
  377. </li>
  378. <li>
  379. <p>Single System Image - A client will see the same view of the
  380. service regardless of the server that it connects to.</p>
  381. </li>
  382. </ul>
  383. <ul>
  384. <li>
  385. <p>Reliability - Once an update has been applied, it will persist
  386. from that time forward until a client overwrites the update.</p>
  387. </li>
  388. </ul>
  389. <ul>
  390. <li>
  391. <p>Timeliness - The clients view of the system is guaranteed to
  392. be up-to-date within a certain time bound.</p>
  393. </li>
  394. </ul>
  395. <p>For more information on these, and how they can be used, see
  396. <em>[tbd]</em>
  397. </p>
  398. <a name="Simple+API"></a>
  399. <h3 class="h4">Simple API</h3>
  400. <p>One of the design goals of ZooKeeper is provide a very simple
  401. programming interface. As a result, it supports only these
  402. operations:</p>
  403. <dl>
  404. <dt>
  405. <term>create</term>
  406. </dt>
  407. <dd>
  408. <p>creates a node at a location in the tree</p>
  409. </dd>
  410. <dt>
  411. <term>delete</term>
  412. </dt>
  413. <dd>
  414. <p>deletes a node</p>
  415. </dd>
  416. <dt>
  417. <term>exists</term>
  418. </dt>
  419. <dd>
  420. <p>tests if a node exists at a location</p>
  421. </dd>
  422. <dt>
  423. <term>get data</term>
  424. </dt>
  425. <dd>
  426. <p>reads the data from a node</p>
  427. </dd>
  428. <dt>
  429. <term>set data</term>
  430. </dt>
  431. <dd>
  432. <p>writes data to a node</p>
  433. </dd>
  434. <dt>
  435. <term>get children</term>
  436. </dt>
  437. <dd>
  438. <p>retrieves a list of children of a node</p>
  439. </dd>
  440. <dt>
  441. <term>sync</term>
  442. </dt>
  443. <dd>
  444. <p>waits for data to be propagated</p>
  445. </dd>
  446. </dl>
  447. <p>For a more in-depth discussion on these, and how they can be used
  448. to implement higher level operations, please refer to
  449. <em>[tbd]</em>
  450. </p>
  451. <a name="Implementation"></a>
  452. <h3 class="h4">Implementation</h3>
  453. <p>
  454. <a href="#fg_zkComponents">ZooKeeper Components</a> shows the high-level components
  455. of the ZooKeeper service. With the exception of the request processor,
  456. each of
  457. the servers that make up the ZooKeeper service replicates its own copy
  458. of each of components.</p>
  459. <table class="ForrestTable" cellspacing="1" cellpadding="4">
  460. <tr>
  461. <td>ZooKeeper Components</td>
  462. </tr>
  463. <tr>
  464. <td>
  465. <img alt="" src="images/zkcomponents.jpg">
  466. </td>
  467. </tr>
  468. </table>
  469. <p>The replicated database is an in-memory database containing the
  470. entire data tree. Updates are logged to disk for recoverability, and
  471. writes are serialized to disk before they are applied to the in-memory
  472. database.</p>
  473. <p>Every ZooKeeper server services clients. Clients connect to
  474. exactly one server to submit irequests. Read requests are serviced from
  475. the local replica of each server database. Requests that change the
  476. state of the service, write requests, are processed by an agreement
  477. protocol.</p>
  478. <p>As part of the agreement protocol all write requests from clients
  479. are forwarded to a single server, called the
  480. <em>leader</em>. The rest of the ZooKeeper servers, called
  481. <em>followers</em>, receive message proposals from the
  482. leader and agree upon message delivery. The messaging layer takes care
  483. of replacing leaders on failures and syncing followers with
  484. leaders.</p>
  485. <p>ZooKeeper uses a custom atomic messaging protocol. Since the
  486. messaging layer is atomic, ZooKeeper can guarantee that the local
  487. replicas never diverge. When the leader receives a write request, it
  488. calculates what the state of the system is when the write is to be
  489. applied and transforms this into a transaction that captures this new
  490. state.</p>
  491. <a name="Uses"></a>
  492. <h3 class="h4">Uses</h3>
  493. <p>The programming interface to ZooKeeper is deliberately simple.
  494. With it, however, you can implement higher order operations, such as
  495. synchronizations primitives, group membership, ownership, etc. Some
  496. distributed applications have used it to: <em>[tbd: add uses from
  497. white paper and video presentation.]</em> For more information, see
  498. <em>[tbd]</em>
  499. </p>
  500. <a name="Performance"></a>
  501. <h3 class="h4">Performance</h3>
  502. <p>ZooKeeper is designed to be highly performant. But is it? The
  503. results of the ZooKeeper's development team at Yahoo! Research indicate
  504. that it is. (See <a href="#fg_zkPerfRW">ZooKeeper Throughput as the Read-Write Ratio Varies</a>.) It is especially high
  505. performance in applications where reads outnumber writes, since writes
  506. involve synchronizing the state of all servers. (Reads outnumbering
  507. writes is typically the case for a coordination service.)</p>
  508. <table class="ForrestTable" cellspacing="1" cellpadding="4">
  509. <tr>
  510. <td>ZooKeeper Throughput as the Read-Write Ratio Varies</td>
  511. </tr>
  512. <tr>
  513. <td>
  514. <img alt="" src="images/zkperfRW-3.2.jpg">
  515. </td>
  516. </tr>
  517. </table>
  518. <p>The figure <a href="#fg_zkPerfRW">ZooKeeper Throughput as the Read-Write Ratio Varies</a> is a throughput
  519. graph of ZooKeeper release 3.2 running on servers with dual 2Ghz
  520. Xeon and two SATA 15K RPM drives. One drive was used as a
  521. dedicated ZooKeeper log device. The snapshots were written to
  522. the OS drive. Write requests were 1K writes and the reads were
  523. 1K reads. "Servers" indicate the size of the ZooKeeper
  524. ensemble, the number of servers that make up the
  525. service. Approximately 30 other servers were used to simulate
  526. the clients. The ZooKeeper ensemble was configured such that
  527. leaders do not allow connections from clients.</p>
  528. <div class="note">
  529. <div class="label">Note</div>
  530. <div class="content">
  531. <p>In version 3.2 r/w performance improved by ~2x
  532. compared to the <a href="http://hadoop.apache.org/zookeeper/docs/r3.1.1/zookeeperOver.html#Performance">previous
  533. 3.1 release</a>.</p>
  534. </div>
  535. </div>
  536. <p>Benchmarks also indicate that it is reliable, too. <a href="#fg_zkPerfReliability">Reliability in the Presence of Errors</a> shows how a deployment responds to
  537. various failures. The events marked in the figure are the
  538. following:</p>
  539. <ol>
  540. <li>
  541. <p>Failure and recovery of a follower</p>
  542. </li>
  543. <li>
  544. <p>Failure and recovery of a different follower</p>
  545. </li>
  546. <li>
  547. <p>Failure of the leader</p>
  548. </li>
  549. <li>
  550. <p>Failure and recovery of two followers</p>
  551. </li>
  552. <li>
  553. <p>Failure of another leader</p>
  554. </li>
  555. </ol>
  556. <a name="Reliability"></a>
  557. <h3 class="h4">Reliability</h3>
  558. <p>To show the behavior of the system over time as
  559. failures are injected we ran a ZooKeeper service made up of
  560. 7 machines. We ran the same saturation benchmark as before,
  561. but this time we kept the write percentage at a constant
  562. 30%, which is a conservative ratio of our expected
  563. workloads.
  564. </p>
  565. <table class="ForrestTable" cellspacing="1" cellpadding="4">
  566. <tr>
  567. <td>Reliability in the Presence of Errors</td>
  568. </tr>
  569. <tr>
  570. <td>
  571. <img alt="" src="images/zkperfreliability.jpg">
  572. </td>
  573. </tr>
  574. </table>
  575. <p>The are a few important observations from this graph. First, if
  576. followers fail and recover quickly, then ZooKeeper is able to sustain a
  577. high throughput despite the failure. But maybe more importantly, the
  578. leader election algorithm allows for the system to recover fast enough
  579. to prevent throughput from dropping substantially. In our observations,
  580. ZooKeeper takes less than 200ms to elect a new leader. Third, as
  581. followers recover, ZooKeeper is able to raise throughput again once they
  582. start processing requests.</p>
  583. <a name="The+ZooKeeper+Project"></a>
  584. <h3 class="h4">The ZooKeeper Project</h3>
  585. <p>ZooKeeper has been
  586. <a href="http://wiki.apache.org/hadoop/ZooKeeper/PoweredBy">
  587. successfully used
  588. </a>
  589. in many industrial applications. It is used at Yahoo! as the
  590. coordination and failure recovery service for Yahoo! Message
  591. Broker, which is a highly scalable publish-subscribe system
  592. managing thousands of topics for replication and data
  593. delivery. It is used by the Fetching Service for Yahoo!
  594. crawler, where it also manages failure recovery. A number of
  595. Yahoo! advertising systems also use ZooKeeper to implement
  596. reliable services.
  597. </p>
  598. <p>All users and developers are encouraged to join the
  599. community and contribute their expertise. See the
  600. <a href="http://hadoop.apache.org/zookeeper/">
  601. Zookeeper Project on Apache
  602. </a>
  603. for more information.
  604. </p>
  605. </div>
  606. <p align="right">
  607. <font size="-2"></font>
  608. </p>
  609. </div>
  610. <!--+
  611. |end content
  612. +-->
  613. <div class="clearboth">&nbsp;</div>
  614. </div>
  615. <div id="footer">
  616. <!--+
  617. |start bottomstrip
  618. +-->
  619. <div class="lastmodified">
  620. <script type="text/javascript"><!--
  621. document.write("Last Published: " + document.lastModified);
  622. // --></script>
  623. </div>
  624. <div class="copyright">
  625. Copyright &copy;
  626. 2008 <a href="http://www.apache.org/licenses/">The Apache Software Foundation.</a>
  627. </div>
  628. <!--+
  629. |end bottomstrip
  630. +-->
  631. </div>
  632. </body>
  633. </html>