dperf Documentation

repository·main·Indexed 26 days ago

https://github.com/baidu/dperf

A high-performance network traffic generator and load testing tool built on DPDK. dperf is used for benchmarking L4 load balancers, gateways, and network hardware, capable of achieving tens of millions of HTTP Connections Per Second (CPS) and hundreds of Gbps throughput. It includes capabilities for both high-performance HTTP server and client operations, real-time statistics monitoring, and DPDK-based packet processing.

Tokens
1.3K
Snippets
4
Records
8
Agent score
91%

What's inside dperf

  1. Overview of dperf

    main

    dperf is a high-performance network traffic generator and load testing tool built on DPDK. It is designed to generate massive traffic using a single x86 server, capable of achieving tens of millions of HTTP Connections Per Second (CPS), hundreds of Gbps throughput, and billions of concurrent connections.

    Common Use Cases:

    • Load and stability testing for Layer 4 Load Balancers and gateways.
    • Network performance benchmarking for cloud servers.
    • Evaluation of NIC and CPU packet processing capabilities.
    • Acting as a high-performance HTTP server or client for testing scenarios.
  2. Monitor real-time statistics in dperf

    main

    dperf provides real-time metrics printed every second to monitor the progress and health of your load test. The output includes key performance indicators such as CPS, TPS, PPS, packet drops, socket errors, and HTTP status counts.

    seconds 22                 cpuUsage 52
    pktRx   3,001,058          pktTx    3,001,025          bitsRx   2,272,799,040      bitsTx  1,920,657,600      dropTx  0
    arpRx   0                  arpTx    0                  icmpRx   0                  icmpTx  0                  otherRx 0          badRx 0
    synRx   1,000,345          synTx    1,000,330          finRx    1,000,350          finTx    1,000,350          rstRx   0          rstTx 0
    synRt   0                  finRt    0                  ackRt    0                  pushRt  0                  tcpDrop 0
    skOpen  1,000,330          skClose  1,000,363          skCon    230                skErr   0
    httpGet 1,000,345          http2XX  1,000,350          httpErr  0
    ierrors 0                  oerrors  0                  imissed  0
  3. Troubleshoot Gateway Connectivity Errors

    main

    If dperf fails during the initialization phase with the following error message, it indicates a network layer issue:

    Error: bad gateway. dperf cannot find gateway's MAC address. Please check the link.

    This error occurs when neigh_check_gateway(ws) fails. To resolve this:

    1. Verify that the physical link is up.
    2. Ensure the gateway's MAC address is reachable from the configured interface.
    3. Check that the network configuration provided in the command-line arguments correctly identifies the gateway.
  4. Initialize the dperf client with client_init()

    main

    The client_init function initializes the high-performance HTTP client within a given work_space. It calculates the task distribution for Connections Per Second (cps) and Concurrent Connections (cc) across available CPUs using client_assign_task. It also configures the launch parameters (launch_num and launch_interval) based on the configured cps and cpu_num to ensure optimal performance for both small-scale and large-scale tests.

    int client_init(struct work_space *ws)
  5. Initialize the dperf HTTP client with client_init()

    main

    To initialize the dperf HTTP client, call client_init() and pass a pointer to a work_space structure. This function returns an integer representing the success or failure of the initialization process.

    int client_init(struct work_space *ws);
  6. Run dperf via CLI

    main

    dperf is executed as a command-line tool. The entrypoint initializes the configuration, starts a control thread, initializes the DPDK environment, and then runs the performance testing loop across available CPU cores (lcores).

    Key execution steps performed by the binary:

    1. Configuration Parsing: Uses config_parse to process command-line arguments.
    2. Daemon Mode: If the daemon configuration is enabled, the process will detach to the background.
    3. Control Thread: Starts a control thread (ctl_thread_start) to manage the testing session.
    4. DPDK Initialization: Initializes the DPDK environment using dpdk_init.
    5. Execution: Runs the core logic via dpdk_run, which distributes the lcore_main workload across cores.
  7. Initialize the dperf server with server_init()

    main
    The server_init function is used to initialize the high-performance HTTP server environment. It accepts a pointer to a work_space structure which holds the workspace context for the server operations.
  8. Initialize the dperf HTTP server with server_init()

    main

    Use the server_init function to initialize the dperf HTTP server. This function requires a pointer to a work_space structure, which contains the necessary configuration and environment settings for the server to operate.

    int server_init(struct work_space *ws);