S2S Application - Load Testing

Hello,

I have used photon self hosted server on my own server and it works fine.

My purpose is to do load testing and I was doing some RND regarding that. I have found that we will need to use s2s application for that.

Now my problem is, I am not able to find proper tutorial regarding s2s. Can you please help?

Also I found one LoadBalancing.TestClient project inside the source code but if try to run, it shows error.


The error is as follows.

C:\photon-server-sdk_v5-0-12-24499-rc1\src-server\LoadBalancing\TestClient\bin\Debug\net461\win-x64\

Path :: C:\photon-server-sdk_v5-0-12-24499-rc1\src-server\LoadBalancing\TestClient\bin\Debug\net461\win-x64\log4net.config

[10256] Press Return to End

17:56:01,156 DEBUG ConnectionStates.Master       MASTER: Connecting to master server at 127.0.0.1:4520 .. [4]

17:56:01,628 ERROR TestClient.Program            System.TypeInitializationException: The type initializer for 'Photon.SocketServer.Protocol' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Photon.SocketServer.Configuration.PhotonSettings' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.

  at Photon.SocketServer.ApplicationBase.GetConfigSectionAndValidate[T](String path) in H:\SvnContent\photon-socketserver-sdk-branches\sdk_5.0\src\Photon.SocketServer\ApplicationBase.cs:line 1273

  at Photon.SocketServer.Configuration.PhotonSettings..cctor() in H:\SvnContent\photon-socketserver-sdk-branches\sdk_5.0\src\Photon.SocketServer\Configuration\PhotonSettings.cs:line 22

  --- End of inner exception stack trace ---

  at Photon.SocketServer.Configuration.PhotonSettings.get_Default()

  at Photon.SocketServer.Rpc.Protocols.InboundController..ctor() in H:\SvnContent\photon-socketserver-sdk-branches\sdk_5.0\src\Photon.SocketServer\Rpc\Protocols\InboundController.cs:line 142

  at Photon.SocketServer.Protocol..cctor() in H:\SvnContent\photon-socketserver-sdk-branches\sdk_5.0\src\Photon.SocketServer\Protocol.cs:line 178

  --- End of inner exception stack trace ---

  at Photon.SocketServer.Protocol.SerializeInitRequest(IRtsMessageHeaderConverter headerWriter, Version protocolVersion, Version clientVersion, String applicationId, Byte sdkId, Boolean usingIPv6)

  at Photon.SocketServer.Rpc.Protocols.GpBinaryByte.GpBinaryByteProtocolV16.SerializeInitRequest(String applicationId, Version clientVersion, Byte sdkId, Boolean usingIPv6) in H:\SvnContent\photon-socketserver-sdk-branches\sdk_5.0\src\Photon.SocketServer\Rpc\Protocols\GpBinaryByte\GpBinaryByteProtocolV16.cs:line 210

  at Photon.SocketServer.ServerToServer.TcpClientBase.SendInitRequest() in H:\SvnContent\photon-socketserver-sdk-branches\sdk_5.0\src\Photon.SocketServer\ServerToServer\TcpClientBase.cs:line 887

  at Photon.SocketServer.ServerToServer.TcpClientBase.OnConnectAsyncCompleted(Object sender, SocketAsyncEventArgs e) in H:\SvnContent\photon-socketserver-sdk-branches\sdk_5.0\src\Photon.SocketServer\ServerToServer\TcpClientBase.cs:line 714

  at System.Net.Sockets.SocketAsyncEventArgs.OnCompleted(SocketAsyncEventArgs e)

  at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

  at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

  at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

  at System.Net.Sockets.SocketAsyncEventArgs.FinishOperationSuccess(SocketError socketError, Int32 bytesTransferred, SocketFlags flags)

  at System.Net.Sockets.SocketAsyncEventArgs.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)

  at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP) [3]



Thank you

