Multiple load balancing apps on one machine

Hello, we use Load Balancing as base for our server applications, for our unity games.
We have a test server, where we host our server app.
We have recently decided to run tye second default load balancing app on the same machine as our main one is hosted, so we wont need to buy second server machine for our tests.
Is that possible? I guess we need ro setup ports that our apps use, and just run PhotonCloudService without PhotonControl?
We have default configs for both apps. Please, help to set that app.
Thanks

Best Answer

Answers

  • hi, @pavelbaslak

    probably the easiest way to do it is just copy&past current application config. Give new names for new applications and create listeners, which will be used to establish a connection. Because you will need to update LoadBalancing.dll.config, you need also copy game and master server application to a new directory.
    so, in short:
    1. update PhotonServer.config
    2. Copy application to the new folder and update configs there too

    best,
    ilya
  • Hello @chvetsov, thanks for an answer!
    What should I update in photonserver.config and in another configs to?
  • well, you need to copy & past existing application, give them new names and update location for them.
    then you need to create listeners which will be used by this new applications. you can not use old. then copy&past files on the disc to create the copy of the existing applictions. you will need to update Loadbalncing.dll.config. there are ports. you should set correct ports in this config for master and for game server

    best,
    ilya
  • So:
    1) copy paste existing application
    2) what should I rename? Exe files? Or all loadbalancing occurances?
    3) are listeners listed in config files? It would be just port changes?
    4) that is it, or still would need tk update ports in config?
  • Thanks Ilya! Have a nice day
  • @chvetsov Ilya,
    can you please assist me with follwing:
    I have added 2 new applications to config, and added 2 more listeners for UDP, and set up port for that to 5057, 5058.
    However, when I try to connect to the game, to just newly created server application(Master_New has 5057), I do receive
    Operation failed: OperationResponse 227: ReturnCode: 32762 (Failed to get server instance.). Parameters: {} Server: MasterServer
    If I try connect to my old application that was working on port 5055, I get:
    Receive issue. State: Connected. Server: '127.0.0.1' Exception: System.Net.Sockets.SocketException: remote host has disconnected on first try, and the second time I try to connect it just hangs

    Here is link to my config file, I guess all is setup there.
    https://we.tl/j9uc5Ten56
  • here is where Loadbalancing.dll.config comes to play. you should create extra listener for server2server communication current has port 4520, add one more. and update loadbalancing config to get connected to right port

    best,
    ilya
  • edited May 31
    @chvetsov added one more node to TCPListeners like that:

    <TCPListener IPAddress="0.0.0.0" Port="4521"> </TCPListener>
    And updated LoadBalancing.dll.config for both new apps (Master_New, Game_New) like
    <setting name="OutgoingMasterServerPeerPort" serializeAs="String">
    <value>4521</value>
    <setting name="IncomingGameServerPeerPort" serializeAs="String">
    <value>4521</value>

    And still get Operation failed: OperationResponse 227: ReturnCode: 32762 (Failed to get server instance.). Parameters: {} Server: MasterServer
    However, I can connect to working server
  • edited May 31
    @chvetsov
    Have added new TCP Listener:
    <TCPListener
    IPAddress="0.0.0.0"
    Port="4521">
    </TCPListener>
    And updated both LoadBalancing.config for Master_New, Game_New like:
    <setting name="OutgoingMasterServerPeerPort" serializeAs="String">
    <value>4521</value>
    <setting name="IncomingGameServerPeerPort" serializeAs="String">
    <value>4521</value>
    And still get this error:
    Operation failed: OperationResponse 227: ReturnCode: 32762 (Failed to get server instance.). Parameters: {} Server: MasterServer

    However, I can join our main server app well
  • shovancjshovancj
    edited May 31
    after reviewing the following thread it helped me with connecting voice to a separate service in self hosted mode.

    Maybe an issue you are running into is that you duplicated the game and master folders inside of load balancing, instead of duplicating the entire load balancing folder and renaming it. I also renamed the contained game and master.

    Then in the config file i made a separate application path.. so that photon control would show two photons.

    <<Loadbalancing>>
    ...


    ...


    and then changed upped all the ports inside of loadbalancing new.. ie 5055 -> 5057 so on and so forth.

    maybe this will helps some.
  • the xml formating broke in the post above..
    [Loadbalancing]
    ..
    [/Loadbalancing]
    [LoadbalancingNew]
    ..
    [/LoadbalancingNew]

    assume angle brackets
  • @pavelbaslak please check logs first in deploy/log for your second game and master servers and see whether new game server connects to right master and whether new master gets an incoming connection.

    if you will fail to find the reason, then please share with me configs and logs.

    best,
    ilya
  • @chvetsov
    I have noticed that it can connect to Master server, but cant register GameServer, seems like some setting is missing still. I guess it is just 1 step missing or so.
    Here is log
    2018-06-01 10:45:06,243 [11] INFO Photon.LoadBalancing.GameServer.MasterServerConnectionBase - Connecting to master at 127.0.0.1:4521, serverId=d7389ca9-725c-4063-a15b-27a3edde76af
    2018-06-01 10:45:06,244 [30] INFO Photon.LoadBalancing.GameServer.MasterServerConnectionBase - Master connection established: address:127.0.0.1
    2018-06-01 10:45:06,394 [30] INFO Photon.Common.LoadBalancer.ServerStateManager - Server state is set to online
    2018-06-01 10:45:06,452 [30] INFO Photon.LoadBalancing.GameServer.OutgoingMasterServerPeer - Registering game server with address 127.0.0.1, TCP 4531, UDP 5056, WebSocket 9091, Secure WebSocket 19091, HTTP 80, ServerID d7389ca9-725c-4063-a15b-27a3edde76af, Hostname localhost, IPv6Address
    2018-06-01 10:45:06,509 [55] ERROR Photon.LoadBalancing.GameServer.OutgoingMasterServerPeer - RegisterGameServer returned with err -2: Unknown operation code
    2018-06-01 10:45:06,555 [55] ERROR Photon.LoadBalancing.GameServer.OutgoingMasterServerPeer - RegisterGameServerResponse contract invalid: Missing value 2 (RegisterGameServerResponse.InternalAddress)

    2018-06-01 10:45:06,598 [54] INFO Photon.LoadBalancing.GameServer.OutgoingMasterServerPeer - connection to master closed (id=160, reason=ManagedDisconnect, detail=), serverId=d7389ca9-725c-4063-a15b-27a3edde76af

    And here is the link to config files and logs
  • from config point of view, I see only one error. Your GameServer_new listens on 5058, but you have 5056 in the configuration file. this port belongs to 'GameServer'

    just set a breakpoint in MasterAppliction.CreatePeer and check why it creates the wrong peer for your game server. that is why you get answer 'Unknown operation code'

    best,
    ilya
  • Hm, changed that value, and still is the same;
    It tells that contract invalid, can this be something with settings still, as I see that contract is being assembled from settings file. It tells missing value 2, is that PublicHostName ?

    Trying to catch CreatePeer, but does not get inside
  • >It tells that contract invalid, can this be something with settings still, as I see that contract is being assembled from settings file. It tells missing value 2, is that PublicHostName ?
    it is invalid because it got non expected response.

    Reason for that is on Master server. if breakpoint does not work, then add logging. i assume that breakpoint does not work because you did not put correct dll/pdb to right folder.

    what version of sdk are you using?

    best,
    ilya
  • edited June 5
    Hello @chvetsov !
    I have attached the debugger, and have found that in MasterApplication.CreatePeer, I receive initRequest param with probably wrong data in.
    I have GSGame_New.log opened, which one refering to one of my GS_New application with (5057, 5058) ports.
    So, this log is being updated once in X seconds. If I am attached to debugger, and not going further, the log stops, what probably means that Im attached to correct Application.
    However, if I spotlight initRequest parameter, I have following data in(attached a screenshot).
    As you can see, there is LocalPort parameter 5055, while it should probably be 5057, for me second Game Application.

    Image

    @shovancj Thanks for your input, but unfortunately your solution had the same result, as I currently have(
  • hi, @pavelbaslak
    everything works as expected.

    You have attached to late. S2S connections already established. What you see is client connection to your Master server. it is done on port 5055.

    you may start photon right from Visual Studio. Set LoadBalancing as startup project.

    open properties for LoadBalancing: Selected 'Debug'. set 'Start external program' to your PhotonSocketServer.exe location
    Command line arguments: /debug LoadBalancing /config PhotonServer.LoadBalancing-Development.config
    PhotonServer.LoadBalancing-Development.config - is config name. you may replace it to your config name. but you should put your config near this one in LoadBalancing folder.

    Working directory: ..\..


    In such a way you will be able to start photon by pressing F5. Be ready that you will get stopped twice. once for port 4520 and once for 4521.

    also, you may add logging into this piece of code, to see what is going on

    best,
    ilya
Sign In or Register to comment.