Creating servsers at runtime

Options
ahsan_cheema
edited September 2013 in Photon Server
Guys my application is like rooms but in the room what i wanna do is share chat,voice,even video .so what i am suggesting myself is to create a new master server for each room which furthur have subservers for chat,audio ..how can i create a new server at runtime? cos i dnt know number of rooms .even users can create rooms..what i understand is i have to add a entry of the server in config file ..thats what i cant do at runtime.right?
any other suggestion?

Comments

  • please reply its urgent for me..
  • Hello,

    please understand that we can only provide forum support during our office hours.

    It is correct that there is no built-in way to add new Photon instances to the same server dynamically during runtime.

    And, honestly, I don't think that it would be useful for you. There is absolutely no need to create a new "master server" for each room, because each Photon instance can handle multiple rooms & several users just fine.

    If you start multiple Photon instances on a single server, each Photon instance would also need a separate set of IP/Ports, which must probably be added to your firewall etc. - and there is no benefit to run multiple Photon instances on a single server, we recommend to use 1 Photon per server and add more servers if you need more capacity.

    So there are different ways to go:

    1. One Master server and X Game Servers, which handle all kind of traffic (games, chat, voice chat etc. all on the same server).

    You either need to make an up-front estimation how many servers you need in total, or you could use a hosting provider where you can start pre-configured images automatically (Azure is a good example, but many other hosting providers, like SoftLayer, have an API for automated VM provisioning as well).

    2.
    - one Master Server (each client initially connects to the Master for matchmaking)
    - a number of X Game Servers for "game logic"
    - a number of Y Audio Servers
    - a number of Z Video Servers
    ... etc.

    These "subservers" all register to the Master server, and whenever a user creates a room / joins a voice chat / shares a video etc., the master lets him know which server has sufficient capacities to handle that request.

    You can modify the Master's loadbalancing algorithm to hold lists of different server types. etc (see http://doc.exitgames.com/photon-server/ ... g/#mslbalb for a starting point).

    Again, you need to calculate upfront how many users you'll have or provide new servers on demand (but that is not specific to Photon).

    There are lots of other solutions (including the use of third-party services, of course, which might save you a lot of work ;)) - this should just give you an idea how you could approach your problem.

    Let me know if you have further questions.
  • thank you very much ..now i have multiple Sub servers and one master .Its working fine but when i connect to master on UDP it works just fine but when i connect to TCP listner it throws a Socket exception which says connection closed by remote Server .Btw 4530(TCP) port is listning ok ..
  • Can you send me the log files from the client & from the start up sequence of the master + all the subservers?

    It sounds like you are trying to connect to an IP / port where no Photon instance is listening, please double check the settings.
  • 4452: 23:12:10.725 - ---
    4452: 23:12:10.725 - Service: "Photon Socket Server" starting
    4452: 23:12:10.725 - Config File: D:\FYP-ME\Photon\deploy\bin_win64\PhotonServer.config
    4452: 23:12:10.727 - Will produce at most: 10 crash dumps
    4452: 23:12:10.727 - Action: run as service
    4168: 23:12:10.729 - Server Starting...
    4168: 23:12:10.729 - Tick count: 39511122 (wraps in: 49.253 days)
    4168: 23:12:10.729 - Tick count 64: 39511122
    4168: 23:12:10.733 - Photon Version: 3.2.6.2037
    4168: 23:12:10.733 - PID: 5444
    4168: 23:12:10.733 - Current directory is: C:\Windows\system32
    4168: 23:12:10.733 - Changing current directory to: D:\FYP-ME\Photon\deploy\bin_win64
    4168: 23:12:10.733 - Config File: D:\FYP-ME\Photon\deploy\bin_win64\PhotonServer.config
    4168: 23:12:10.737 - Not using performance counters as they are not currently installed. Run the service with /InstallCounters to install them.
    4168: 23:12:10.738 - Max message size: 512000
    4168: 23:12:10.739 - S2S: MaxInboundMessageSize: 512000
    4168: 23:12:10.739 - S2S: MaxOutboundMessageSize: 512000
    4168: 23:12:10.739 - S2S: No inactivity timeout
    4168: 23:12:10.742 - WebSocket S2S: MaxInboundMessageSize: 512000
    4168: 23:12:10.742 - WebSocket S2S: MaxOutboundMessageSize: 512000
    4168: 23:12:10.742 - WebSocket S2S: No inactivity timeout
    4168: 23:12:10.742 - Max Reliable Data In Transit (awaiting ACKs) per peer : 51200 bytes
    4168: 23:12:10.742 - Per peer bandwidth limit
    4168: 23:12:10.742 - Transmit Rate Limit: 256 KB/Sec
    4168: 23:12:10.742 - Limit period: 200ms
    4168: 23:12:10.742 - Limit per period: 52428 bytes
    4168: 23:12:10.742 - Max queued data for transmission per peer: 512000 bytes
    4168: 23:12:10.742 - Minimum retransmit timeout: 200
    4168: 23:12:10.742 - Minimum ENet timeout: 5000ms
    4168: 23:12:10.742 - Maximum ENet timeout: 30000ms
    4168: 23:12:10.742 - Max Inbound Reliable Data Queued (awaiting resends of earlier sequence numbers) per peer : 163840 bytes
    4168: 23:12:10.742 - Outbound ENet: MaxInboundMessageSize: 512000
    4168: 23:12:10.742 - Outbound ENet: MaxOutboundMessageSize: 512000
    4168: 23:12:10.758 - About to load runtime: PhotonHostRuntime.PhotonDomainManager from PhotonHostRuntime, Culture=neutral, PublicKeyToken=02C301B61B060C4D
    4168: 23:12:10.758 - CLRBaseDirectory set to "D:\FYP-ME\Photon\deploy"
    4168: 23:12:10.758 - Optimising event broadcast for 20 or more peers
    4168: 23:12:10.759 - About to load CLR - versions available:
    4168: 23:12:10.759 - v2.0.50727
    4168: 23:12:10.759 - v4.0.30319
    4168: 23:12:10.759 - No preference in configuration file, will load latest.
    4168: 23:12:10.759 - About to load version: "v4.0.30319"
    4168: 23:12:10.762 - Loaded version: "v4.0.30319"
    4168: 23:12:11.075 - Photon host runtime loaded
    4168: 23:12:20.260 - LICENSE: No license file was found. Starting with Bootstrap License.
    4168: 23:12:20.260 - License is valid.
    4168: 23:12:20.260 - Licensed for 20 concurrent connections.
    4168: 23:12:20.260 - ENet: Max Reliable Data In Transit (awaiting ACKs) per peer : 51200 bytes
    4168: 23:12:20.260 - ENet: Per peer bandwidth limit
    4168: 23:12:20.260 - ENet: Transmit Rate Limit: 256 KB/Sec
    4168: 23:12:20.260 - ENet: Limit period: 200ms
    4168: 23:12:20.260 - ENet: Limit per period: 52428 bytes
    4168: 23:12:20.260 - ENet: Max queued data for transmission per peer: 512000 bytes
    4168: 23:12:20.260 - ENet: Minimum retransmit timeout: 200
    4168: 23:12:20.260 - ENet: Minimum timeout: 5000ms
    4168: 23:12:20.260 - ENet: Maximum timeout: 30000ms
    4168: 23:12:20.260 - ENet: Max Inbound Reliable Data Queued (awaiting resends of earlier sequence numbers) per peer : 163840 bytes
    4168: 23:12:20.261 - About to load application: Master from Server2Server
    4168: 23:12:20.261 - Auto restart is enabled for application, existing connections will be terminated during restart
    4168: 23:12:20.261 - Application will restart 1000ms after the last change detected
    4168: 23:12:20.261 - Application will restart if files matching the following are changed: "dll;config"
    4168: 23:12:20.261 - Application will NOT restart if files matching the following are changed: "log4net.config"
    4168: 23:12:20.456 - Taking reference on default app domain
    4168: 23:12:20.640 - Application: "Master" started in app domain: 2
    4168: 23:12:20.640 - About to load application: Chat from Server2Server
    4168: 23:12:20.640 - Auto restart is enabled for application, existing connections will be terminated during restart
    4168: 23:12:20.640 - Application will restart 1000ms after the last change detected
    4168: 23:12:20.640 - Application will restart if files matching the following are changed: "dll;config"
    4168: 23:12:20.640 - Application will NOT restart if files matching the following are changed: "log4net.config"
    4168: 23:12:20.813 - Taking reference on default app domain
    4168: 23:12:21.016 - Application: "Chat" started in app domain: 3
    4168: 23:12:21.016 - About to load application: Region from Server2Server
    4168: 23:12:21.016 - Auto restart is enabled for application, existing connections will be terminated during restart
    4168: 23:12:21.016 - Application will restart 1000ms after the last change detected
    4168: 23:12:21.016 - Application will restart if files matching the following are changed: "dll;config"
    4168: 23:12:21.016 - Application will NOT restart if files matching the following are changed: "log4net.config"
    4168: 23:12:21.109 - Taking reference on default app domain
    4168: 23:12:21.298 - Application: "Region" started in app domain: 4
    4168: 23:12:21.298 - About to load application: Audio from Server2Server
    4168: 23:12:21.298 - Auto restart is enabled for application, existing connections will be terminated during restart
    4168: 23:12:21.298 - Application will restart 1000ms after the last change detected
    4168: 23:12:21.298 - Application will restart if files matching the following are changed: "dll;config"
    4168: 23:12:21.298 - Application will NOT restart if files matching the following are changed: "log4net.config"
    4168: 23:12:21.391 - Taking reference on default app domain
    4168: 23:12:21.495 - Application: "Audio" started in app domain: 5
    4168: 23:12:21.495 - About to load application: Video from Server2Server
    4168: 23:12:21.495 - Auto restart is enabled for application, existing connections will be terminated during restart
    4168: 23:12:21.495 - Application will restart 1000ms after the last change detected
    4168: 23:12:21.495 - Application will restart if files matching the following are changed: "dll;config"
    4168: 23:12:21.495 - Application will NOT restart if files matching the following are changed: "log4net.config"
    4168: 23:12:21.600 - Taking reference on default app domain
    4168: 23:12:21.883 - Application: "Video" started in app domain: 6
    4168: 23:12:21.883 - About to load application: Policy from Policy.Application
    4168: 23:12:21.883 - Auto restart is enabled for application, existing connections will be terminated during restart
    4168: 23:12:21.883 - Application will restart 1000ms after the last change detected
    4168: 23:12:21.883 - Application will restart if files matching the following are changed: "dll;config;xml"
    4168: 23:12:21.883 - Application will NOT restart if files matching the following are changed: "log4net.config"
    4168: 23:12:22.178 - Taking reference on default app domain
    4168: 23:12:22.205 - Application: "Policy" started in app domain: 7
    4168: 23:12:22.205 - About to load application: CounterPublisher from CounterPublisher
    4168: 23:12:22.205 - Auto restart is enabled for application, existing connections will be terminated during restart
    4168: 23:12:22.205 - Application will restart 1000ms after the last change detected
    4168: 23:12:22.205 - Application will restart if files matching the following are changed: "dll;config"
    4168: 23:12:22.205 - Application will NOT restart if files matching the following are changed: "log4net.config"
    4168: 23:12:22.356 - Taking reference on default app domain
    4168: 23:12:22.460 - Application: "CounterPublisher" started in app domain: 8
    4168: 23:12:22.460 - Adding TCP listener on :0.0.0.0: 4530 with a listen backlog of: 150
    4168: 23:12:22.460 - TCP inactivity timeout: 5000ms
    4168: 23:12:22.460 - TCP disconnect timeout: 120000ms
    4168: 23:12:22.460 - MaxInboundMessageSize: 512000
    4168: 23:12:22.460 - MaxOutboundMessageSize: 512000
    4168: 23:12:22.460 - Forcing all applications ids to: "Master"
    4168: 23:12:22.460 - Adding TCP listener on :0.0.0.0: 4531 with a listen backlog of: 150
    4168: 23:12:22.460 - TCP inactivity timeout: 5000ms
    4168: 23:12:22.460 - TCP disconnect timeout: 120000ms
    4168: 23:12:22.460 - MaxInboundMessageSize: 512000
    4168: 23:12:22.460 - MaxOutboundMessageSize: 512000
    4168: 23:12:22.460 - Forcing all applications ids to: "Chat"
    4168: 23:12:22.460 - Adding TCP listener on :0.0.0.0: 4532 with a listen backlog of: 150
    4168: 23:12:22.460 - TCP inactivity timeout: 5000ms
    4168: 23:12:22.460 - TCP disconnect timeout: 120000ms
    4168: 23:12:22.460 - MaxInboundMessageSize: 512000
    4168: 23:12:22.460 - MaxOutboundMessageSize: 512000
    4168: 23:12:22.460 - Forcing all applications ids to: "Region"
    4168: 23:12:22.461 - Adding TCP listener on :0.0.0.0: 4533 with a listen backlog of: 150
    4168: 23:12:22.461 - TCP inactivity timeout: 5000ms
    4168: 23:12:22.461 - TCP disconnect timeout: 120000ms
    4168: 23:12:22.461 - MaxInboundMessageSize: 512000
    4168: 23:12:22.461 - MaxOutboundMessageSize: 512000
    4168: 23:12:22.461 - Forcing all applications ids to: "Audio"
    4168: 23:12:22.461 - Adding TCP listener on :0.0.0.0: 4534 with a listen backlog of: 150
    4168: 23:12:22.461 - TCP inactivity timeout: 5000ms
    4168: 23:12:22.461 - TCP disconnect timeout: 120000ms
    4168: 23:12:22.461 - MaxInboundMessageSize: 512000
    4168: 23:12:22.461 - MaxOutboundMessageSize: 512000
    4168: 23:12:22.461 - Forcing all applications ids to: "Video"
    4168: 23:12:22.461 - Adding TCP listener on :0.0.0.0: 4520 with a listen backlog of: 150
    4168: 23:12:22.461 - TCP inactivity timeout: 5000ms
    4168: 23:12:22.461 - TCP disconnect timeout: 120000ms
    4168: 23:12:22.461 - MaxInboundMessageSize: 512000
    4168: 23:12:22.461 - MaxOutboundMessageSize: 512000
    4168: 23:12:22.461 - Forcing all applications ids to: "Master"
    4168: 23:12:22.461 - MaxInboundMessageSize: 512000
    4168: 23:12:22.461 - MaxOutboundMessageSize: 512000
    4168: 23:12:22.461 - UDP address specified as:0.0.0.0 adding listener to each available IPv4 address
    4168: 23:12:22.462 - Adding UDP listener on :192.168.0.100: 5055 with a listen backlog of: 500
    4168: 23:12:22.462 - Adding UDP listener on :127.0.0.1: 5055 with a listen backlog of: 500
    4168: 23:12:22.462 - Forcing all applications ids to: "Chat"
    4168: 23:12:22.462 - MaxInboundMessageSize: 512000
    4168: 23:12:22.462 - MaxOutboundMessageSize: 512000
    4168: 23:12:22.462 - UDP address specified as:0.0.0.0 adding listener to each available IPv4 address
    4168: 23:12:22.462 - Adding UDP listener on :192.168.0.100: 5056 with a listen backlog of: 500
    4168: 23:12:22.462 - Adding UDP listener on :127.0.0.1: 5056 with a listen backlog of: 500
    4168: 23:12:22.462 - Forcing all applications ids to: "Region"
    4168: 23:12:22.462 - MaxInboundMessageSize: 512000
    4168: 23:12:22.462 - MaxOutboundMessageSize: 512000
    4168: 23:12:22.462 - UDP address specified as:0.0.0.0 adding listener to each available IPv4 address
    4168: 23:12:22.463 - Adding UDP listener on :192.168.0.100: 5057 with a listen backlog of: 500
    4168: 23:12:22.463 - Adding UDP listener on :127.0.0.1: 5057 with a listen backlog of: 500
    4168: 23:12:22.463 - Forcing all applications ids to: "Audio"
    4168: 23:12:22.463 - MaxInboundMessageSize: 512000
    4168: 23:12:22.463 - MaxOutboundMessageSize: 512000
    4168: 23:12:22.463 - UDP address specified as:0.0.0.0 adding listener to each available IPv4 address
    4168: 23:12:22.463 - Adding UDP listener on :192.168.0.100: 5058 with a listen backlog of: 500
    4168: 23:12:22.463 - Adding UDP listener on :127.0.0.1: 5058 with a listen backlog of: 500
    4168: 23:12:22.463 - Forcing all applications ids to: "Video"
    4168: 23:12:22.463 - MaxInboundMessageSize: 512000
    4168: 23:12:22.463 - MaxOutboundMessageSize: 512000
    4168: 23:12:22.463 - UDP address specified as:0.0.0.0 adding listener to each available IPv4 address
    4168: 23:12:22.464 - Adding UDP listener on :192.168.0.100: 5059 with a listen backlog of: 500
    4168: 23:12:22.464 - Adding UDP listener on :127.0.0.1: 5059 with a listen backlog of: 500
    4168: 23:12:22.464 - Adding TCP Policy listener on :0.0.0.0: 843 with a listen backlog of: 150 and routing to application: "Policy"
    4168: 23:12:22.464 - TCP inactivity timeout: 1000ms
    4168: 23:12:22.464 - Adding TCP Policy listener on :0.0.0.0: 943 with a listen backlog of: 150 and routing to application: "Policy"
    4168: 23:12:22.464 - TCP inactivity timeout: 1000ms
    4168: 23:12:22.464 - Adding WebSocket TCP listener on :0.0.0.0: 9090 with a listen backlog of: 150
    4168: 23:12:22.464 - Nagle disabled
    4168: 23:12:22.464 - TCP inactivity timeout: 10000ms
    4168: 23:12:22.464 - MaxInboundMessageSize: 512000
    4168: 23:12:22.464 - MaxOutboundMessageSize: 512000
    4168: 23:12:22.464 - Forcing all applications ids to: "Master"
    4168: 23:12:22.464 - Will accept ANY sub-protocols from the client
    4168: 23:12:22.464 - No automatic WebSocket ping
    4168: 23:12:22.698 - Service is running...


    i tried netstat its listning fine but on 0.0.0.0 while udp listens explicitly on lan and localhost ...
  • Sorry ,Solved ..forgot to mention Tcp protocol at client Connect
  • Okay, thanks for your feedback. :)