3

I was playing around with ping, seeing if my ping was faster than my screen refresh (it is, sometimes) and I decided to ping localhost.

I run an apache webserver which gives a 403 error on localhost. When I ping it, I get a delay of 0.058 ms. Sometimes it's as high as 0.10 2ms

What does this delay represent - surley my computer to my computer should be instant, and why is there such variation - from 0.027 to 0.102 is almost 400% variation.

Tim
  • 2,377

2 Answers2

1

surley my computer to my computer should be instant

0.102ms is the same as 0.102x10^(-3) seconds or 0.000102 seconds. It doesn't get much more "instant" than that.

During this tenth of a thousandth of a second your system has to:

  • read the ICMP echo request from the rxqueue* of the loopback device
  • build a corresponding ICMP echo reply packet
  • write the reply packet to the txqueue* of the loopback interface
  • read the packet back from the rxqueue* for ping to calculate the RTT.

Your concern seems to be that this RTT is not constant. This is explained by the fact that your system is doing a ton other stuff while doing this process.

I run an apache webserver which gives a 403 error on localhost. When I ping it,

If you're using the ping command it doesn't really matter whether you run a webserver or not. If you're using the webserver response time as a "ping" there's quite a few additional layers the packet needs to go through.


(*): this isn't entirely true, any logic below layer 3 is obviously short-circuited, but the point is it will go through the whole stack

GnP
  • 1,436
0

There are many factor which affect delay other than the physical distance the signal has to travel including:

  • Processing Delay: The time it takes to process the packet to determine where it should be sent or to perform error checking to make sure it hasn't been corrupted in transit. Packets may also be kept in a queue before the CPU is ready to process them.
  • Transmission Delay: The time it takes for the bits of the packet to physically be put "on the wire".
  • Propagation Delay: The transit time of the packet in the network. The speed of light and the material that the packet is travelling through is king here.

ICMP packets are generally seen as low priority and all have to be processed by your systems CPU which is where the variation in the delay is being introduced from.