Skip to content
jnblanchet edited this page Aug 27, 2013 · 12 revisions

The following diagram is a high-level static representation of NRV. The responsibilities of the important classes are defined below.

Static Representation

NRV Architecture Class Diagram

Cluster

Contains services and nodes that have memberships into those services. Each node can have 0 to n membership per service, making it possible for a node to handle more than one section of the consistent hashing ring.

ClusterManager

Manages nodes membership to services and the status of each membership (Up, Down, Joining, Leaving). The cluster manager can be static (StaticClusterManager), which gives a static view of the cluster in which all nodes are always up, or dynamic (ZookeeperClusterManager), which uses Zookeeper to maintain a consistent view of the cluster among nodes. StaticClusterManager does not depend on ZooKeeper, and is generally used for testing.

Service

A service is a set of Actions that can be remotely queried. Actions are executed on remote (or local) node defined by the token associated with the query. Endpoints (target nodes) are resolved by the Resolver. In a REST URL, the service would be the host (http://service/path).

Action

An action is a function that can be executed on a service. In a REST URL, the action is the path (http://service/path). In the previous diagram, MyService creates its actions and will redirect incoming queries to appropriate action by searching for an action matching the requested path.

Resolver

Actions use the Resolver to find on which node a request should be sent. Other implementations of the Resolver are used by the replication to locate masters from slaves.

Protocol & Codec

Actions use a protocol to send a request to remote nodes. The protocol alone doesn't know how to encode requests, it uses a Codec to encode messages over the protocol. This sequence diagram provides more information on message exchange and other implicated classes.

Consistency

A consistency implementation manages consistency for actions with implemented tradeoffs. Since it's impossible to have more than 2 guarantees between Consistency, Availability and Partition Tolerance in a distributed system, a service can define the consistency that it wants to use for its actions. For instance, for a database, the ConsistencyMasterSlave implementation (along with a relatively complex sub system) makes it possible to manage the consistency and the availability of the cluster, but won't be able to resist to a network partition. The exact behavior of ConsistencyMasterSlave is described in details in the replication article.

Clone this wiki locally