How light is a ping

networkingping

Hopefully this question isn't too dumb. I'm wondering how expensive (system resource, and bandwidth wise) a ping is. If I have a small embedded linux device that has very limited ram, cpu, and bandwidth would it be bad to start a ping command and have it continue running for days?

I'm trying to figure out how to minimize the impact. Looking at the options for ping it looks like I can specify the size. Should I do that to make it smaller? Is there anything else I can do to make it smaller? I need it to run but I don't want it to have any negative impact on ram, cpu, or bandwidth (performance in any way).

In my testing I haven't observed any difference in ram or cpu with it running. I haven't tested network speed very thoroughly but I haven't noticed anything there either. Thoughts?

Best Answer

The cost difference between processing a ping hardly varies at all across byte sizes. The bulk of the cost of responding to one is in the routing table lookup when the reply is sent, and in the various socket logic (which varies based on OS) used to listen for and recieve a packet. This is also negligible in virtually all cases.

The reason for the adjustable size of ICMP echo (ping) packets is so that you can determine network characteristics based on packet size (eg. to find the MTU).

Because most of the cost is in the protocol stack in the kernel, and the NIC operation and network drivers, there is probably plenty a developer or hardware designer could do to make it (and network operation in general) more efficient, but in the general case as a system administrator these present a fixed and negligible load.

Tangentially, many people like to throttle ICMP requests at firewalls to prevent a ping-based DoS attack (which is one of the least effective DoS attacks available).