Database / Apache Cassandra Intermediate and Advanced interview questions
What is a snitch in Cassandra and what does it do?
A snitch tells Cassandra about the network topology — which datacenter and rack each node belongs to. This information drives two critical decisions: where to place replicas, and which replica a coordinator should prefer to talk to.
- GossipingPropertyFileSnitch: the most common production choice; each node's rack/DC is defined locally and propagated via gossip.
- Ec2Snitch / Ec2MultiRegionSnitch: automatically derive DC and rack from AWS availability zone metadata.
- SimpleSnitch: treats the cluster as one flat datacenter and rack; fine only for single-DC test setups.
With a topology-aware snitch, Cassandra's replication strategy avoids placing all replicas of a partition on the same rack, so a single rack-level outage (like a shared power or network failure) doesn't take out every copy of the data at once. The snitch also lets the coordinator prefer replicas in its own datacenter for reads, cutting cross-region latency.
Choosing the wrong snitch for your deployment (e.g. SimpleSnitch across multiple real datacenters) breaks rack/DC-aware replica placement even if NetworkTopologyStrategy is configured correctly.
More Related questions...