Question

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

Was it helpful?

Solution

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

  • how long does an operation take to complete? It obviously needs to complete in well under 5 seconds, because the server will want to make another request at that time and they will simply queue up causing chaos.
  • how many concurrent requests can the server handle? Make sure you aren't running a single threaded server; you want to be able to process multiple requests at the same time. This will again ensure that requests don't queue up.

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.

OTHER TIPS

Thats only about 110MB a day... I wouldn't stress about it.

You do mention sending data though... make sure your packets are of reasonable size (you want to avoid DDOSing yourself).

If it were running over the internet I might be more careful however.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top