Suggestions

close search

Add Messaging, Voice, and Authentication to your apps with Vonage Communications APIs

Visit the Vonage API Developer Portal

Server Rotation

Best practices for handling Video API server rotations.

Modern cloud auto-scaling makes it necessary to establish a minimum rotation time for services. Sessions lasting more than 8 hours might be disconnected, as they may reside in services that are scaling out or scaling in.

You can register a callback URL for session events to be sent to your callback URL. When a group of Video API servers for one of your sessions is scheduled to be rotated, a sessionNotification event is sent to your registered callback endpoint. See the Session Monitoring documentation.

If clients remain connected to a session when set of servers shut down because of server rotation, a sessionDestroyed event is set to your callback URL. The reason property of the sessionDestroyed event is set to "serverRotation". And each connected client is disconnected from the session and receives a sessionDestroyed event.

There are steps you should take in response to a sessionNotification event to keep clients connected. (See the next section.)

Responding to server rotation session notification events

When the servers for the session are rotated (one hour after the session notification event is sent), clients connected to the session using those servers will be forced to disconnect from the session. When your application server receives a server rotation session notification callback, it should take action to reconnect the clients to a new session:

  1. Create a new Video API session using the Video API REST API or a Video API server SDK.

  2. Send the session ID for the new session to the clients connected to the session. You may want to use the Video REST API or a Video API server SDK to send the signal to the connected clients. See this documentation.

  3. The clients should immediately disconnect from the original session and reconnect to the new session.

For a more seemless transition between sessions and to minimize any potential reconnection time, clients can remain connected to the initial session and switch the video display before disconnecting from the initial session (upon connecting to the new session).

  1. If there are archives or broadcasts in progress for the original session, you can start new archives or broadcasts for the new session. In the case of broadcasts, you will need to send the new broadcast URL to clients consuming the broadcast.

FAQs

What is Video API server rotation? How frequently are Video API servers updated?

Software cloud scalability requires a continuous ability to rotate servers. Vonage maintains an 8-hour window to avoid excessive rotation of long-lived sessions. Rotations can happen daily.

There are a few main reasons for a media server to be rotated. The main reasons are maintenance, software updates, security patching, infrastructure servicing and elastic autoscaling:

Can I use the same session ID to reconnect once a session is disconnected due to server rotation?

Using a new session ID is recommended to assure that the new session is directed to a new server instance. If the session is disconnected due to server rotation, all clients will be disconnected. If the same session ID is used, the reconnection will be moved to a new server after the session is terminated, following the sessionDestoryed event.