DHCP load test tool
Table of Contents
Introduction
This document is a reference manual for Nippon C.A.D. Co., Ltd.'s "dhcpperf" DHCP load testing tool.
The DHCP load testing tool simulates the sending of DHCP address requests by multiple clients simultaneously to a DHCP server in order to test and evaluate its performance under high loads. Scenario data files are used for the DHCP information, making it possible for clients to specify not only lease requests and releases, but also relay routes and other unique options when performing testing.
Quick Start Guide
This tool is started using the command format below.
- ./dhcpaperf [Startup options]... <device name> [Scenario data files]...
To perform a basic test, run the following command.
./dhcpperf -v -s <DHCP server IP address> <device name>
Replace <device name> with the name of the network device in the network where the DHCP server is located. Unicast will be used to send DHCPDISCOVER messages, DHCPREQUEST messages, and DHCPRELEASE messages to the specified DHCP server IP address.
When it is not possible to communicate with the DHCP server, measurement will not be successful, and the following will be displayed.
secs success failure active | minimum current maximum | average slowest fastest 1 0 0 0 | 0 0 0 | 0 0 0 2 0 0 2 | 0 0 0 | 0 0 0 3 0 0 3 | 0 0 0 | 0 0 0 Unable to continue.
When it is possible to communicate with the DHCP server, a message which begins as follows will be displayed.
secs success failure active | minimum current maximum | average slowest fastest 1 0 0 0 | 0 0 0 | 0 0 0 2 1 0 1 | 0 0 0 | 303 303 303 3 2 0 1 | 0 2 2 | 303 303 303 ...
First, the DHCP server's performance limit will be measured.
secs success failure active | minimum current maximum | average slowest fastest 19 4125 133 2726 | 0 2000 2000 | 302 332 300 Inital probe complete: High-water mark is 2000 clients/second.
The "current" value indicates the number of DHCPDISCOVER messages sent per second. When 2,000 messages per second are sent, one message will be sent every 0.5 milliseconds. See the "Outputting statistical information" section for detailed explanations of each column.
When the maximum number of transactions has been determined, measurement will begin at roughly half the maximum number of transactions.
The default measurement time is 120 seconds. If the number of errors is low, the measurement will be considered to have been successful, the number of transactions will be increased, and measurement will begin again. Conversely, if the number of errors is high, the number of transactions will be decreased, and measurement will begin again.
secs success failure active | minimum current maximum | average slowest fastest 20 4936 505 3579 | 0 0 2000 | 302 332 300 21 5174 1008 2334 | 0 0 2000 | 302 334 300 22 5174 1000 1334 | 0 0 2000 | 302 334 300 23 5174 1334 0 | 0 0 2000 | 302 334 300 Preparing for next test run. 24 5174 0 0 | 0 0 2000 | 302 334 300 25 5174 0 0 | 0 0 2000 | 302 334 300 26 5174 0 0 | 0 0 2000 | 302 334 300 27 5174 0 0 | 0 0 2000 | 302 334 300 28 5174 0 0 | 0 0 2000 | 302 334 300 Beginning test run: 1000 clients/second for 120 seconds. 29 0 0 0 | 0 1000 2000 | 0 0 0 30 566 0 372 | 0 1000 2000 | 301 303 300 31 1372 0 507 | 0 1000 2000 | 301 304 300 32 2160 0 659 | 0 1000 2000 | 301 304 300 33 2943 134 681 | 0 1000 2000 | 301 304 300 Stopping run after 33 seconds; 134/7056 clients failed. Preparing for next test run. 33 2943 0 682 | 0 0 1000 | 301 304 300 34 3182 134 309 | 0 0 1000 | 302 335 300 35 3182 155 154 | 0 0 1000 | 302 335 300 36 3182 154 0 | 0 0 1000 | 302 335 300 37 3182 0 0 | 0 0 1000 | 302 335 300 Beginning test run: 500 clients/second for 120 seconds. 38 0 0 0 | 0 500 1000 | 0 0 0 ... 706 88228 0 455 | 775 777 779 | 302 377 300 Succeeded test run: 88228/88246 clients/seconds.
Ultimately, the measurement results with the fewest errors and largest number of successful transactions will be reported as the DHCP server's transaction processing capability.
Finished and report: 777 transactions per second.
This indicates that 777 transactions can be processed per second.
This completes the basic testing process. The process described is for a basic test. Scenario data files can be used to perform tests with detailed parameter settings.
Installation
This tool is available for 64-bit CentOS 5 and CentOS 6. The RPM version can be installed using the following command.
rpm -ivh dhcpperf-<version numbers>.rpm
This will unpack the following files.
/usr/bin/dhcpperf /usr/share/ncad/dhcpperf/expand.dat /usr/share/ncad/dhcpperf/discover.dat /usr/share/ncad/dhcpperf/release.dat /usr/share/ncad/dhcpperf/request.dat
Startup options
- -h --help
Displays the help message - --usage
Displays a simple help message - -v --progress
Displays statistical information, updated every second - -s --server server IP address [, server IP address ...]
Specifies the DHCP server's IP address. Testing is performed using a broadcast address if no DHCP server IP address is specified. - --test-duration time
Specifies the measurement time (in seconds). The default value is 120 seconds. - --hardware XX:XX:XX:XX:XX:XX
Specifies the MAC addresses to use for requests. - --hardware-length number
Specified the length of MAC address to for use requests. number increase incrementally from this value. When the last three bytes reach their maximum value, the last three bytes only are returned to 0. - --clients number
Specifies the initial number of simultaneous requests per second. - --limit number
Specifies the number of upper limit of clients. - --timeout time
Specifies the amount of time considered to be a DHCP packet timeout. The default value is 3 seconds. - --cooldown-time time
Specifies the cooldown time between completing one measurement and beginning the next measurement. The default value is 5 seconds. - --error-threshold threshold value
Specifies the failure ratio which is treated as an error (=number of failures ÷ number of successes x 100). The default value is 0.1%.
(when set to 0.1, one error for every 1,000 successes is not considered an error) - --recv-port port number
Specifies the number of the port on which to receive DHCP packets. When not specified, the default value for client measurement is port number 68, and the default value for relay measurement is port number 67. - --send-port port number
Specifies the number of the port to which to send DHCP packets. The default value is port number 67. - --nthreads number of thread pools
Specifies the number of thread pools the program can use. This number can be matched to the number of cores to improve processing efficiency. - --disable-promiscuous
Don't use promiscuous mode to communicate. - --test-mode [mode]
highload: Measures at the highest speed, gradually stepping down.
slowly: Gradually steps up the load.
endless: Applies a constant load without stopping.
once: Performs processing one time. - --log-file file name
Specifies the name of the saved debug log file.
(* Please note that log rotation is not performed, so log files can become extremely large.) - --exec-file file name
Specifies the script file of the execute before test runnning.
Scenario data files
The scenario data file can be used to define the contents of the DHCP requests.
Name | Data type | Remark | |
---|---|---|---|
Hops | Integer | ||
Secs | Integer | ||
Broadcast | 0 or 1 | ||
Ciaddr | IP address | ||
Yiaddr | IP address | ||
Siaddr | IP address | ||
Giaddr | IP address | ||
Chaddr | IP address | ||
Sname | String | ||
File | String | ||
1...255 | Variant | ||
53 | DHCP message name | DHCP Message Type | |
54 | IP address | Server Identifier | |
DHCP message name
The following string can be used for the DHCP message name.
*Not case sensitive
- DHCPDISCOVER
Sends DHCPDISCOVER messages. Normally, for clients, Broadcast = 1 is specified, and for relays, Giaddr = <DHCP server address> is specified. - DHCPREQUEST
Sends DHCPREQUEST messages. - DHCPRELEASE
Sends DHCPRELEASE messages. - DHCPDECLINE
Sends DHCPDECLINE messages. - DHCPINFORM
Sends DHCPINFORM messages.
Variant
The variant can be entered in the form of a string, IP address list, decimal value, or hexadecimal value.
- Strings is indicated by putting them in double-quotes.
Ex.: "dhcpperf" - IP address lists is indicated by entring them in IPaddress form, such as 192.168.100.1, separated with commas.
Ex.: 192.168.0.100, 192.168.0.101, 192.168.0.102 - Decimal values are indicated by entering values between 0 and 255, separated by commas.
Ex.: 1,2,3,4,5,6,7,8,9 - Hexadecimal values are indicated by entering two-digit values between 00 and FF, separated by colons.
Ex.: 00:01:02:03
Special symbol @auto
When @auto is specified for a parameter value, the same parameter in the response data from the DHCP server is used.
For example, When @auto is specified for option 54, when the response message contains option 54, it is transmitted as-is as a request message. When no option parameter number is included in a DHCPDISCOVER message or response message, no option parameters are included in the next request message. As a general rule, the same response parameters are used, but special values can be set for some parameters by specifying @auto.
Broadcast
When @auto is specified for the Broadcast parameter, the Broadcast parameter will be set to 0 if the command line -server option is specified. If the command line -server option is not specified, the Broadcast parameter will be set to 1.
Therefore, by specifying Broadcast=@auto for DHCPDISCOVER messages only, and specifying Broadcast=0 for all other messages, such as DHCPREQUEST messages, the tester can be switched between client operation or relay operation based on whether the -server command line argument has been specified.
Ciaddr
When @auto is specified for the Ciaddr parameter, the IP address of the Yiaddr parameter in the response from the DHCP server will be set.
Giaddr
When @auto is specified for the Giaddr parameter, the IP address assigned to the device name will be set if the command line -server option is specified.
Chaddr
When @auto is specified for the Chaddr parameter, the MAC address used in the inquiry sent to the DHCP server will be randomized. The randomized MAC addresses will be assigned by using the MAC address value specified with the -hardware command line argument, but with different values for the last three bytes of the address.
*Due to program design, these MAC addresses will generally be sequential, but note that the MAC addresses are not guaranteed to be sequential.
Option 50
When @auto is specified for the Option 50 parameter, the IP address of the Yiaddr parameter in the response from the DHCP server will be set. This parameter is not normally set for DHCPDISCOVER messages. When this parameter is set, Option 50 will be added to DHCPDISCOVER messages.
Option 54
When @auto is specified for the Option 54 parameter, the DHCP server IP address will be specified for Option 54 of DHCPDISCOVER messages specified with the -server command line argument. Therefore, by specifying 54=@auto for all messages, the tester can be switched between client operation or relay operation based on whether the -server command line argument has been specified.
Option 61
When @auto is specified for the Option 61 parameter, the client ID will be automatically allocated. The automatically allocated ID is a 7 byte long ID. The first byte is 0x01, and the remaining bits are the MAC address.
Manipulating the scenario data file by using the -server command line argument
By specifying @auto for Broadcast, Giaddr, and Option 54 in the scenario data file, the tester can be automatically switched between client operation or relay operation based on whether the -server command line argument has been specified. Specific values can also be set for Broadcast, Giaddr, and Option 54 in the scenario data file. When specific values are set, the -server command line argument will be ignored, and testing will be performed based on the scenario data.
Performing DHCP client testing using scenario data
Scenario data defines one item of data transmitted by the tool. Multiple scenario data files can be specified from the command line to control communications with the DHCP server. Each transaction is composed of a series of operations, and the tool measures how many transactions the DHCP server can respond to correctly per second.
The easiest way to measure DHCP server performance is to use the "5 way hand-shake": DHCPDISCOVER -> DHCPOFFER -> DHCPREQUEST -> DHCPACK -> DHCPRELEASE.
This tool uses scenario data files for DHCPDISCOVER, DHCPREQUEST, and DHCPRELEASE messages. Below is an example of the structure of a file that defines scenario data for a "5 way hand-shake" test.
- discover.dat
Hops=0 Secs=0 Broadcast=@auto Ciaddr=0.0.0.0 Yiaddr=0.0.0.0 Siaddr=0.0.0.0 Giaddr=0.0.0.0 Chaddr=@auto Sname="" File="" 12="dhcpperf" 53=DHCPDISCOVER 55=1,3,6,15 61=@auto
- request.dat
Hops=0 Secs=0 Broadcast=@auto Ciaddr=0.0.0.0 Yiaddr=0.0.0.0 Siaddr=0.0.0.0 Giaddr=@auto Chaddr=@auto Sname="" File="" 12="dhcpperf" 53=DHCPREQUEST 54=@auto 55=1,3,6,15 50=@auto 61=@auto
- release.dat
Hops=0 Secs=0 Broadcast=@auto Ciaddr=@auto Yiaddr=0.0.0.0 Siaddr=0.0.0.0 Giaddr=@auto Chaddr=@auto Sname="" File="" 12="dhcpperf" 53=DHCPRELEASE 54=@auto 55=1,3,6,15 50=@auto 61=@auto
./dhcpperf -v <Device name> ./discover.dat ./request.dat ./release.dat
*Client testing uses a broadcast address, so the -server IP address command line argument cannot be specified. Also note that broadcast flag 1 is specified for the discover.dat Broadcast parameter.
Relay agent testing using scenario data
When performing testing via a relay agent, the IP address of the tool must be specified for Giaddr, and the DHCP server IP address must be specified for Option 54. If @auto is specified for Broadcast, Giaddr, and Option 54, the IP address specified in the -server command line argument or the IP address set as the <device name> will be automatically used.
Below is an example of the structure of a file that defines scenario data for a "5 way hand-shake" relay test.
- discover.dat
Hops=0 Secs=0 Broadcast=@auto Ciaddr=0.0.0.0 Yiaddr=0.0.0.0 Siaddr=0.0.0.0 Giaddr=@auto Chaddr=@auto Sname="" File="" 12="dhcpperf" 53=DHCPDISCOVER 54=@auto 55=1,3,6,15,119,95,252,44,46,47,5,197,43,69,42,201,202 61=@auto 82=01:04:20:00:00:1e:02:06:70:58:12:35:13:33
- request.dat
Hops=0 Secs=0 Broadcast=@auto Ciaddr=0.0.0.0 Yiaddr=0.0.0.0 Siaddr=0.0.0.0 Giaddr=@auto Chaddr=@auto Sname="" File="" 12="dhcpperf" 50=@auto 53=DHCPREQUEST 54=@auto 55=1,3,6,15,119,95,252,44,46,47,5,197,43,69,42,201,202 61=@auto 82=01:04:20:00:00:1e:02:06:70:58:12:35:13:33
- release.dat
Hops=0 Secs=0 Broadcast=@auto Ciaddr=@auto Yiaddr=0.0.0.0 Siaddr=0.0.0.0 Giaddr=@auto Chaddr=@auto Sname="" File="" 12="dhcpperf" 50=@auto 53=DHCPRELEASE 54=@auto 55=1,3,6,15,119,95,252,44,46,47,5,197,43,69,42,201,202 61=@auto 82=01:04:20:00:00:1e:02:06:70:58:12:35:13:33
./dhcpperf -v -s <DHCP server IP address> <device name> ./discover.dat ./request.dat ./release.dat
If different Broadcast parameters are set for client and relay testing, and @auto is specified for the Giaddr parameter, the tester can be switched between client operation or relay operation based on whether the -server command line argument has been specified.
*General purpose scenario data is stored in usr/share/ncad/dhcpperf. Testing can be easily performed by editing scenario data files and adding options.
Kinds of load testing
- highload
Measures the maximum load first. The load is increased every second. When the error rate exceeds the threshold, the maximum load is considered to have been reached. Once the maximum load has been determined, a constant load is applied for the test duration, and if the error rate threshold is exceeded, the load is decreased. Conversely, if the error rate threshold is not exceeded, the load is increased, and the DHCP performance is evaluated. - slowly
Maximum DHCP server performance is measured starting with a low load, which is gradually raised. At the start, a load of one transaction per second is applied for the test duration. If the error rate threshold is not exceeded, the load is doubled. Conversely, if the error rate threshold is exceeded, the load is halved, and the DHCP performance is evaluated. - endless
In this form of testing a constant load is applied without stopping. - once
This testing only performs one DHCP server transaction. This testing can be used to confirm connectivity. A return value of "0" indicates connectivity. A return value of "1" indicates a transmission error.
Outputting statistical information
Running the tester with the -v or -progress command line arguments displays statistical information on the standard output device, updated every second.
The following information is output.
- secs
Amount of seconds the program has been running. - success
Total number of transaction successes. - failure
Number of NAK responses or timeouts. - active
Number of transactions in-progress or awaiting responses. - minimum
Minimum number of transactions per second. - current
Number of transactions per second. - maximum
Maximum number of transactions per second. - average
Average time from start to end of each transaction. Measured in milliseconds. - slowest
Maximum time from start to end of a transaction. Measured in milliseconds. - fastest
Minimum time from start to end of a transaction. Measured in milliseconds.
Lease renewal testing
Lease renewal, even when performed via a relay.
Testing sample data which includes lease renewal is contained in /usr/share/ncad/dhcpperf/expand.dat, and can be used by using the following command.
./dhcpperf -v -s <DHCP server IP address> <device name> discover.dat request.dat expand.dat release.dat