# CAP: if all you have is a timeout, everything looks like a partition

DevFeed: [CAP: if all you have is a timeout, everything looks like a partition](<https://devfeed.tech/articles/cap-if-all-you-have-is-a-timeout-everything-looks-like-a-partition-21690.md>)

Original publisher: [Read original article](<http://blog.thislongrun.com/2015/05/CAP-theorem-partition-timeout-zookeeper.html>)

Author: Nicolas Liochon (noreply@blogger.com)

Published: 2015-05-25T17:42:00Z

Content type: article

Language: en

Sources: [Nicolas Liochon](<https://devfeed.tech/sources/nicolas-liochon.md>)

Topics: [Network](<https://devfeed.tech/topics/network.md>), [Hadoop](<https://devfeed.tech/topics/hadoop.md>), [Processes](<https://devfeed.tech/topics/processes.md>), [Database](<https://devfeed.tech/topics/database.md>), [Open Source](<https://devfeed.tech/topics/open-source.md>)

Tags: [acid](<https://devfeed.tech/tags/acid.md>), [apache](<https://devfeed.tech/tags/apache.md>), [apache-zookeeper](<https://devfeed.tech/tags/apache-zookeeper.md>), [availability](<https://devfeed.tech/tags/availability.md>), [cap-theorem](<https://devfeed.tech/tags/cap-theorem.md>), [consistency](<https://devfeed.tech/tags/consistency.md>), [database](<https://devfeed.tech/tags/database.md>), [distributed-system](<https://devfeed.tech/tags/distributed-system.md>), [durability](<https://devfeed.tech/tags/durability.md>), [hadoop](<https://devfeed.tech/tags/hadoop.md>), [latency](<https://devfeed.tech/tags/latency.md>), [network](<https://devfeed.tech/tags/network.md>), [partition](<https://devfeed.tech/tags/partition.md>), [process](<https://devfeed.tech/tags/process.md>), [synchronization](<https://devfeed.tech/tags/synchronization.md>), [timeout](<https://devfeed.tech/tags/timeout.md>)

## AI overview

This article distinguishes network partitions from node failures and process crashes in the CAP theorem. It examines how Apache HBase uses Apache ZooKeeper ephemeral nodes and session timeouts for failure detection, noting that timeout-based recovery affects mean time to repair across these failure scenarios.

## Source excerpt

"I suppose it is tempting, if the only tool you have is a timeout, to treat everything as if it were a partition." - Abraham Maslow, quoted from memory This post is part of the CAP theorem series. You may want to start by my post on ACID vs. CAP if you have a database background but have never really been exposed to the CAP theorem. The post discussing some traps in the 'Availability' and 'Consistency' definition of CAP should also be used as an introduction if you know CAP but haven't looked at its formal definition. Partitions in the CAP theorem are network partitions, and nothing else. There're not node failure or process crash. But does this matter in real-life? Let's answer this question by looking at an optimisation implemented on Apache HBase and Apache ZooKeeper when handling process crash. This is applicable by anyone using ZooKeeper. Apache HBase, ZooKeeper and failure detection Using ZooKeeper website: "ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services. All of these kinds of services are used in some form or another by distributed applications." And HBase website: "Apache HBase™ is the Hadoop database, a distributed, scalable, big data store." HBase is an open source implementation of Google's Bigtable. Cluster size varies from 5 to x000 nodes. ZooKeeper is used by HBase for a few things, one of them being, like in Bigtable, detecting failures. ZooKeeper manages failures by giving the user the possibility to create "ephemeral nodes". "These znodes exist as long as the session that created the znode is active. When the session ends the znode is deleted." And then "Expirations happen when the cluster does not hear from the client within the specified session timeout period (i.e. no heartbeat). At session expiration the cluster will delete any/all ephemeral nodes owned by that session and immediately notify any/all connected clients of the change (anyone w