How to use photon S2S feature to do performance test on self hosted server
Options
harlan
✭
I follow the following document:
https://doc.photonengine.com/en-us/server/current/app-framework/server-to-server-introduction
But I think it is not detailed enough.My steps are as follows:
1. Implementing the in bound shared library(DLL)
source code
It generates a DLL PerformanceTest.dll,then edit the PhotonServer.config, add the following items:
The listening port 4532 is OK:
C:\Users\Administrator>netstat -a -n -p TCP
Active Connections
Proto Local Address Foreign Address State
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING
TCP 0.0.0.0:843 0.0.0.0:0 LISTENING
TCP 0.0.0.0:943 0.0.0.0:0 LISTENING
TCP 0.0.0.0:3389 0.0.0.0:0 LISTENING
TCP 0.0.0.0:4520 0.0.0.0:0 LISTENING
TCP 0.0.0.0:4530 0.0.0.0:0 LISTENING
TCP 0.0.0.0:4531 0.0.0.0:0 LISTENING
TCP 0.0.0.0:4532 0.0.0.0:0 LISTENING
TCP 0.0.0.0:9090 0.0.0.0:0 LISTENING
TCP 0.0.0.0:9091 0.0.0.0:0 LISTENING
TCP 0.0.0.0:47001 0.0.0.0:0 LISTENING
TCP 0.0.0.0:49152 0.0.0.0:0 LISTENING
TCP 0.0.0.0:49153 0.0.0.0:0 LISTENING
TCP 0.0.0.0:49154 0.0.0.0:0 LISTENING
TCP 0.0.0.0:49155 0.0.0.0:0 LISTENING
2. Implement a out bound exe ,the codes are as follows:
source code
then run the app,falseMyOutboundPeer.isconnected is always flase and 4532 cannot be connected successfully ......
https://doc.photonengine.com/en-us/server/current/app-framework/server-to-server-introduction
But I think it is not detailed enough.My steps are as follows:
1. Implementing the in bound shared library(DLL)
source code
It generates a DLL PerformanceTest.dll,then edit the PhotonServer.config, add the following items:
<!-- 0.0.0.0 opens listeners on all available IPs. Machines with multiple IPs should define the correct one here. --> <TCPListeners> <!-- TCP listener for Game clients on Master application --> <TCPListener IPAddress="0.0.0.0" Port="4532" OverrideApplication="PerformanceTest" PolicyFile="Policy\assets\socket-policy.xml" InactivityTimeout="10000"> </TCPListener> </TCPListeners>Then add a new Application item:
<!-- Defines which applications are loaded on start and which of them is used by default. Make sure the default application is defined. --> <!-- Application-folders must be located in the same folder as the bin_win32 folders. The BaseDirectory must include a "bin" folder. --> <Applications Default="Master"> ... <!-- here a Application for performance test --> <Application Name="PerformanceTest" BaseDirectory="PerformanceTest" Assembly="PerformanceTest" Type="PerformanceTest.MyInboundApplication" ForceAutoRestart="true" WatchFiles="dll;config" ExcludeFiles="log4net.config"> </Application> </Applications>Then copy the PerformanceTest relevant files to Photon\deploy\ folder like CounterPublisher then run the Photon server.
The listening port 4532 is OK:
C:\Users\Administrator>netstat -a -n -p TCP
Active Connections
Proto Local Address Foreign Address State
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING
TCP 0.0.0.0:843 0.0.0.0:0 LISTENING
TCP 0.0.0.0:943 0.0.0.0:0 LISTENING
TCP 0.0.0.0:3389 0.0.0.0:0 LISTENING
TCP 0.0.0.0:4520 0.0.0.0:0 LISTENING
TCP 0.0.0.0:4530 0.0.0.0:0 LISTENING
TCP 0.0.0.0:4531 0.0.0.0:0 LISTENING
TCP 0.0.0.0:4532 0.0.0.0:0 LISTENING
TCP 0.0.0.0:9090 0.0.0.0:0 LISTENING
TCP 0.0.0.0:9091 0.0.0.0:0 LISTENING
TCP 0.0.0.0:47001 0.0.0.0:0 LISTENING
TCP 0.0.0.0:49152 0.0.0.0:0 LISTENING
TCP 0.0.0.0:49153 0.0.0.0:0 LISTENING
TCP 0.0.0.0:49154 0.0.0.0:0 LISTENING
TCP 0.0.0.0:49155 0.0.0.0:0 LISTENING
2. Implement a out bound exe ,the codes are as follows:
source code
then run the app,falseMyOutboundPeer.isconnected is always flase and 4532 cannot be connected successfully ......
0
Comments
-
Hi @harlan,
First of all, could you tell us why you need S2S is it for Performance Tests or other purpose?
I will invite my colleague @chvetsov to take a look because he knows this more than I do and may be able to help you faster.
In the future, we may think about updating the documentation page for S2S Intro to be more detailed and have step by step guide.
For the time being, I invite you to send ALL the logs and config (full/whole) files here because @chvetsov will probably need them.0 -
Hi @JohnTube
Thank you for your feedback.
We need to do some performance tests for photon network on our self hosted server.
https://doc.photonengine.com/en-us/server/current/performance/performance-tests
I follow the above document to use the S2S feature to do this.
Next I will print logs according to your link doc.
0 -
Hi @JohnTube @chvetsov
When the following codes are issued:
if (this.outboundPeer.ConnectTcp(new IPEndPoint(IPAddress.Parse("photonserverip"), 4532), "PerformanceTest"))
{
}
It returns false, and TCP connection package are not generated and sent out by monitoring the wireshark tool.
But by using the telnet tool command:
telnet photonserverip 4532
It can generate handshake packages and connect the server.
So I doubt if I missed some steps or the way I use the ConnectTcp function is not correct..
Or could you provide me a simple demo with source codes?? It is so good if you can.Thank you.0 -
No one answers this question????
The ConnectTcp returns false immediately, but I cannot get any error messages to location problems.0 -
Hi @chvetsov
The conntectTCP is called in a class member function:
public class MyOutboundApplication : ApplicationBase
{
public void SetupConnection()
{
Setup();
}
protected override void Setup()
{
this.outboundPeer = new MyOutboundPeer(this);
if (this.outboundPeer.ConnectTcp(new IPEndPoint(IPAddress.Parse("test.test.test.test"), 4532), "PerformanceTest"))
{
// log.InfoFormat("Connecting to master at {0}, serverId={1}", endPoint, this.Application.ServerId);
Console.WriteLine("Onconnect");
}
else{
//log.WarnFormat("master connection refused - is the process shutting down ? {0}", this.Application.ServerId);
Console.WriteLine("Ondisconnect");
}
}
}
and the function SetupConnection is called in Main:
static void Main(string[] args)
{
MyOutboundApplication app = new MyOutboundApplication();
app.SetupConnection();
}
So the usage is right or not?or where should the connect function be called?Where can I see the native logs?
0 -
Hi @chvetsov
Maybe I know what you mean,Now I only implemented a server side application and put it in the photon server ,listen a TCP port 4532 and run with the photon service...
So now I need to do the same process and just implement a client side application and put it into another photon server and start it..
Let the two parasitic app communicate with each other.
Is that right??
harlan.0 -
Yes, that is right
But please take into account that if you start apps on the same machine you may use only one photon server instance which will run two applications
best,
ilya0 -
HI @chvetsov
Thanks, now the two apps on two photon server can communicate with each other.But has other question:
https://doc.photonengine.com/en-us/server/current/performance/performance-tests
1.stop Photon if it's running
2.from Photon Control -> Performance Counters -> Install Counters, Create Logging Set
3.start "perfmon" from command line. Under "data collector sets" -> "User Defined": choose the photonperflog in the RIGHT window pane -> Properties -> set the sample interval to 1 second (the default of 1 minute does not give us enough data here)
the third step,I cannot find the photonperflog in the RIGHT window pane, do I need to establish a new one myself ?or it is generated automatically??
0 -
you have to create them first using photon control
best,
ilya0 -
thanks0