Simultaneous client requests to create game sessions
I have a Unity Custom GameLift server deployment and everything seems to startup, run, and shutdown correctly. The clients can connect to the server and communicate as expected. So all works well in general.
My concern is for the case when there are no active game sessions and two clients request to create a new game session at the same time. With my setup, only one of them gets created and the other client errors out with FleetCapacityExceededException: Unable to reserve a process on fleet
. This create call is wrapped in a retry block so it does retry again after 2, 3, then 5 seconds, but still fails.
The Launch Path for the Unity game executable has Concurrent processes set to 1. The Max concurrent game sessions activation is set to No Limit. There’s only one active server instance.
I guess I expected that simultaneous requests to create game sessions would actually spawn multiple sessions. Maybe I’m not understanding the relationship between the Concurrent processes of the game executable and game sessions. Can you have multiple game sessions for a single game process?
Any feedback or help would be greatly appreciated. Thank you
You are right, if you don't have have available processes to host game sessions, your creategamesession calls will fail with that exception. You can use autoscaling, multiple processes per instance etc to get around this problem. Your Fleet metrics should show you all the data you need.
Also ensure you are terminating game sessions correctly to free up the server process for another session.
And you are also right that when running multiple servers per instance, each server needs to run on its own port and accurately report that port via the ProcessParams passed via ProcessReady.
Ok, after some more experimentation and a couple re-reads of other posts, it is my understanding that the allowed amount of Game Sessions is tied directly to the number of Concurrent processes for the game executable configured in the fleet.
The reason my simultaneous create game session requests failed is because there wasn't another available process to run the game.
I also want to say that if you have multiple game sessions, make sure your server picks a different port for each game session, otherwise you'll have some potential cross session communication.
If someone else can weigh in on whether or not this is accurate, that would be awesome.
thanks
Also pay attention to the values for GameSessionActivationTimeoutSeconds
and MaxConcurrentGameSessionActivations
in your CreateFleet settings, both can impact the availability of new sessions.
Relevant questions
How to communicate with GameLift Server with Java Client
asked 6 months agoShutdown Gamelift Session
asked 3 years agoJavascript as a Game client for a Gamelift Server
asked 3 years agoPlayerSessionIds only accepted sometimes by gamelift server
asked 3 years agoSimultaneous client requests to create game sessions
Accepted Answerasked a year agoLooking for Flexmatch process flow, How to and/or samples (Unity client)
asked 4 months agoHow to create a client authoritive player for a multiplayer game
Accepted Answerasked 5 years agoGameLift - Custom server executable can't seem to access a .dll in the game folder
asked 18 days agoHow GameLift Local works with game sessions
Accepted Answerasked a year agoCreate client in Unity
Accepted Answerasked 5 years ago