Testing Functions (Single-Node System)
- On the server, access the four Docker containers, and start a redis-server instance with network asynchronization enabled in each Docker container.
1docker exec -it {Container name} bash
- For Redis 6.0.20:
1 2
cd path/redis-6.0.20 ./src/redis-server ./redis.conf --bind 0.0.0.0 --port 6379
- For Redis 7.0.15:
1 2
cd path/redis-7.0.15 ./src/redis-server ./redis.conf --bind 0.0.0.0 --port 6379
- For Redis 6.0.20:
- 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.
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 6.0.20 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 is the number of instances. The value 4 is used in this section.
- client is a parameter of -c, indicating the optimal number of concurrent connections. The default value is 200, which can be changed as required.
- size is a 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.
If no error is reported, the function verification is successful.
Parent topic: Verifying the Feature