February 6th, 2024

On using milliseconds as a measure of network latency

One of the things I do is serve as an API design reviewer, reviewing and providing feedback on all new APIs added to Windows. There was a network property being added that reported the latency of a network connection. One of the other API reviewers put a note on that property asking, “As network technology improves, will millisecond granularity for reporting latency be sufficient, or should we use microseconds or even nanoseconds?”

I was not the team responsible for the new property, but I felt compelled to clarify the situation: “The speed of light is unlikely to improve.”

(I mean, maybe some scientific breakthrough could result in improvements, but that would result in a much more fundamental change to the design of the new property: It would have to be changed from an unsigned to a signed type!)

Bonus chatter: Now, even with current technology, a smaller unit could still be useful, if the other system is so close by that the latency is less than one millisecond. But once you get that close, the variability in latency begins to overwhelm the actual value. And the target audience for this particular network property was multiplayer online games, so anything less than one millisecond is “amazingly great”. You’d be thrilled to have the problem of having to choose among multiple sub-millisecond game partners!

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

11 comments

Discussion is closed. Login to edit/delete existing comments.

  • Ian Boyd · Edited

    It took me decades to break free of the shackles of, "Don't use floats because floating point math is slow. Use integer math."

    It wasn't until Eric Brumer's talks (e.g. "Native Code Performance and Memory - The Elephant in the CPU") where he pointed out that a modern CPU can take the square root of a 32-bit number in the amount of time it takes to get a value out of the L2 cache and into a place where it can be used.

    Performing computations is no longer what the CPU spends most of it's time doing. Only about 1%...

    Read more
  • Arne

    “will millisecond granularity for reporting latency be sufficient, or should we use microseconds or even nanoseconds”

    Several posts suggesting that it depends on distance, which I would counter by saying that the granularity has nothing to do with the distance.

    If the granularity is only millisecond, then one will not see changes in the latency of under one millisecond.

    Microsoft operating systems can measure latency granularity in the nanosecond range with PTP, the total latency of the connection is irrelevant.

  • Simon Farnsworth

    It can also be fun when people are worrying about this to turn time into distance limit; 3 microseconds is approximately 1 kilometer at the speed of light and 1 millisecond is approximately 300 km. Is it important in this interface to be able to distinguish "peer must be within walking distance (microseconds)" from "peer must be in the same country (milliseconds)"? Or, for the nanosecond suggestion, "peer must be in touching distance", since 1 nanosecond is around 0.3 meters?

    Sometimes, this degree of resolution is actually useful; if you're looking at being able to distinguish "same box" from "same rack"...

    Read more
    • Brian Boorman

      Electrons in chips and on circuit boards don’t travel at the speed of light. They travel slower. About half the speed of light on FR4 circuit board.

      • Simon Farnsworth

        Electrons don't travel at half the speed of light on FR4; they travel at around 5 to 10 cm per hour. The electromagnetic wave travels at about half the speed of light on an FR4 circuit board. Similar applies in optical fibre - the electromagnetic wave of interest travels at around 2/3rds the speed of light. For most cables intended to carry communication signals, you can find the "velocity factor" listed, which is the speed of the electromagnetic wave traveling through that cable; for coax, this can be as low as 66% c, and as high as 93% c, while...

        Read more
  • word merchant

    “640K ought to be enough for anybody.”

    • Simon Farnsworth

      FWIW, that’s probably apocryphal, but when I’ve gone digging, the people who can place it in any form of context have Mr Gates saying that 640K ought to be enough for anybody using MS-DOS, and that you should switch to Microsoft Xenix if MS-DOS is too restrictive.

      Similar applies here – the context is multiplayer games, where everything else that affects play (such as input lag, frame output delay etc) is also measured in milliseconds. If we were talking about an interface for debugging datacentre networks, or on-chip data movements, milliseconds would be an unreasonable data unit, but we’re not.

  • Yuri Khan
    • Sigge Mannen

      I thought this post looked familiar!

  • Daniel Smith

    I can imagine a data center of the future where the entire data center lives on single chip, and all the network communications are virtualised such that they appear to be communicating over ethernet, but internally it’s happening at the speed of the CPU. So nanosecond latency might not be as wild as it sounds.

    Of course, once you exit the data center, you’d be back to normal speeds, but the servers within the data center communicating with each other might need metrics.

  • Brian Boorman

    I always thought that “social skills of a thermonuclear device” should have been it’s own category here.