moonpol is a traffic policer prototype on libmoon library. libmoon has high packet processing performance by bringing DPDK and LuaJIT together. Using this library, moonpol implements a token bucket algorithm for rate limiting and DIR-24-8-BASIC data structure for faster lookup.
moonpol is nothing but a libmoon script. Therefore, it is strongly recommended to take a look at the readme of libmoon first. A configuration file is needed to run the policer. It is a list of subnets and rate limits in terms of packets per second (pps). Two example configurations (config and config_ru) made available in the repository.
# install dependencies and compile libmoon sudo apt-get install git build-essential cmake linux-headers-`uname -r` lshw libnuma-dev git clone https://github.com/libmoon/libmoon git clone https://github.com/erkinkirdan/moonpol mv moonpol/policer.lua moonpol/config libmoon cd libmoon ./build.sh # bind all NICs that are not actively used (no IP configured) to DPDK sudo ./bind-interfaces.sh # configure hugetlbfs sudo ./setup-hugetlbfs.sh # run policer sudo ./build/libmoon policer.lua
generator.lua can be used for load generator under libmoon.
configgen.cpp is a small program for generating configuration files for benchmarking.