-1

I have 2 servers sitting in a rack running Ubuntu 16.04 with a 1 meter Ethernet cable between them, both having standard Intel Ethernet adapters.

The ping between the two is about 300 us (microseconds).

This is a standard latency I've seen in most Gigabit-Ethernet setups.

But this latency still seems quite high compared to theoretical limits; why is it? I have read that 1 GbE can achieve 40 us latency.

Is this the minimum latency I can expect, or is there software tuning I can perform to reduce this latency? What is the bottleneck? Is it Linux? On this gamer web site for Windows the tool in the screenshot seems to suggest 40 us latency in most cases, but that doesn't help me much for my Linux servers.

(How) can I make my ping 40 us?

EDIT: Looking at the screenshot again, it might be that the 40 us shown are not actually roundtrip time, but it is actually a specific delay within the Windows kernel and thus the 40 us may only be part of the total roundtrip time, which may be higher and is not listed. This would also be in line with the answers in here.

(I originally asked this question at superuser; at this time it wasn't clear to me that ServerFault would be a more appropriate community to ask network performance questions, and I don't have enough reputation there to move the question, so I reposed here. I have also switched the hardware to server hardware.)

closed as off-topic by joeqwerty, Ward, mdpc, Dave M, ThoriumBR Oct 5 '17 at 18:45

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    This belongs on SuperUser, where you originally posted it. That it didn't get answers there doesn't make it on-topic here, nor does changing your hypothetical from "two laptops" to "two servers". – ceejayoz Sep 18 '17 at 0:36
  • @ceejayoz According to this and the FAQ for ServerFault and the FAQ for SuperUser, SuperUser is for "computer software or hardware" and ServerFault is for "every question about server, networking, or related infrastructure". This is a server/networking/infrastructure question, and one that experienced network engineers are more likely able to answer than PC power users. – nh2 Sep 18 '17 at 0:44
  • By your own admission - "I have also switched the hardware to server hardware" - you changed your question in an attempt to make it on-topic here. You're also, IMO, breaking the "don't ask questions where there is no actual problem to be solved" bit in serverfault.com/help/dont-ask – ceejayoz Sep 18 '17 at 0:48
  • 1
    "ServerFault is for 'every question about server, networking, or related infrastructure'." No. "Questions on Server Fault must be about managing information technology systems in a business environment. Home and end-user computing questions may be asked on Super User, and questions about development, testing and development tools may be asked on Stack Overflow." – Ron Maupin Sep 18 '17 at 0:59
  • @RonMaupin I took that quote to which you anwered "no" directly from the ServerFault FAQ. I have this problem in my business environment, in particular I'm trying to reduce network latency to make my GlusterFS network file system faster. – nh2 Sep 18 '17 at 1:26
8

A ping does not measure latency nor does it measure round-trip time. It measures ICMP echo request response time. ICMP messages run with low priority and take way longer than serious traffic.

As @barbequesauce has pointed out, twisted pair requires some complex encoding, so 1000BASE-T NICs will require at least 10 µs per side for the codecs (plus system bus and IRQ latency). Twisted-pair cat.6 has a velocity factor of 65% (~200,000 km/s), so it adds .05 µs or 50 ns per 10 m. Fiber isn't really faster (VF of 67%) but uses simpler encoding with maybe 5 µs per side instead of 10 µs.

The IP stack will add some more µs to your latency budget. On a fast system you could maybe get away with ~20 µs.

Of course, the exact values for the NICs, your system bus and the IP stack depend on your hardware and software. The figures above are about as good as you can get. And don't use ping to measure.

In a nutshell, you most certainly have no real problem at all, the problem is with interpreting the ping output.

  • Thanks for your answer, some clarifying questions: (1) What would you use to measure instead? I've used netperf (in TCP_RR and UDP_RR modes) and it reports numbers in line with ping. Is it correct to expect ping to be equally fast given that there's a direct cable between both machines and they are otherwise idle, so there is no congestion ("serious traffic")? (2) Regarding IP stack latency, are the ~20 ms for each way through the stack, i.e. should I expect 4x 20 ms IP stack latency in a full roundtrip, or a different factor? Thanks! – nh2 Sep 18 '17 at 20:32
  • 2
    Ping may report values close to real round trip times but there's no guarantee. Especially with network hardware, ping is usually handled by the cpu and may be orders of magnitude slower than 'real' traffic. Note that I was counting µs, not ms. All in all, IP stack, encoding, transfer, decoding, IP stack and back you can maybe get away with 120 µs (minimum frame, maximum adds 12 µs per hop). Lowest latency mandates that you deactivate all power management (CPU, PCIe). – Zac67 Sep 18 '17 at 20:56
  • The ms was a typo, well spotted, and thanks for the extra information! – nh2 Sep 18 '17 at 21:27
  • Accepting this answer because it contains the most detail. – nh2 Sep 25 '17 at 20:36
2

So two things to consider -

Copper adds latency, compared to fiber - 15us per side of an exchange, if I remember correctly from my HFT days. A 1m copper cable will intro 60us of delay all by itself. Fiber, on the other hand, is ~5us.

The other (arguably more important) consideration lies in IP stack tuning and serialization delay. Out of the box, the stack might be tuned for smaller packets; in that case ping would be chunked up for sending - and receiving - so the stack would slow down response time... make sure both sides are tuned for the same sizes to be sure.

  • The actual propagation delay is pretty negligible for copper UTP, compared to other latencies, because the max distance supported is only ~100 metres at ~2/3rd the speed of light. e.g. en.wikipedia.org/wiki/Transmission_time#Propagation_delay calculates that 100m of UTP adds 0.5 us propagation delay to the total latency from send to receive. So the difference between copper and fiber is all in the encoding overhead, not the actual physical propagation over the medium itself. – Peter Cordes Jun 28 at 23:33
  • Absolutely right - if it's a single piece of copper. It's the exchanges that add the latency I'm referring to - RJ45 head of a patch cord into a jack on a motherboard or into a patch panel, the other side of the patch panel to a patch cord, etc. The physical transitions add up. – barbequesauce Aug 1 at 16:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.