Understanding ping calculation

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

kuldip
Posts: 5
Joined: 07 Feb 2022, 04:14

Understanding ping calculation

Postby kuldip » 16 Nov 2022, 08:55

We enabled lag monitor with Queuesize 1, we didn't receive ping for scheduled interval (1 second). We received ping after 6 seconds, however, the lag value was shown to be around 900 ms. Wanted to understand how it is possible? Shouldn't the ping be like 6000ms?
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Understanding ping calculation

Postby Lapo » 16 Nov 2022, 09:26

Hi,
can you give us more details?
What SFS2X version are you using?
What API platform and version?

Also can you show the code used to start the Lag Monitor?

I have tested locally using the latest SFS2X and Java API and didn't see anything strange. Keep in mind that the ping/pong interaction is run every few seconds (by default 4).
In our local test the client on my machine is pinging SFS2X running on a Raspberry PI, with a reported latency of 8-10ms.

The settings in my tests are:

Code: Select all

sfs.enableLagMonitor(true, 2, 1);

Pinging every 2 seconds, with the queue size set to 1

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
kuldip
Posts: 5
Joined: 07 Feb 2022, 04:14

Re: Understanding ping calculation

Postby kuldip » 16 Nov 2022, 12:53

Hey,
Our client is on Unity, version 1.7.13. Server is 2.16.1.

The code to start the lag monitor is the equivalent of - EnableLagMonitor(true, 1, 1); (we use variables whose values are set to 1 and 1 for Queuesize and interval).

Please let me know in case more details are required.

Thanks
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Understanding ping calculation

Postby Lapo » 16 Nov 2022, 16:04

2.16.1 is pretty old, I would recommend repeating the test with a more recent version version (2.18.x)
Also you mentioned that it took 6 seconds for the response to come back: how exactly did you measure this? Did you start keeping time when the "ping" request goes out?

( A better way to double check this would be using Wireshark where you can actually see the times at which packets are being sent and received )

I ask because there could be all kinds of other activities going on in the client that may cause some delay and have nothing to do with the network. The Lag Monitor takes only the network in account and nothing else.

Side note: in production I wouldn't recommend to run the LagMonitor at a frequency of 1sec. 4-5 seconds is usually more than enough and will save you some bandwidth.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Understanding ping calculation

Postby Lapo » 16 Nov 2022, 16:05

2.16.1 is pretty old, I would recommend repeating the test with a more recent version version (2.18.x)
Also you mentioned that it took 6 seconds for the response to come back: how exactly did you measure this? Did you start keeping time when the "ping" request goes out?

( A better way to double check this would be using Wireshark where you can actually see the times at which packets are being sent and received )

I ask because there could be all kinds of other activities going on in the client that may cause some delay and have nothing to do with the network. The Lag Monitor takes only the network in account and nothing else.

Side note: in production I wouldn't recommend to run the LagMonitor at a frequency of 1sec. 4-5 seconds is usually more than enough and will save you some bandwidth.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Stevenor and 56 guests