Author Topic: Latency Spikes / Guidance  (Read 117 times)

rxmarcus

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 61
    • View Profile
Latency Spikes / Guidance
« on: October 11, 2017, 04:00:53 PM »
For the past while I've been attempting to set up dedicated servers for our game. I've have a server hosted on Linode, Digital Ocean and now one on NFO.

A consistent issue I've had is that latency for my players spikes rather high every 3 seconds or so. I'll get a good 3 seconds of 50ms ping (using TNets ping functionality) and then my ping will shoot up to 500ms, sometimes up to 1200ms. Then eventually it will come back down to 50ms.

This has been consistent across all these providers.... Is there any guidance or knowledge that anyone can share with me? Why might this be the case? Am I flooding the network with too many packets? Or is there possibly an issue with TNet?

I'm just not sure what to look at next and really want to get a solid / consistent online experience working for my playerbase.

Or is it really normal to have this much network jitter and game developers have just learned to deal with it?

cmifwdll

  • Global Moderator
  • Full Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 135
  • Posts: 244
  • TNet Alchemist
    • View Profile
Re: Latency Spikes / Guidance
« Reply #1 on: October 11, 2017, 08:56:37 PM »
Could try disabling Nagle's algorithm. Set TNManager.noDelay to true after connecting to the gameserver.

Most likely this is due to some of your code that's taking too long, though. I'd load up Unity's profiler and see if the lag spikes correspond to a spike in the profiler.
Are you using GameObject.FindXXX or loads of GetComponent<T> or a lot of Instantiate? Particularly in an RFC? Could be a million things, profiler will help narrow it down.