Database Reference
In-Depth Information
Replication Strategies
In order for Cassandra to be able to determine the physical location of nodes in the
cluster and their proximity to each other, it needs to know how you are planning to
lay things out. There are three parts to this: the replication strategy, the snitch, and
the partitioner.
For replication strategies, there are two possibilities: SimpleStrategy and Net-
workTopologyStrategy.
SimpleStrategy
SimpleStrategy is to be used on an individual machine or with single-data-center
clusters. As a result, it is also the default placement strategy when creating a key-
space.
The way SimpleStrategy works is mostly based on the partitioner. The first
replica is placed on whichever node the partitioner tells it. All additional replicas
are added to the ring in a clockwise fashion. When queries are run under Sim-
pleStrategy, there is no location awareness. In other words, the data center and
rack locations of the other nodes are not taken into account.
NetworkTopologyStrategy
The best time to use the NetworkTopologyStrategy is when you have a Cassandra
deployment across multiple data centers. The strategy describes the number of rep-
licas that should be in each data center. This number is set at keyspace creation
time.
Replica Counts
There are a few things to take into account when deciding how many replicas
should be in each data center. The first has to do with satisfying reads within the
data center. If the read has to leave the data center for a replica in another data cen-
ter, you will incur network latency, which will ultimately slow down the response
time of your read query.
The other major factor to take into account when deciding the replica counts
within a data center is what failure cases you are willing to accept in your applic-
ation. These break down into two common scenarios:
Two replicas per data center. If a single node in a replica set fails, reads
that were requested with a consistency level of ONE will still succeed. It is
Search WWH ::




Custom Search