Like let’s just say we have two servers one is at 30ms ping and the other one is at 150ms ping, will a script on both servers run the same speed and im talking about just a standalone script that is just on the server and isn’t communicating with clients like for example updating a leaderbaord every 5 minutes, will that run just as efficient if the ping of the server is higher?
Server speed and ping are generally speaking not related to each other. Ping is the time it takes for a signal to go back and forth between the server and client. If I am living in Denmark and connecting to a server in New York, the distance my inputs have to travel is very far. Usually a Europe to America latency/ping is between 100 and 200 milliseconds from my experience. If I am living in New York and connected to a server in New York, my signals don’t have to travel far at all and my ping will be close to 0.
However, if a server is overloaded it may happen that the server is unable to process a player’s input quickly. If the server’s CPU is being used at full capacity, your signals may be temporarily put ‘on hold’ as the server is trying to finish up other calculations first. You may notice that ‘laggy’ games therefore sometimes also cause a latency in the hundreds of milliseconds.
With this background info, it becomes easier to answer your original question.
In most cases the answer here would be ‘no’. The higher ping is almost always caused by the client simply being further away from the server they’re connected to (physically) or their router is taking a longer physical route to the server than they should. But, if you are living in New York and the two servers of your hypothetical situation are also located nearby New York, a 150ms ping probably indicates that the server is overloaded and thus unable to respond to your requests quickly, in which case the answer is ‘yes’.
Yes that was a very nice explanation but maybe I worded it incorrectly but im strictly talkng about just server tasks that dont require communication with the clients just stuff happening strictly on the server so for example updating a global leadboard or something of that sort
So in that case ping does not influence server performance. Your code should run at the same speed regardless of how high/low the ping is.
Alright I have a few follow up questions, so im guessing server load is what dictates how fast a job will be executed so, would it be better to have multiple heartbeat loops for managing different things or one central heartbeat loop?
Well ping would be related to how long it takes data to be transferred from client to server. So a server doesn’t really have ping meaning that there would be no latency however if you ran the script that a remote event is fired by the local player then did that between the 2 servers then there would be a bit of latency