With the growing internet world software systems have moved to distributed solutions to leverage horizontal scaling. While data sharding has solved the data store counterpart of the distributed systems, backend systems are still scaled in a stateless manner. As the traffic goes high, backend boxes are increased in a stateless way. It is because the application state is maintained in some external shared systems like Redis.
What if we want to maintain individual states in memory of the boxes itself. That might lead to high RAM requirements per machine to store complete app state. What if we make the application state itself sharded over backend boxes, which means boxes will have to communicate with each other to reach out to the right member. That sounds like Cassandra ring architecture.
As the number of boxes is pretty dynamic in backend systems, consistent hashing should be used. SWIM protocol talks about this peer-to-peer gossip paradigm. Uber implemented SWIM with a slight variation to come up with what they call Ringpop for cooperative application scaling.
Use Cases
- In-memory distributed caching
- Stateful HTTP long polling
- Rate limiters etc.