question

brendan avatar image
brendan asked

How are custom game servers spun up/down in PlayFab?

Brendan Vanous
started a topic on Fri, 10 April 2015 at 6:08 PM

Question from a developer:

How does the PlayFab system decide when to spin up and down custom game severs, and how does that relate to "Min Free Slots" in the Game Manager?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

Best Answer
Brendan Vanous said on Fri, 10 April 2015 at 6:09 PM

Here's a quick overview of how custom game servers are managed in PlayFab, starting with some definitions:

  • Game Server Build - Your executable, uploaded to PlayFab with any additional files it needs as a zip.
  • Game Server Instance - An instance of your Game Server Build, running on a Game Server Host.
  • Game Server Host - The hardware or virtual machine which hosts one or more Game Server Instances.
  • Max Instances per Host - The number of instances of the Game Server Build the Game Server Host can support. Ahead of launch, we can work with you on testing and sizing of your servers, to make sure this is as accurate as possible.
  • Min Free Slots - The smallest number of available Game Server Instance slots that should be available at any time.
  • Min Player Count - Specific to each Game Mode, this is the minimum number of players required to start a game.
  • Max Player Count - Specific to each Game Mode, this is the maximum number of players the game can support.

The process for getting a build uploaded and configured is described in more detail in this post. Right now, you do need to set the Min Free Slots in the Game Manager, but we'll get that added to the Add/ModifyGameBuild shortly.

So a real-world example of a configuration might be like so:

Build A

Min Free Slots - 8

Max Instances per Host - 32

For the sake of this explanation, the build only has 1 Game Mode, with a min of 2 players and a max of 16, and it's only running in 1 Region.

If you choose to use your own matchmaker server, your logic can differ, but the logic for adding players to sessions is:

Find a free slot, given the requirements in the Matchmake call. If one is found, allocate it to the user and return the server authorization ticket. If no slots are available, Matchmake creates a new Game Server Instance. The return value then has the necessary information on the Instance, along with the authorization ticket.

In this example, there are 2 Game Server Hosts running with 28 Game Server Instances each (so the two Hosts have capacity remaining for 8 more Instances, in aggregate). If no session is found in matchmaking and a new Instance is spawned, the servers would only have capacity for 7 more instances, at which point the PlayFab server wrangler would spin up a new Host.

As game sessions complete, the Game Server Build should be exiting cleanly. When it does, our wrangler will automatically pull your log and output files into S3, so that they're available in the Game Manager, and the Instance count will be updated. If the Game Server Host that had that Instance no longer has any active sessions, and there are enough free Instance slots across the remaining servers that at least Min Free Slots will still be available if that Host is removed, the wrangler will proceed with shutting down that Host.


1 Comment
Brendan Vanous said on Fri, 10 April 2015 at 6:09 PM

Here's a quick overview of how custom game servers are managed in PlayFab, starting with some definitions:

  • Game Server Build - Your executable, uploaded to PlayFab with any additional files it needs as a zip.
  • Game Server Instance - An instance of your Game Server Build, running on a Game Server Host.
  • Game Server Host - The hardware or virtual machine which hosts one or more Game Server Instances.
  • Max Instances per Host - The number of instances of the Game Server Build the Game Server Host can support. Ahead of launch, we can work with you on testing and sizing of your servers, to make sure this is as accurate as possible.
  • Min Free Slots - The smallest number of available Game Server Instance slots that should be available at any time.
  • Min Player Count - Specific to each Game Mode, this is the minimum number of players required to start a game.
  • Max Player Count - Specific to each Game Mode, this is the maximum number of players the game can support.

The process for getting a build uploaded and configured is described in more detail in this post. Right now, you do need to set the Min Free Slots in the Game Manager, but we'll get that added to the Add/ModifyGameBuild shortly.

So a real-world example of a configuration might be like so:

Build A

Min Free Slots - 8

Max Instances per Host - 32

For the sake of this explanation, the build only has 1 Game Mode, with a min of 2 players and a max of 16, and it's only running in 1 Region.

If you choose to use your own matchmaker server, your logic can differ, but the logic for adding players to sessions is:

Find a free slot, given the requirements in the Matchmake call. If one is found, allocate it to the user and return the server authorization ticket. If no slots are available, Matchmake creates a new Game Server Instance. The return value then has the necessary information on the Instance, along with the authorization ticket.

In this example, there are 2 Game Server Hosts running with 28 Game Server Instances each (so the two Hosts have capacity remaining for 8 more Instances, in aggregate). If no session is found in matchmaking and a new Instance is spawned, the servers would only have capacity for 7 more instances, at which point the PlayFab server wrangler would spin up a new Host.

As game sessions complete, the Game Server Build should be exiting cleanly. When it does, our wrangler will automatically pull your log and output files into S3, so that they're available in the Game Manager, and the Instance count will be updated. If the Game Server Host that had that Instance no longer has any active sessions, and there are enough free Instance slots across the remaining servers that at least Min Free Slots will still be available if that Host is removed, the wrangler will proceed with shutting down that Host.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.