Can I run more than one game session on a single game server process?

Do I need to run as many server processes as number of game session I want to handle by server?
I have one game server connected to to GameLiftLocal and when i try to start second game session using CreateGameSession GameLiftLocal throws FleetCapacityExceeded error.

I know that I can configure only up to 50 processes on single instance.

I need to handle 10000 game sessions each one for 2 players? Should I fork separate threads in single process and in each thread call:
InitSDK and ProcessReady to extend fleet capacity?

Hey @pablo666 -

GameLift currently supports 1 game session per game server process. As you correctly point out, the maximum is 50 processes per instance which means for your game, GameLift can manage 50 game sessions per instance, each with 2 players.

Forking threads within the same process is a clever idea but will still not work because the internal routing logic within GameLift only considers 1 game session per game server process. The other threads would remain idle since GameLift will never route a game to them.

For now to support 10,000 game sessions, you would need to configure your fleet to have 200 instances each managing 50 server processes.

Your suggestion that GameLift support multiple game sessions per server process is a good one and we do know of a few game types that follow that model. We will consider adding this feature to future GameLift updates. Thank you for reaching out!

This is a very important feature. For games such as ours (https://tinyrts.com) that are 1v1 RTS, pretty light network traffic, we should be able to scale very well on a single instance.

The arbitrary cap at 50 processes forces us to (50 * 2 users) 100 users maximum per instance regardless of how well we optimize the code. Being able to support multiple game sessions per server process would enable us to maximize our cost efficiency.

We’d certainly love to see this request prioritized.

1 Like

Is there a link or further information on the progress of this feature? My game is also light on the Networking and would love to be able to host multiple game sessions per process

1 Like

Updating GameLift to support multiple game sessions per process is certainly a request we hear from other game developers and one we are considering. Just today we released FleetIQ and Spot instances [1] that might help you reduce costs even though GameLift continues to support only 1 game session per process.

[1] https://aws.amazon.com/blogs/gamedev/reduce-cost-by-up-to-90-with-amazon-gamelift-fleetiq-and-spot-instances/

1 Like

It looks like this functionality has been added. “A fleet can have many instances, each one capable of hosting multiple simultaneous game sessions .” - https://docs.amazonaws.cn/en_us/gamelift/latest/developerguide/gamelift-howitworks.html

I assume this works automatically by having each game process use a different port. Is that correct?

Yes, each instance in your fleet can run multiple copies of your game server; each game server can host a single game session. Each server runs on it own port.

You set the port in the ProcessParameters of the ProcessReady call along with the log path for that particular server.

For now the only restrictions are that each game server can only host one game sessions at a time and you can only host 50 game servers per instance.

I know this is an old thread, but it also shows the demand for the ability to run more than one game session on a single game server process since 2017, 3 years ago…

@Pip I think @Brett_Yeager is actually talking about running more than one game session on a single game server. But I get the point where “instance” is an EC2 box that can host up to 50 game server processes. With one-to-one mapping between the game server process and the game session, that means an EC2 instance can host up to 50 game sessions.

This is a serious tech limitation, which leads to a cost pitfall for certain genres, especially for Realtime Servers, which been advertised as a simple message relay server + light server-side scripts.

Let me break down the reasons, taking Realtime Servers with 1v1 gameplay as an example.

Realtime Servers is based on NodeJS, an event-driven application

With NodeJS, you can run hundreds/thousands of concurrent requests per second. Because network application is usually IO-bound. This is especially true for Realtime Servers, which is mostly a messaging relay server with some light server-side logic. Think about a mobile server with 1v1 real-time battle gameplay, each player sends 1 message per second. NodeJS can still handle hundreds of game sessions in just one process.

In a real-world example, back to 10 years ago, a 1v1 gameplay battle game I operated with a similar (and simple) messaging relay architecture hosting on an old AMD Opteron 6128 (Cores: 8, Threads: 8, Single thread rating: 447 cpubenchmark.net) 2.0Ghz 32G memory can handle 5K CCU. It means each CPU thread can handle 625 CCU, roughly 300+ game sessions.

To convert it into a modern cloud environment, for c5.large (the smallest server spec you can rent with GameLift) is a 1 CPU core, 2 threads (vCPU), 4G mem box that running on Intel Xeon Platinum 8124M @ 3.00GHz (Single thread rating: 2084 cpubenchmark.net), the single-thread performance is doubled and you may expect 600 game sessions/threads. Let’s just be conservative to half the number to 600 game sessions (1200 CCU) on c5.large.

With the restrictions of GameLift’s one game server process can only host one game session, and up to 50 server processes on an instance. That means c5.large can only handle 50 game sessions (100 CCU). A huge waste of resources, money, and the scalability of NodeJS.

The 50 game server processes per instance limitation could be memory-bound

NodeJS is running on V8. Some sources suggest a 64MB~256MB is a sufficient amount of RAM to run Node.js (refs).

With c5.large, 4G / 50 ~= 82MB, near to the lowest memory requirements. You need to be more careful about the actual number of game server processes you can run on a small instance. It could be fewer.

The 50 game server processes per instance limitation are not scalable with EC2 specs

Let’s say 50 is a reasonable number for c5.large. Now with c5.4xlarge, I should expect 4 times more game server processes, but you still have 50 there. Does it make sense? That pushes developers to make a decision to find a server spec that can just run up to 50 game server processes, get anything more powerful is a waste.

The 50 game server processes per instance limitation didn’t take different players-per-session into account.

With 50 game sessions/instance, 1v1 gameplay has 100 CCU, 2v2 gameplay has 200 CCU, 10v10 gameplay has 1000 CCU. I’m okay with 1000 CCU on a c5.large. But I shouldn’t purchase far more instances just because my gameplay requires fewer players per session.

players-per-session max CCU/instance target CCU instances required on-demand pricing* spot pricing* home-made pricing*
2 100 1000 10 400 150 40
4 200 1000 5 200 75 40
10 500 1000 2 80 30 40
20 1000 1000 1 40 15 40
  • on-demand pricing for c5.large is estimated as $40.
  • spot pricing for c5.large is roughly estimated as $15.
  • home-made pricing is based on c5.large on-demand pricing.

Can GameLift support multiple sessions per game server process?

It doable but certainly more complex to implement the feature because GameLift has to trust more your game server to correctly manage game sessions. Memory leaking can be a big issue as well. GameLift has to implement more complex schedule logic to restart your game server process to avoid memory leaking.

But on another hand, I’m not sure if we can do the homework ourselves. Even you can call multiple ProcessReady and successfully cheat GameLift to run multiple sessions per game server process, you may break the GameLift server schedule logic.

Conclusions

  • GameLift is good if you have a 5v5 or 10v10 gameplay. The more players-per-session, the fewer impacts on you from the limitation.
  • GameLift is okay for 1v1, 2v2 with complex game logic on the server-side, which you won’t expect a large CCU per instance.
  • GameLift is questionable for 1v1, 2v2 with simple game logic on the server-side. Especially the Realtime Servers which advertised for the simple messaging games. It is less cost-effective (card battle and turn-based genres). It should be a strong selling point for using GameLift Realtime Servers though. IMO without the feature, the entire Realtime Servers idea is useless or at least value dropped.

It’s a feature request since 3 years ago. Will GameLift plan resources on this feature eventually? Or at least make it possible for developers to implement it themselves?

Feedbacks are welcome.

1 Like

I have the same question as @favoyang . Does GameLift plan to add multiple game sessions per game server?

Also, I’m interested in spawning more game servers per game server since it will improve resource usage and will be more secure (since different game sessions will have different processes). Limit 50 per instance is too low for me since my game server seems to be VERY lightweight.

Really, in such cases (very lightweight game session) FMPOV AWS Fargate seems like much more suitable since we can simply spawn one ECS task per game session and use features like FlexiMatch directly from ECS task. Maybe I’m wrong - any help is appreciated!

Thanks in advance!

Just notice that Flexmatch can be very expensive if you use it as a standalone component, especially of 1v1 or 2v2 gameplay. FlexMatch pricing

If you use AWS Fargate then more or less you’re rolling out a homemade solution for the entire stack.

GameLift may be less serious for lightweight servers which requires much less AWS resources (less $).

Thanks for your thoughtful reply,

Hosting multiple sessions per process is really important to some potential GameLift customers and has been in the feature backlog for a while. However, theres no committed date for this feature and unfortunately GameLift doesn’t have a public roadmap. I am pinging the GameLift team so they can see your posts and followup with both of you.

Your talk about Fargate made me wonder if you’ve seen these:

Thanks for all the data.

1 Like

@Pip thanks for the links - I was thinking about a very similar idea! With a sample project that’s much easier to try to play with it.

Hosting multiple sessions per process is really important to some potential GameLift customers and has been in the feature backlog for a while

Consider not only “multiple game sessions per process approach”. I think another possible solution can be just to increase the process count limit per instance. In my case, a game server will be quite lightweight based on Rust and bevy_ecs, memory and CPU consumption will be low, so I can easily spawn more than 50 processes per instance. However, for some use cases (e.g. where we REALLY try to get as less overhead as possible), having a model “one game session per thread” if also fine.

Yeah, will be an overhead per process but that’s a price for security and crash-tolerance, which I am ready to pay. Will be awesome, if I will be able to increase the process count limit per instance via AWS support or something like that. Even it will be in a “beta” state - that’s completely fine for me.

If you need any details from my side or get any further details, which can be helpful for AWS GameLift team - feel free to ping me here or give my email :slight_smile:

Completely agree with you. What I am trying to do now - find cost-efficient solution and at the same time don’t reimplement GameLift stack from the scratch :slight_smile:

Any updates on this? In the same boat. Have a lightweight PVP RT game and only having large instances limited to 50 i think is overkill.

Recently I’ve got a response from AWS Support team:

===================================================================================================================
Good morning,

At this time GameLift Fleets only support a maximum of 50 processes per instance, but I have recorded this feature request with the service team so we can keep track of it. This feedback is invaluable to us as our feature roadmap is driven by customer feedback like this.

GameLift FleetIQ (Game Server Groups) can support a much high count of processes per instance. See if GameLift Game Server Groups fits your use-case:
https://docs.aws.amazon.com/gamelift/latest/fleetiqguide/gsg-intro.html

Please let us know if you have any questions!

Thank you,
Dan

===================================================================================================================

So, as you see, now there is no way to spawn more than 50 instances per node on fully managed GameLift.

Looks like I’ve completely wasted my time the last few days implementing gamelift in our game, as its a card game with a simple relay based server, so this arbitrary limitation of 50 game servers per instance makes it completely useless, and devs have been promising to look into it for more than 4 years now!

1 Like