Game server CPU usage and throttling

Hi all!

I’ve been trying to provision enough resources for my game server. Before the throttle changes everything was working pretty smoothly, but now I struggle running my game server with 4x shared cpu and 2048 ram. I don’t really understand what is going on inside the machine:

Could someone clarify why there is throttle even though the balance seems to be ok, and baseline/utilization is pretty even?

I also struggle on figuring out the optimal server size for the game server. Locally since I have a pretty powerful PC, everything works smoothly. Ideally I would like to get along with the smallest cpu as possible, since I plan to allow users to create the servers, meaning I might get some big bills if I use the most powerful server tiers…

The servers are simple Bun servers that run javascript (babylonjs null engine).

Hi… The “balance” line actually uses the scale way over on the right-hand side (double Y-axis).

I.e., it’s reading 5 milliseconds, which actually means zero (due to an odd quirk in the dashboard):

The utilization (the green part) is pinned right up to the yellow dashed line (“baseline”), which means that you really are being throttled. The red line is how much more your system really wants, loosely speaking…

Personally, I would try this out on a single-CPU performance-class Machine, even if that’s not ultimately what you want to deploy. That would prevent the multi-core and throttling aspects from muddling things—and give you a better idea of what the real minimum actually is…

Hope this helps a little!

2 Likes

Thanks for the reply! :smiling_face_with_sunglasses:

Oof ok that is a bit misleading :melting_face:

Yeah I’ve been thinking about this as well. The problem is the price; it is soooo much more expensive that lets say single 1 shared cpu or even the 4 I am using atm. But I’ll definitely try this. I’ve been also thinking about trying to optimize the server code more, but I’m still afraid of running into issues with “unpredictable” load increases for example too many physics objects.

I’ll report after testing a bit with the performance cpu :saluting_face:

1 Like

Yeah, we’re aware of this issue, and hoping to eventually deploy some updates to the query in that panel that should make it less confusing (the blue ‘balance’ line should stick at the bottom when it reaches its minimum balance, ie 5ms). Sorry that it led to confusion!

1 Like

Ok hi guys again! :waving_hand:
The performance machine is stable at least on the same load (which is not that much hehe):

The game feels like it does when hosting locally which is great! Also there seems to be room for additional computations like if the object/entity count increases. However what is still not great is this
image
compared to this
image

I think what would suit me is something in between those, since I do have a single core process (Bun) running there. This is a bit wobbly case though, since my game involves physics engine (havok) and navmesh calculations, which are both running in webassembly modules. I am running for example the physics server side only to be able to free the client for more graphical processing especially on mobile devices.

My goal in the game is to create game servers on fly (heh), and that part is already working pretty smoothly. Future gamers would go out on an roguelite adventure spawning multiple servers, each hosting one level at a time. Typical game session would be something like 15-30 minutes for a single run, not that costly in server time. But the more costly the server, the more “on the edge” I have to be not to go bankrupt really, IF the player count in the future goes up. Also, I will need to enforce the server creation somehow as well. This is why I try to get away with the smallest available server instance, I am a one man developer and my wallet is not that thick :sweat_smile: :money_with_wings:

So here are some solutions:

  • Fly somehow makes a server tier just for my needs/game servers (semi performance tier or something lol)
  • I find some optimizations for the CPU usage in the game server code
    • This might be hard if I can’t find any big wins, since with new features the CPU cycle time might increase a bit more…
    • Will try to look into this though, for example if there are some taxing problems with serialization or something…
  • Hop to the self hosting train
    • Would not like to do this since game dev is hard on itself and learning to self host is another detour

Finally I’d like to say that I do like Fly so much that I would like to keep using this platform :kissing_face:

As just an additional angle consider, you could make the computing limitations be an organic part of the rules themselves, too.

The term “roguelike” may have evolved since last I checked, but I consider machine availability restrictions to be a traditional hallmark of that genre…

“The Wizard of Yendor has decreed that there shall be no further levels until 6:30pm this evening.”

(The “wizard” here preferred himself to be referred to as “university sysadmin”, but still…)

Not just you, actually… @Hypermind proposed calling this the “flex” class:

Fly.io gave encouraging feedback at the time, but in the interim they’ve (rightly) been focused mainly on finally slaying the reliability dragon, :dragon:.


Having said that, with just a single thread, a shared-8x might be close enough:

The reported metrics might revert to being a little confusing, however—since, IIRC, some of them are divided (÷) by the number of CPUs…

2 Likes

Haha yeah that would be funny! :laughing: But I’m thinking of implementing some sort of ticket system for server creation though!

This is interesting :thinking: I hope someone from Fly would comment on if they are looking into this in near future :eyes:

Yeah I guess I have to test this out too. Also going to test very high load with the performance machine soon.

Also I am kind of worried of throttle in my case, since last time it kind of caused some weird erratic behaviour… Or so I think at least. I should investigate more on what happens in the Bun process on throttle. I am kind of terrified of packet losses :smiley:

1 Like