The Round Trip Time of MultipeerConnectivity is very unstable

I am building an app using MultipeerConnectivity with 2 iPhones. The app needs low latency real-time networking. When I was measuring the round trip time (RTT), I found that the RTT is very unstable.

What I did in code was that I send a ping message from device A to device B and record the current system uptime ([[NSProcessInfo processInfo] systemUptime]) on device A. When device B receives the ping message, it immediately sends a pong message back to device A. When device A receives the pong message, the RTT is calculated by

RTT = (current system uptime - previously recorded system uptime) * 1000

I sent the ping message every 2 seconds from device A to device B and got the following RTT result:

rtt 8.7917
rtt 156.9327
rtt 251.2976
rtt 3.9905
rtt 6.2492
rtt 5.3590
rtt 96.0188
rtt 190.8776
rtt 291.0668
rtt 7.0962
rtt 6.8734
rtt 43.4346
rtt 227.1793
rtt 235.7925
rtt 336.1445
rtt 10.1862
rtt 14.6641
rtt 100.1742
rtt 194.9736
rtt 294.0715
rtt 5.0174
rtt 5.5357
rtt 65.7211

You might have noticed the pattern, it is a loop! At the beginning, the RTT is very low (around 5 ms), which is good. But after a short period of time (about 5 seconds), it gradually increases and finally hits a peak value of around 300 ms. Then it immediately drops to around 5 ms and the loop repeats again. I didn't send any other message between these two devices, only ping pong messages were transmitted.

This is very weird to me, since it is stably unstable... Is that supposed to happen because of the nature of MultipeerConnectivity?

Is that possible to make MultipeerConnectivity network stable with a low RTT (around 5ms)? Thank you very much!

The Round Trip Time of MultipeerConnectivity is very unstable
 
 
Q