2017-09-29 23:34:45
Apache core project : ZooKeeper
Unlike a typical file system, which is designed for storage, ZooKeeper data is kept in-memory, which means ZooKeeper can archive highput and low latency numbers;
ZooKeeper is a high-performance cooridination service for distributed applications.
it exposes common services - such as naming, configuration management, synchronization, and group service - in a simple interface so you don`t have to write them from scratch.
You can use it off-the-shelf to implementa consensus, group management, leader election, and presence protocols, And you can build on it for your own, specific needs.
The servers that make up the zookeeper service must all know about each other. They maintain an in-memory
image of state. along with a transaction logs and snapshots in a persistent store.
As long as a majority of the servers are available, the ZooKeeper service will be availiable.
Client connect to a single ZooKeeper server. The client maintains a TCP connection through which it sends requests, gets response, gets watch events, and sends heart beat. if the TCP connection to the server breaks, the client will connect to a different server.
ZooKeeper Is Ordered.
ZooKeeper stamps each update with a number that reflects the order of all ZooKeeper transactions. Subsequent operations can use the order to implement higer-level abstractions, such as synchronization primitives.
ZooKeeper Is fast.
It is especially fast in "read-dominat" workloads. ZooKeeper applications run on thousands of machines, and it performs best where reads are more common than writes, at ratios of around 10 : 1
Data model and the hierchical namespace
API
Implementation
shows the high-level components of the ZooKeeper service. With the exception of the request processor,
each of the servers that make up the ZooKeeper service replicates its own copy of the components.
1 the replicated database is an in-memory database containing the entire data tree.
2 updates are logged to disk for recoverability, and writes are serialized to disk before thet are applied to the in-memory database.