shutting down game server gracefully

Options
KevinB
KevinB
edited August 2013 in Photon Server
Hi,

I am currently using the Loadbalancing example with 1 Master and 1 game server. I have EnableAutoRestart turned on so that when I update game server binary or config file, games will restart gracefully(wait until everybody disconnect).

now I am upgrading to another bigger game server, and would like a smooth transition. I want to disconnect the previous(smaller) game server from the master so that the master will only direct traffic to the new bigger game server. I don't want to abruptly shut down the small game server because users are still playing in there. is there a way it can wait until everybody disconnect, then shut down? Thanks

K

Comments

  • Hello Kevin,

    we have prepared a mechanism to take a Game Server "out of rotation", which means that new games are not created on that server any longer (although existing, open games are still visible and can be joined). It can be set on the "WorkLoadController" of the GameApplication (which sends an event to the master server, which in turn stops to assign new games to that GS).

    // take out of rotation:
    GameApplication.WorkLoadController.ServerState = ServerState.OutOfRotation

    // bring back "into rotation":
    GameApplication.WorkLoadController.ServerState = ServerState.Normal

    The only thing is missing is that you need to let your GS know when it should set itself as "out of rotation". There are several ways, for example:

    - You can add a text file to your Photon directory, which contains the "server state" - you can update it manually when you want to set a GS "out of rotation". Then add a file watcher to the GameApplication class, monitor that text file and update the WorkLoadController's ServerState when the file has changed.

    - add a special config setting

    - implement an operation that can be called from a "management client", in case you have one.

    Hope this helps!
  • KevinB
    Options
    thanks Nicole,

    ah ic. I guess i can also set all the open game on that GS to be invisible to make sure no new client peer connection will be established. Thanks!

    K
  • Yes, that's a good idea, too.