
Implement a round-robin load balancer that selects among service nodes, skipping unavailable nodes and wrapping around correctly. Fix typical pitfalls: avoid typos in status constants, ensure the current-index state persists correctly across calls (thread-safe, no unintended resets), and guarantee the algorithm never returns an unavailable node; add comprehensive unit tests to catch these cases. Then implement a consistent-hashing load balancer with virtual nodes; support node additions/removals with minimal key movement and demonstrate how you locate the next available node when the initial target is down. Compare the two approaches in terms of time/space complexity, rebalancing behavior, cache affinity, failure handling, hotspot risk, and typical production use cases.