Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Low latency/high performance network (ethernet) messaging

Background

I want to create a test application to test the network performance of different systems. To do this I plan to have that machine send out Ethernet frames over a private (otherwise non-busy) network to another machine (or device) that simply receives the message and sends it back. The sending application will record total roundtrip time (among other things).

The purpose of the tests is to see how a particular system (OS + components etc.) performs when it comes to networking traffic. This is illustrated as machine A in the picture below. Note that I'm not interested in the performance of the networking infrastructure (switches, cables etc) - I'm trying to test the performance of network traffic inside Machine A (i.e from when it hits the network card until it reaches user space)

We will (try to) measure all kind of things, one thing is the total roundtrip of the message but also things like interrupt latency of Machine A, general driver overhead etc. Machine A will be a real-time system. But to support these tests, I need a separate machine that can bounce back messages and in other ways add network stimuli to the tested system. This separate machine is Machine B in the picture below and is what this question is about.

General overview of my test system

My problem

I want to develop an application that can receive and return these messages with as consistent (and preferably low) latency as possible. I'm hoping to get latencies that are consistent within a few microseconds at least. For simplicity, I'd like to do this on a general purpose OS like Windows or Linux but I'm open for other suggestions. There will be no other load (CPU or otherwise) on the machine besides the operating system and my test application.

I've thought of the following approaches:

  • A normal application running in user space with a high priority
  • A thread running in kernel space to avoid the userspace/kernelspace transitions
  • An of-the-shelf device that already does this (I haven't found one though)

Questions

Are there any other approaches or perhaps frameworks that already does this? What else do I need to think of to gain a consistent and low latency? What approach is recommended?

like image 221
Isak Savo Avatar asked Jan 04 '12 08:01

Isak Savo


People also ask

Does low latency mean high throughput?

Latency and ThroughputLower latency goes with faster throughput, and higher latency goes with slower throughput. Both of these measures depend on different parts of the streaming setup, so how each of them operates depends on your encoder settings, your network speeds, and the protocols that your setup uses.

What does low and high latency mean?

A low latency network connection is one that generally experiences small delay times, while a high latency connection generally suffers from long delays. Latency is also referred to as a ping rate and typically measured in milliseconds (ms).

What is low latency requirements?

What is Low Latency? Low latency describes a computer network that is optimized to process a very high volume of data messages with minimal delay (latency). These networks are designed to support operations that require near real-time access to rapidly changing data.


1 Answers

You mentioned that you want to test the internal performance of Machine A, but "need a separate machine"; yet, you don't want to test network infrastructure performance.

You know much more about your requirements than I do; however, if I was testing network infrastructure in Machine A, I would set up my test like this:

Looped Machine

There are couple of reasons for this:

  • You can use an Ethernet loopback cable to simulate the "pong" function performed by Machine B
  • Eliminating transit through infrastructure you don't care about is almost always a better solution when measuring performance

If you use this test method, be sure to note these points:

  • Ethernet performs a signal to noise test on the copper before it sets up a link. If you make your loopback bends too tight, you could introduce more latency if ethernet decides to fall back to a lower speed due to the kinks in the cable. There is no minimum length for copper ethernet cabling.
  • As you're probably aware, combinations of NICs / driver versions / OS can have a significant affect on intra-host latency. I work for a network equipment manufacturer, and one of the guys in the office used to work as an applications engineer for SolarFlare. He claims that many of the Wall Street trading systems use SolarFlare's NICs due to the low latency SolarFlare engineers their products for; he also said SolarFlare's drivers give you user-space access to the NIC buffers. Caveat: third-hand info, and I cannot verify myself.
  • If you loop the frames to Machine A, set the source and destination mac-address to the burned-in-address on the NIC

Even if you need to receive a modified "pong" frame from Machine B, you could still use this topology and simply rewrite packet fields on the receive-side of your code in Machine A. Put as many (or few) instrumentation points as you like in Machine A's "modules" to compare frame timestamps.

FYI:

The embedded systems I mentioned in my comments on your question are for measuring latency of network infrastructure, not end hosts. This is the best method I can think of for instrumenting host latency.

like image 115
Mike Pennington Avatar answered Oct 27 '22 23:10

Mike Pennington