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.
Also pay attention to the values for
MaxConcurrentGameSessionActivations in your CreateFleet settings, both can impact the availability of new sessions.
This solidifies it for me, thank you!
How to communicate with GameLift Server with Java Clientasked 6 months ago
Shutdown Gamelift Sessionasked 3 years ago
PlayerSessionIds only accepted sometimes by gamelift serverasked 3 years ago
Simultaneous client requests to create game sessionsAccepted Answerasked a year ago
Looking for Flexmatch process flow, How to and/or samples (Unity client)asked 4 months ago
How to create a client authoritive player for a multiplayer gameAccepted Answerasked 5 years ago
GameLift - Custom server executable can't seem to access a .dll in the game folderasked 18 days ago
How GameLift Local works with game sessionsAccepted Answerasked a year ago
Create client in UnityAccepted Answerasked 5 years ago