Gamelift architecture design and prices

I’m familiarizing myself with the realtime architecture: https://docs.aws.amazon.com/gamelift/latest/developerguide/realtime-architecture.html and also looking at the prices https://aws.amazon.com/gamelift/pricing/ and got some related questions pls.

  1. Is there any drawback with using a Lambda for Client Service(for auth and inventory)? When would you use EC2 instance for it and how could this be scaled if necessary?
  2. What is an instance from the pricing page in case of the above architecture? Is it the Realtime Server (in the fleet) ?

Thanks!

Hello! Before actually answering your question, I would recommend you to check out another Amazon Game Service product: GameSparks [1] – it is a managed solution that seems to fit your use case very well. It could help you quickly get the boilerplates (inventory, auth, achievements, etc.) out of the way, so you can focus more effort on your actual game development. If you decide to go with GameSparks in long term, it is also scalable out-of-the-box.

  1. IMO the biggest drawback of using a lambda is that it can be quite expensive if you have frequent calls and/or expensive computations. With lambda, you are charged per request and duration of the request; e.g. each time your player logs in, or each time when your player opens its inventory or conduct a transaction, you have to invoke lambda to do a database lookup. All of those lambda invocations will cost you. On top of that, you have to setup Provisioned Concurrency [2] to overcome Lambda cold start problem, which will further increase the operational cost. With a dedicated EC2 instance, you might be able to achieve a lower cost as you only pay for duration of the instance uptime. You can use AutoScalingGroups to scale up and down the EC2 instances. With the “Multi Instance Type and Purchase Options” feature [3], you have lots of options to scale instances while keep price low and availability high.

  2. Instance is where the realtime servers are executed on. The realtime servers are NodeJS processes running your JavaScript that is listening to different ports (8000, 8001, etc.) on an instance. An instance can have multiple Realtime servers (depends on your concurrency settings), and a fleet can have multiple instances (depends on your scaling settings).

[1] https://docs.gamesparks.com/getting-started/
[2] https://aws.amazon.com/blogs/compute/new-for-aws-lambda-predictable-start-up-times-with-provisioned-concurrency/
[3] https://aws.amazon.com/blogs/aws/new-ec2-auto-scaling-groups-with-multiple-instance-types-purchase-options/

James

2 Likes

Thanks a lot for the golden info @James-AWS !

Gamesparks indeed has many great features, but looking at its pricing i think this is not for me (a prototype or small project of a just starting developer). At the bottom of this page there is a ‘Per month’ fee: https://gamesparks.com/pricing/ If i understand this correctly, this is the base cost. So i think as starter, im gonna go with AWS Cognito for auth and work out some social features myself.

I have a follow-up question pls. Is there a way to see resource usage data, especially memory, on a given instance in a Fleet in Gamelift? I want to be able to fine tune provisioning based on resource usage by Realtime scripts on game servers.
So maybe there is plenty of unused CPU left, but since all the memory is used up, Gamelift spins up another instance (based on scale config ofc). Or vice-versa. And maybe choosing another EC2 type would be more efficient with the given Realtime scripts.

The only place i found a description about memory usage monitoring is this EC2 related one: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/mon-scripts.html But here i supposed to install something to be able to get the data and i think i won’t be able to do that if i use Realtime servers. Am i missing some information? How would you do this kind of monitoring?

Thanks!

Edit: ok, looks like there is a workaround. I can get CPUUtilization of a given EC2 instance. So i can check this when there are more than 1 instances running and if the CPU usage is not 100%(probably the threshold is a bit lower than this) on the first instance, then the scale out most probably happened due to insufficient memory. Still nothing concrete, but at least i have a hunch.

Maybe i should ask this topic in a separate question. Coz im also wondering if i have one, almost fully utilized instance(let’s say i can catch this point somehow) and if i check the number of the game sessions (reference here) and divide the instance’s max memory with this number, then i can get the memory used for one session… Probably im already too deep down the rabbit hole. :slight_smile: Not sure these insights are really going to help. But im curious anyway.