Answers

  • hi, @Imroz

    to fix this issue do next thing:

    • create class derived from ApplicationBase and in constructor pass empty configuration to ApplicationBase's constructor
    • all overrides can be empty
    • create instance of that class at very beginning of main method

    best,

    ilya

  • Thank you @chvetsov, I will try this today and if any query i will let you know.

    I am not able to find proper tutorial regarding s2s. Can you please help?

    Thanks,

    Imroz

  • Imroz
    Imroz
    edited April 2022

    Hello,

    I am trying your method and test client application is running now. i found warning for Authorization and connection active is drop of in graph. My settings are NumClientsPerGame = 1 and NumGames = 1. please check my Screenshots.


  • hi, @Imroz

    please clean up game server logs, run your test and share logs


    best,

    ilya

  • Hello,

    I am just hide my static ip for now. Below is log :

    2022-04-25 14:00:30,288 [47] DEBUG Photon.LoadBalancing.GameServer.GameApplication - CreatePeer for Game

    2022-04-25 14:00:30,289 [47] DEBUG Photon.LoadBalancing.GameServer.GameApplication - incoming game peer at 192.168.1.8:4531 from <STATICIP>:55615

    2022-04-25 14:00:30,292 [47] DEBUG Photon.LoadBalancing.GameServer.GameClientPeer - Auth Timeout Checker scheduled. authTimeout:20000 p:GameClientPeer: PID: 386, IsConnected: False, IsDisposed: False, Last Activity: Operation 0 at UTC 0001-01-01T00:00:00, in Room '', IP <STATICIP>:55615, NetworkProtocol Tcp, Protocol GpBinaryV16, JoinStage: 0

    2022-04-25 14:00:30,751 [17] DEBUG Photon.LoadBalancing.GameServer.GameClientPeer - OnOperationRequest: conId=386, opCode=227

    2022-04-25 14:00:31,306 [17] DEBUG Photon.LoadBalancing.GameServer.MasterServerConnectionBase - Sending event to master. EventCode=2, ConnectionId=d30c895e-41c0-4973-8dee-da70b0ada4e2

    2022-04-25 14:00:35,776 [42] DEBUG Photon.LoadBalancing.GameServer.GameClientPeer - Auth Timeout Checker stopped. authTimeout:20000 p:GameClientPeer: PID: 386, IsConnected: False, IsDisposed: False, Last Activity: Operation 227 at UTC 2022-04-25T08:30:30, in Room '', IP <STATICIP>:55615, NetworkProtocol Tcp, Protocol GpBinaryV16, JoinStage: 0

    2022-04-25 14:00:35,777 [42] DEBUG Photon.Hive.HivePeer - OnDisconnect: conId=386, reason=2, reasonDetail=

    2022-04-25 14:00:35,780 [42] DEBUG Photon.Hive.HivePeer - RemovePeerFromCurrentRoom: Room Reference is null for p:GameClientPeer: PID: 386, IsConnected: False, IsDisposed: False, Last Activity: Operation 227 at UTC 2022-04-25T08:30:30, in Room '', IP <STATICIP>:55615, NetworkProtocol Tcp, Protocol GpBinaryV16, JoinStage: 0

    2022-04-25 14:00:36,793 [47] DEBUG Photon.LoadBalancing.GameServer.MasterServerConnectionBase - Sending event to master. EventCode=2, ConnectionId=d30c895e-41c0-4973-8dee-da70b0ada4e2

    Thanks

  • Hello Team,

    Can any one help me about this issue?


    Thanks,

    Imroz

  • hi, @Imroz

    I do not see why your client have been disconnected.

    What did you get on client side? what answer did you get?

    best,

    ilya

  • Hello @chvetsov

    Above log is for server side and for client side error I have attached earlier. I am attaching screenshot here again.

    After that, my connection is drop.

    Server configuration is working proper in Unity Side, but main issue from Loadbalancing.TestClient App.

    Thanks,

    Imroz

  • hi, @Imroz

    it looks like you are not sending auth request to game server. you have to


    best,

    ilya

  • Hello @chvetsov,

    Okay, but i am not changing any code in Loadbalancing.TestClient Project in GameServer.cs file.

    Can you guide me which code need to add or where?

    Thanks,

    Imroz

  • hi, @Imroz

    well, this sample is not supported.

    what you have to do is in Master.cs during handling Operation response for Authenticate operation save token/secret. it is in response. and than before creating game in GameConnection class you have to call authenticate operation similar as it done in Master.cs but add token/secret as parameter to it.

    best,

    ilyha