Testing Performance
This document verifies network performance optimization in a Docker-based environment with bond4 and IPVLAN configurations.
The following uses the redis-benchmark stress test on four redis-server instances as an example to verify whether the feature is successfully enabled and to obtain the performance test result if the feature is enabled. This section includes affinity configuration and performance testing. Perform affinity configuration based on the container or physical machine scenario.
Affinity Configuration (Container Scenario)
- Access the four Docker containers on the server.
1docker exec -it {Container name} bash
- Start one redis-server instance in each Docker container. That is, four redis-server instances are started.
1 2
cd path/redis-6.0.20 ./src/redis-server ./redis.conf --bind 0.0.0.0 --port 6379
- Perform the test as instructed in Performance Testing.
Affinity Configuration (Physical Machine Scenario)
- Start one redis-server instance in each Docker container. That is, four redis-server instances are started.
1 2
cd path/redis-6.0.20 cgexec -g cpu:$dirname ./src/redis-server ./redis.conf --bind 0.0.0.0 --port 6379
- Perform the test as instructed in Performance Testing.
Performance Testing
- After the Redis process is started, run the following commands to check whether the network multipathing feature is successfully enabled on the NICs:
1 2
ethtool -u eth1 ethtool -u eth2
eth1 and eth2 indicate the device names of the NICs with the network multipathing feature enabled. If any configuration rule is displayed, as shown in the following figure, the network multipathing feature is enabled. Otherwise, the feature is disabled.

- Go to the Redis directory on the client and prepare the stress test script. You can use the following script and modify parameters as needed.
Modify the following parameters as required:
- REDIS_PATH: Redis root directory
- REDIS_SERVER_IP_PREFIX: IP address subnet
- redis_server_ip_suffix: start IP address suffix
- instances: number of instances
- client: parameter of the -c option, set to the optimal number of concurrent connections
- size: parameter of the -d option, which is 3 (bytes) by default and can be changed to 256 or other values
#!/bin/bash REDIS_PATH="xxx1" # Redis directory REDIS_PORT=6379 REDIS_SERVER_IP_PREFIX="192.168.xx" redis_server_ip_suffix=128 # Start IP address suffix instances=4 # Number of instances client=200 # Parameter of -c size=3 # Parameter of -d, which is 3 by default # Stop the redis-benchmark process and clear test data logs. pkill redis-benchmark DATA_LOG="xxx2" # Directory for storing performance test results mkdir -p $DATA_LOG rm -rf ${DATA_LOG}/* # Perform the redis-benchmark stress test on the client. job_ids="" for (( instance=1; instance<=instances; instance++ )); do REDIS_SERVER_IP="${REDIS_SERVER_IP_PREFIX}.${redis_server_ip_suffix}" echo "Running redis-benchmark on ${REDIS_SERVER_IP}:$REDIS_PORT" echo "${REDIS_PATH}/src/redis-benchmark -h ${REDIS_SERVER_IP} -p $REDIS_PORT" ${REDIS_PATH}/src/redis-benchmark -h ${REDIS_SERVER_IP} -p $REDIS_PORT -c $client -d $size -n 10000000 -r 10000000 -t set,get --threads 20 -q >> ${DATA_LOG}/${instances}_c${client}_d${size}_${REDIS_SERVER_IP}_${REDIS_PORT}.log & job_ids="$job_ids $!" ((redis_server_ip_suffix++)) done # Wait for redis-benchmark to complete. echo "Waiting for the $instances jobs: SET, GET" wait $job_ids - Run the stress test script to perform the redis-benchmark test on the four instances simultaneously.
The performance test results are recorded in the DATA_LOG directory. Run the cat ./* command to view the results. The average performance of the four instances is the four-instance performance.