Two instances in the same machine.

Options
roberto_sc
edited February 2012 in Photon Server
Hello
I have one stable version of my server-side application and one developer version, therefore 2 dll's. I'd like to be able to instantiate both on the same machine, using different ports to distinguish.
Is that possible?
I'm using Photon 2.x.
Thank you.

Comments

  • dreamora
    Options
    yes you can create 2 instances in the configuration and start them both / restart them as needed.
  • Thank you Dreamora

    Ok, so to test, I created a copy of my Server.Match.dll called Server.Match.STABLE.dll in the same directory and changed this line in the PhotonServer.config:
    Assembly="Server.Match"
    
    to
    Assembly="Server.Match.STABLE"
    

    But I cannot start the application. I didn't create another instance, I was just trying to change the dll name. The output was this:
    2752: 11:44:19.545 - Config File: C:\Users\Administrator\Desktop\Photon\bin_Win32\PhotonServer.config
    2752: 11:44:19.545 - Will NOT produce crash dumps
    2264: 11:44:19.810 - ---
    2264: 11:44:19.810 - Server Starting...
    2264: 11:44:19.810 - Photon Version: 2.6.7.525
    2264: 11:44:19.810 - Current directory is: C:\Windows\system32
    2264: 11:44:19.810 - Changing current directory to: C:\Users\Administrator\Desktop\Photon\bin_Win32
    2264: 11:44:19.826 - About to load runtime: PhotonHostRuntime.PhotonDomainManager from PhotonHostRuntime, Culture=neutral, PublicKeyToken=02C301B61B060C4D
    2264: 11:44:19.826 - About to load CLR - versions available:
    2264: 11:44:19.826 - v2.0.50727
    2264: 11:44:19.826 - v4.0.30319
    2264: 11:44:19.826 - No preference in configuration file, will load latest.
    2264: 11:44:19.826 - About to load version: "v4.0.30319"
    2264: 11:44:19.826 - Loaded version: "v4.0.30319"
    2264: 11:44:21.682 - Photon host runtime loaded
    2264: 11:44:24.053 - License is valid.
    2264: 11:44:24.053 - Licensed for 100 concurrent connections.
    2264: 11:44:24.053 - Max Reliable Data In Transit (awaiting ACKs) per peer : 16384 bytes
    2264: 11:44:24.053 - Per peer bandwidth limit
    2264: 11:44:24.053 - Transmit Rate Limit: 128 KB/Sec
    2264: 11:44:24.053 - Limit period: 250ms
    2264: 11:44:24.053 - Limit per period: 32768 bytes
    2264: 11:44:24.053 - Max queued data for transmission per peer: 65536 bytes
    2264: 11:44:24.053 - Minimum retransmit timeout: 200
    2264: 11:44:24.053 - Minimum ENet timeout: 5000ms
    2264: 11:44:24.053 - Maximum ENet timeout: 30000ms
    2264: 11:44:24.053 - ENetHost: Using Timer Wheel
    2264: 11:44:24.053 - About to load application: Match from Server.Match.STABLE
    2264: 11:44:24.053 - Auto restart is enabled for application
    2264: 11:44:24.053 - Application will restart 10000ms after the last change detected
    2264: 11:44:24.053 - Application will restart if files matching the following are changed: "dll;config"
    2264: 11:44:24.053 - Application will NOT restart if files matching the following are changed: "log4net.config"
    2264: 11:44:25.145 - ERROR: Failed to start application: "Match" in app domain: 2
    3592: 11:44:25.161 - CManagedHost::OnDomainUnload() - 2
    

    I was looking for a silly name mistake but everything seems right. Do you know where I could find a more detailed log about what happened?
  • dreamora
    Options
    did you ensure to add a new instance and properly configuring the stable / instable as distinct applications? (you can't have 1 application with 2 distinct versions)
  • No, I didn't even try to create a second instance, I was just trying to make my current instance use a different dll.
    I'm not the person that did the server setup in the first time, so I do know if I'm doing the right thing. I only changed that specific line in PhotoServer.config. Is there anything else to make it use another dll?

    After this works, I will try to create the second instance.
  • dreamora
    Options
    Did you shut down the instance and photon control before changing the config (or after it, you need to restart them anyway to make config changes taking effect)


    I assumed you want two distinct instances / applications because you asked about 'running two' not 'one or the other' :)
    Though in both cases using two instances to fire them up / down at will helps a lot as you can update them independently etc
  • You are right, I want two, but before trying both I was just trying to run one with the other dll.
    I found what was wrong: I was simply renaming the file via windows, I didn't know I had to change the Assembly Name in the project settings and generate a new dll.

    Another problem:

    I'm now trying both instances. I can connect to the first, but not the second. I don't think it's a dll problem because both dll's have the same code.

    netstat showed that PhotonSocketServer.exe is using the first instance port, but no one is using the port of the second instance.

    The bad thing is that the PhotonControl icon shows that the service is running and PhotonCLR.log doesn't give a hint of what's going on:
    2012-02-23 16:33:11,194 [ 1] DEBUG PhotonHostRuntime.PhotonDomainManager - PhotonDomainManager created
    2012-02-23 16:33:11,257 [ 1] DEBUG PhotonHostRuntime.PhotonDomainManager - PhotonDomainManager created
    2012-02-23 16:33:11,257 [ 1] DEBUG PhotonHostRuntime.PhotonDomainManager - InitializeNewDomain PhotonSocketServer.exe
    2012-02-23 16:33:11,272 [ 1] INFO  eGob44XeLWsaIthygu.eYGdYnvfU6R6wZfBEX - ### PhotonHostRuntime.Licensing: Getting license information...
    2012-02-23 16:33:13,472 [ 1] INFO  eGob44XeLWsaIthygu.eYGdYnvfU6R6wZfBEX - LICENSE: Expiration: never; floating license: yes; max connections: 100; valid IPs: any
    2012-02-23 16:33:13,487 [ 1] INFO  PhotonHostRuntime.PhotonDomainManager - CreateAppDomain Match , Server.Match.STABLE
    2012-02-23 16:33:13,487 [ 1] DEBUG PhotonHostRuntime.PhotonDomainManager - CreateAppDomain: ApplicationBase = C:\Users\Administrator\Desktop\Photon
    2012-02-23 16:33:13,487 [ 1] DEBUG PhotonHostRuntime.PhotonDomainManager - CreateAppDomain: PrivateBinPath = Match\Match;Match\Match\bin;bin_Win32;Shared
    2012-02-23 16:33:13,487 [ 1] DEBUG PhotonHostRuntime.PhotonDomainManager - CreateAppDomain: ConfigurationFile = C:\Users\Administrator\Desktop\Photon\Match\Match\bin\Server.Match.STABLE.dll.config
    2012-02-23 16:33:14,689 [ 1] INFO  PhotonHostRuntime.PhotonDomainManager - CreateAppDomain MatchTest , Server.Match
    2012-02-23 16:33:14,689 [ 1] DEBUG PhotonHostRuntime.PhotonDomainManager - CreateAppDomain: ApplicationBase = C:\Users\Administrator\Desktop\Photon
    2012-02-23 16:33:14,689 [ 1] DEBUG PhotonHostRuntime.PhotonDomainManager - CreateAppDomain: PrivateBinPath = Match\Match;Match\Match\bin;bin_Win32;Shared
    2012-02-23 16:33:14,689 [ 1] DEBUG PhotonHostRuntime.PhotonDomainManager - CreateAppDomain: ConfigurationFile = C:\Users\Administrator\Desktop\Photon\Match\Match\bin\Server.Match.dll.config
    2012-02-23 16:33:14,923 [ 9] DEBUG eGob44XeLWsaIthygu.eYGdYnvfU6R6wZfBEX - Reached license monitor.
    2012-02-23 16:33:15,781 [ 1] INFO  PhotonHostRuntime.PhotonDomainManager - CreateAppDomain CounterPublisher , CounterPublisher
    2012-02-23 16:33:15,781 [ 1] DEBUG PhotonHostRuntime.PhotonDomainManager - CreateAppDomain: ApplicationBase = C:\Users\Administrator\Desktop\Photon
    2012-02-23 16:33:15,781 [ 1] DEBUG PhotonHostRuntime.PhotonDomainManager - CreateAppDomain: PrivateBinPath = CounterPublisher;CounterPublisher\bin;bin_Win32;Shared
    2012-02-23 16:33:15,781 [ 1] DEBUG PhotonHostRuntime.PhotonDomainManager - CreateAppDomain: ConfigurationFile = C:\Users\Administrator\Desktop\Photon\CounterPublisher\bin\CounterPublisher.dll.config
    

    I also noticed that it is producing that daily log for instance 1 (Photon-Instance1-20120223.log) but not for instance 2.
  • Finally got it working. I didn't know PhotoControl was only able to control one instance. This post helped me:
    viewtopic.php?f=5&t=584