I’m building an app (client) in C# which pings a server in my local network using Ping.SendAsync(host, 3000, null) to verify connectivity and send data. The app will be installed in about 200 PCs.
Question is:
Is it safe to ping the server every 5secs from those 200 PCs all day long?
Thanks in advance
You should already know the answer to this one – it depends.
Let’s say you are sending 40 requests per second, on average. Can a web server handle 40 requests per second? It likely can, but you don’t provide any detail of what the server is doing.
For a server to receive a request and return a simple value then the number of milliseconds could well be in the single digits. If the server needs to read or write to disk, or connect to another server (say, a database) then the number of milliseconds might be two digits. If connecting to a remote or multiple servers then it might even take three digits – over 100ms.
If the server needs to crunch some numbers and calculate something then there’s no way of guessing – it could take a day for all I know.
Assuming the server doesn’t run any other critical systems that need dedicated resources, you are really interested in two things here
You need to average 40 per second, which is really not very much – assuming there is not much processing happening. But the way the know whether this is a ‘good idea’ or not is to simply test it out. You should use a test framework or write a test harness – it’s exceedingly simple to do, just write apps that hit the server as fast as they can. You will need to run the test from multiple client machines because otherwise you won’t be sure that the single client machine isn’t a bottleneck.
This might sound tedious but it is both necesary and educational.