As a manufacturer of WAN emulation appliances, we’re often asked, “Why don’t you make a software version that I can install on a Windows PC or even Linux?”
The short answer is that it is not possible to make a good network emulator in software, and making a bad one would only hurt our reputation for quality products.
Fundamentally, a network emulator is a packet timing system (plus queuing, but timing is the problem here). Obviously, adding WAN latency is a matter of taking a packet in and holding it for that amount of time before sending it back out again. Less obvious is that bandwidth emulation is also a matter of timing – simulating a 45 Mbps WAN link when connected to a 1 Gbps LAN requires accurately spacing the transmission of individual packets to match the bandwidth constraint.
A general purpose PC, running a general purpose operating system, is good for many things, but accurate timing is not one of them.
To start with, the operating system timers available to applications are not precise enough to guarantee sub-millisecond accuracy. But just as importantly, other events on the PC cause interrupts that interfere with emulation timing.
Even when there is no other software running on the machine, there are still plenty of plenty of processes running, from BIOS checks to memory clean-up. During these interrupts, no packets go in or out. Packets that arrive equally spaced will end up transmitted together in a burst, and if too many arrive while the system is busy, some will get dropped.
Ethernet controllers and drivers add another level of complication. Some are good and some are awful. Cheap ones have buffers that are too small to handle a burst of packets arriving at the same time, causing throughput limits and unintended packet loss. More expensive ones are often too smart for their own good, at least for use as a timing system. In order to improve PC efficiency, they hold individual packets as they arrive and hand them to the CPU in a group. This makes it possible for web servers to handle far more users, but is disastrous for emulation precision.
In addition, Ethernet controllers are usually connected to the CPU and memory through a PCI bus or PCIe interface, and frequently there is not enough internal bandwidth to support bidirectional traffic at full speed on all ports. An emulator built on a PC platform with gigabit interfaces is rarely capable of passing a gigabit of traffic in both directions.
Together, the effect is that results with a software-based emulator are unpredictable and often wrong. Users can waste days troubleshooting a performance issue that turns out to be an artifact of the emulator rather than a problem with the application being tested. And a test tool that isn’t accurate and potentially gives misleading results, is worse than useless.
So, while it’s possible to make a software emulator that can be installed on a PC, producing a good emulator requires a purpose-built appliance.