Deallocations

Note: The content on this page pertains to Game Server Hosting (Multiplay) available on the Unity Cloud Dashboard. If you’re using Game Server Hosting (Clanforge), refer to the Game Server Hosting (Clanforge) documentation.

A deallocation is a request to Game Server Hosting from a matchmaker to remove an allocation from a server after the game session finishes, the players disconnect, and the post-processing completes. Deallocating the server returns the server to the available server pool so it’s available for the next game session.

Game Server Hosting only deallocates servers in the following scenarios:

  1. You (or a matchmaker) call the deallocation API.
  2. The game server shuts down cleanly (for example, an exit code 0 if the server is running on a Linux based operating system).

It’s the responsibility of the game server to decide when players have disconnected and it's safe to shut down.

Deallocation flow

The deallocation flow varies depending on the deallocation method your build uses. You can either call the deallocate API endpoint directly or have your game server process end with exit code 0.

If you (or your matchmaker) call the deallocate API endpoint directly, the deallocation flow generally looks something like this:

  1. A game session completes, the players disconnect, and any post-session cleanup completes.
  2. The game server notifies the matchmaker that the match has ended.
  3. The matchmaker requests a deallocation from the Game Server Hosting API.
  4. Game Server Hosting queues the deallocation request.
  5. Game Server Hosting clears the allocation ID from the earlier allocation.
  6. Game Server Hosting returns the server to the available server pool so it’s available for the next game session.

If you rely on your game server process exiting with code 0 when a game session completes (instead of calling the deallocate API endpoint directly), the deallocation flow looks something like this:

  1. A game session completes, the players disconnect, and any post-session cleanup completes.
  2. The game server process exits with code 0.
  3. Game Server Hosting detects that the game server process exited cleanly and queues the deallocation request.
  4. Game Server Hosting clears the allocation ID from the earlier allocation.
  5. Game Server Hosting returns the server to the available server pool so it’s available for the next game session.