Brussels / 30 & 31 January 2016


Design and Implementation of the MoonGen Packet Generator

Using Lua for high-speed network testing and benchmarking

MoonGen is a scriptable high-speed packet generator suitable to test network devices with millions of packets per second at rates of above 10 Gbit/s. Each packet is crafted in real time by a user-defined Lua script to ensure the maximum possible flexibility. MoonGen is available as free and open source software on GitHub, a scientific paper describing it was published at the Internet Measurement Conference in October 2015.

What is MoonGen?

MoonGen is a flexible high-speed packet generator. It can saturate 10 GbE links with minimum-sized packets while using only a single CPU core by running on top of the packet processing framework DPDK. Linear multi-core scaling allows for even higher rates: We have tested MoonGen with up to 178.5 Mpps at 120 Gbit/s. Moving the whole packet generation logic into user-controlled Lua scripts allows us to achieve the highest possible flexibility. In addition, we utilize hardware features of commodity NICs that have not been used for packet generators previously. A key feature is the measurement of latency with sub-microsecond precision and accuracy by using hardware timestamping capabilities of modern commodity NICs. We address timing issues with software-based packet generators and apply methods to mitigate them with both hardware support and with a novel method to control the inter-packet gap in software. Features that were previously only possible with hardware-based solutions are now provided by MoonGen on commodity hardware. MoonGen is available as free software under the MIT license in our git repository at

Using Lua for Networking Tasks

MoonGen is 90% Lua. Each single packet that is sent out is crafted in real time by a user-defined Lua script which needs to process millions of packets per second. There are several challenges that are addressed by MoonGen in order to achieve this. The most important one is multi-threading: all modern NICs are natively multi-core aware and linear multi-core scaling is a must for any modern packet processing app. This talk will address how MoonGen uses a shared-nothing architecture to implement multi-threading via multiple LuaJIT VMs, how the real-time requirements of a packet generator can be fulfilled despite interruptions from the JIT and the garbage collector.

More Information on MoonGen

A scientific paper describing MoonGen was published at the Internet Measurement Conference in October 2015.


Paul Emmerich