Testing Performance
- Run the following commands on the server to configure the basic environment.
1 2 3 4 5 6 7 8
systemctl stop firewalld.service systemctl disable firewalld.service sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux setenforce 0 systemctl stop irqbalance.service systemctl disable irqbalance.service swapoff -a systemctl start irqbalance
- Set firewalld to clear kernel modules when it exits.
1sed -i "s/CleanupModulesOnExit=no/CleanupModulesOnExit=yes/g" /etc/firewalld/*.conf
- Restart the firewalld service.
1systemctl restart firewalld
- Stop the firewalld service.
1systemctl stop firewalld
- On the server, access the four Docker containers, and start a redis-server instance with network asynchronization enabled in each Docker container.
For Redis 6.0.20, replace the directory in the command in step 5 with the directory of Redis 6.0.20. Other operations are the same as those of Redis 7.0.15.
1 2 3
docker exec -it {Container name} bash cd path/redis-7.0.15 ./src/redis-server ./redis.conf --bind 0.0.0.0 --port 6379
- Go to the Redis directory on the client and prepare the stress test script. You can modify the parameters in the following script.
The client and server can be deployed on the same machine, but the performance will be affected. You are advised to remotely perform the stress test. That is, install Redis 7.0.15 of the standard edition on a remote machine for the test. For details about the installation, see Redis Porting Guide.
Modify the following parameters as required:
- REDIS_SERVER_IP_PREFIX is the IP address network segment.
- redis_server_ip_suffix is the start IP address suffix.
- instances: number of instances
- client: parameter of -c; set to the optimal number of concurrent connections
- size: parameter of -d, 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 of the server 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.
- After all tests are complete, cancel bond4 configuration by referring to (Optional) Canceling Bond4 Configuration.
Parent topic: Verifying the Feature