Apache Cassandra

Snitch Types & Topology Awareness

Understand how snitches inform Cassandra about network topology to optimize replica placement and request routing.

A snitch tells Cassandra about the network topology of the cluster — specifically, which datacenter and rack each node belongs to. This information is used by NetworkTopologyStrategy for replica placement, and by the coordinator for routing requests to the nearest/fastest replicas when possible.

A snitch is like a company org chart that tells the mailroom which building and floor each employee sits on, so internal mail can be routed efficiently and backup copies of documents can be deliberately stored in different buildings rather than accidentally all ending up on the same floor.

Key Concepts

1
The SimpleSnitch is topology-unaware and treats the entire cluster as one datacenter and rack — suitable only for single-DC development clusters. The GossipingPropertyFileSnitch is the most commonly recommended production snitch: each node's DC/rack is defined locally in a cassandra-rackdc.properties file, and this information is then propagated cluster-wide via gossip, avoiding the need for every node to have a complete static map of the whole cluster.
SimpleSnitchGossipingPropertyFileSnitchcassandra-rackdc.properties
2
Cloud-specific snitches like Ec2Snitch and Ec2MultiRegionSnitch automatically derive datacenter and rack information from AWS metadata (availability zone and region), simplifying setup in cloud deployments. Similarly, GoogleCloudSnitch exists for GCP deployments.
Ec2SnitchEc2MultiRegionSnitchGoogleCloudSnitch
3
Choosing the wrong snitch, or misconfiguring rack/DC assignments, can silently undermine fault tolerance — for example, if the snitch reports incorrect rack information, NetworkTopologyStrategy might place multiple replicas of the same partition on nodes that share actual physical failure domains.
NetworkTopologyStrategy