Closing MasterServer.exe discreases RPC latency.

After some seconds of playing my game, which is split into client and server communicating via RPC, it slows down very much because of high latency. But when I close MasterServer.exe, the problem disappears.

I tried changing its build configuration to release, but it has no affect on the issue.

What are the possible reasons?

I doubt the MasterServer is causing problems because it doesn’t do much work or send much data. The latency is more likely coming from the amount of data sent between your game client and game server. I’m guessing that when you lose connection to the MasterServer you also disconnect from the game server. I don’t think you need to disconnect from your game server when the master server connections is broken, so you could try that.

Collect some statistics on how many RPCs you are sending per second and also look at how much data you are sending in each one. A few floats and strings passed in an RPC won’t add up to much (unless each of your strings is really long), but if you are serializing entire objects and sending that data then there could be a lot of data sent.

Are you testing on one computer? Multiple computers in the same local network? Multiple computers across the internet? Could use some more info here. Sending a lot of data every frame will cause high latency depending on your upload bandwidth, which is going to be more of a problem if the data has to travel over a wireless network or through your internet service provider.

If you are testing all on a single computer then you may be encountering an IO bus bottleneck, but I’m not as familiar with that kind of situation, and I’d imagine it would take a lot of data for that to happen.

There’s also a possibility that your CPU just can’t keep up with all the demands coming from your various processes. That’s easy to detect because your entire computer will experience the same latency, and not just the game.