Number of Applicaition Instances Running

Options
qaz
qaz
edited September 2013 in Photon Server
Hello,
Is it possible (if yes how) to find out number of instances currently running on application start? :?:

I mean when i set EnableAutoRestart="true" in photonserver.config
and owervrite app files with new one -I'll have 2 instances.
So when 2nd instance is starting up can i know (in Application.Setup() maybe) that there is another instance of the same application already running?

Comments

  • qaz
    Options
    Is it at least possible to restart single application instead of restarting photon?
  • Philip
    Options
    > Is it possible (if yes how) to find out number of instances currently running on application start?
    no - sorry we don't have that feature. May I ask what you would use it for?

    > I mean when i set EnableAutoRestart="true" in photonserver.config and owervrite app files with new one -I'll have 2 instances.
    yes - all new connections will be routed to the new one. Once all connections of the old instance are disconnected the - old-instance will be shutdown.

    If you want restart but only one instance use ForceAutoRestart="true" in the config ... this setting aborts all connections of the old instance.

    > Is it at least possible to restart single application instead of restarting photon?
    yes - you can setup a ConfigServer to connect per telnet or putty (in putty make sure you select connection type "RAW").

    [code2=xml]<ConfigServer
    IPAddress="127.0.0.1"
    Port="6061"
    ListenBacklog="5">
    </ConfigServer>[/code2]

    You'll get a menu - WITH list you get a list of applications (numbered #) and you can stop/restart them with STOP # / RESTART #.

    menu:
    Welcome to the Photon application configuration server

    Type help and press return to list available command

    ->help

    The following commands are accepted:
    LIST - display the status of all applications
    STOP # - stop the application specified
    START # - start the application specified
    RESTART # - restart the application specified
    KILL # - stop the application specified, don't wait for users to quit
    KISTART # - restart the application specified, don't wait for users to quit
    GC # - force a garbage collection for the specified generation
    QUIT - close your connection and leave the server
    SHUTDOWN - shut the entire server down
    HELP - display this list
  • qaz
    Options
    Thanks for answering, Philip.
    I have a game, when users starts to play he has some money blocked in database, upon finishing a game his balance gets updated and money unblocked accordingly.
    When I make some minor updates to server I want connected users to go on playing their games, so I use [EnableAutoRestart="true"] to start-up new instance.
    At this point I have some issues:
    1. Normally I would want blocked money returned to users on application start (in case: application stoped, server crashed, etc..), but If i'm just uploading a newer version of application, then refunding money would be incorrect as it would affect currently playing users on old instance.
    For now I have that code commented out, that's why I wanted to know If another instance of application is running.
    2. The game is based on litelobby application, games from lobby are opened in new window (new connection to server).
    When new instance of application is started, users who try to join a game from old lobby (connected to old instance) - their opened window connects to new instance and the game is not available here. Is it somehow possible to connect to old instance for a new connection?
    For now after trying to connect unsuccesfuly they refresh lobby, it'd be good if I could send them message in lobby ("new instance is running, please refresh a page"), I know this can be done manually I already have writtien some admin app, buy maybe you could add some automatic message sending (when new instance is started send message-code to old connections and we could handle it depending on our needs)

    These are not such a huge issues, I just want games running as flawless as possible.

    P.S.
    I like photon, you've done a great job ;)
    Hope you make it better with time.