Database / Apache Cassandra Intermediate and Advanced interview questions
What is the difference between SimpleStrategy and NetworkTopologyStrategy?
These are Cassandra's two main replication strategies, and they answer the same question — "where should replicas go?" — very differently.
| SimpleStrategy | NetworkTopologyStrategy |
| Places replicas on the next nodes clockwise on the ring, ignoring topology. | Places replicas per-datacenter, respecting rack awareness within each DC. |
| Single replication factor for the whole cluster. | Separate replication factor configured per datacenter. |
| Suitable only for single-datacenter test/dev clusters. | Required for any multi-datacenter production deployment. |
-- SimpleStrategy CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 3}; -- NetworkTopologyStrategy CREATE KEYSPACE prod WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1': 3, 'dc2': 3};
Because SimpleStrategy has no concept of racks or datacenters, it can accidentally place every replica of a partition in the same rack, defeating the purpose of replication when that rack fails. Almost every real production keyspace should use NetworkTopologyStrategy, even on a single datacenter, since it's rack-aware and makes future multi-DC expansion straightforward.
More Related questions...