MusivaDocs
Lavalink Infrastructure

Failover & Node Maintenance

Automated session migration, health check timeouts, and zero-downtime rolling maintenance workflows.

In traditional Lavalink configurations, taking down a server for a security update or kernel patch abruptly terminates all active music players on that machine. The Musiva Lavalink Gateway introduces automated failover and rolling maintenance capabilities.


The Failover Lifecycle

When an active node becomes unhealthy or loses connectivity to Discord:

Rendering diagram...
  1. Heartbeat Detection: The Gateway sends lightweight WebSocket pings to each registered node. If a node fails to respond within the configured timeout window, it is flagged as Degraded.
  2. Session Evacuation: Active player states (track URI, position offset, volume, and active filters) are synchronized.
  3. Session Rehydration: The Gateway binds the evacuated player session to the least-loaded healthy node (Node B).
  4. Voice Server Handshake: Discord voice session credentials are transmitted to Node B, restoring voice UDP delivery.

Actual player continuity during automated failover depends on the player's session resume state, network buffer depth, and upstream provider constraints.


Planned Rolling Maintenance

Administrators can gracefully evacuate nodes prior to performing operating system updates or restarts:

  1. Open the Gateway Admin Dashboard.
  2. Set the target node to Drain Mode.
  3. In Drain Mode, the Gateway:
    • Stops accepting new player requests on that node.
    • Allows existing tracks to finish playing or seamlessly transfers them to standby nodes.
  4. Once active sessions reach 0, the node is safe to reboot or upgrade.
  5. After reboot, setting the node back to Active immediately re-enters it into the load balancing pool.