googleforgames / agones

Dedicated Game Server Hosting and Scaling for Multiplayer Games on Kubernetes
https://agones.dev
Apache License 2.0
6.12k stars 818 forks source link

Cron Job to restart the game server in-place #3907

Open stevefan1999-personal opened 4 months ago

stevefan1999-personal commented 4 months ago

This is an extension of https://github.com/googleforgames/agones/issues/2781, because some game servers apparently have memory leak or game state lost (because game industry loved spaghetti code that worked quick'n'dirty with cowboy programmers because it is a hyper-active industry) when they are running long enough, so we need a periodic time restart (say like during 4AM in midnight) to not let the game server die. Of course, I could always delete the game server externally, but that would also mean a lot of "pod-churning" to the scheduler.

We also need to handle extra cases such as whether the game is still progressing, whether it still have players or not, because obviously it will impact ongoing players' experience. So, the cron is more like a soft-deadline, if either of the above two cases mentioned are true, of course we are not going to restart, but we will restart as soon as the game state is done. We can also introduce an optional hard deadline, say like even if the soft-deadline is triggered and awaiting a chance to restart, but if the soft-deadline is procrastinated long enough say like 2 days, then we will have to force kill it, since something might be wrong with the game server itself.

Relevant ideas: https://furiko.io/docs/execution/jobconfig/scheduling

github-actions[bot] commented 2 weeks ago

'This issue is marked as Stale due to inactivity for more than 30 days. To avoid being marked as 'stale' please add 'awaiting-maintainer' label or add a comment. Thank you for your contributions '

stevefan1999-personal commented 2 weeks ago

no-stale