Database / Apache Cassandra Intermediate and Advanced interview questions
What are virtual nodes (vnodes) and why does Cassandra use them?
Before vnodes, each physical node owned exactly one large, contiguous token range on the ring. That made rebalancing painful: adding or removing a node meant recalculating and manually moving huge chunks of token ranges.
Virtual nodes (vnodes) let each physical machine own many small, randomly distributed token ranges (controlled by the num_tokens setting) instead of one big one.
- Even distribution: data and load spread more evenly across the cluster, even with heterogeneous hardware.
- Faster rebuilds: when a node joins or leaves, its many small ranges are sourced from and distributed to many different nodes in parallel, instead of one or two neighbors carrying the whole burden.
- Simpler operations: no need to hand-calculate token assignments when scaling the cluster.
# cassandra.yaml num_tokens: 16 # typical modern default, was 256 in early versions
The trade-off is slightly higher metadata overhead and more replicas potentially involved in any single repair, but for almost all production clusters the operational simplicity and even load distribution are well worth it.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
