RDB and AOF speed test

The same machine test

Redis3.2
Redis5.0.7
Linux python 3.10.0-693.11.1.el7.x86_64 #1 SMP Mon Dec 4 23:52:40 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

rdb test procedure

1. Modify redis.conf profile

  1. Open rdb (test aof, commented rdb, and restart redis)
# save ""
save 900 1
save 300 10
save 60 10000
注入数据

#默认开启数据压缩

rdbcompression yes
  1. Close aof
appendonly no

2. Write data

#!/bin/bash
for ((i=0;i<100000;i++))
do
echo -en "helloworld" | redis-cli -x set name$i >>redis.log
done

3. The data is written using a script, and calculates the injection completion time

The amount of data rdb time rdb file size
50000 76s 1.1M
100000 197s 2.1m
150000 235s 3.1m
200000 305s 4.3M
The amount of data aof time aof file size
50000 79s 2.2M
100000 156s 6.5M
150000 234s 6.6M
200000 306s 8k8n

redis5.0 test version

The amount of data rdb time rdb file size
50000 99s 1.1M
100000 150s 2.1m
150000 296s 3.2M
The amount of data aof time aof file size
50000 98s 2.2M
100000 156s 6.5M
150000 305s 6.7M

A no data redis, using a script written data, after the completion of view persistence file

Record Procedure

Script and use


[kou@python src]$ sh 1.sh 
本次运行时间: 76s
[kou@python src]$ !du
du -sh ./dump.rdb 
1.1M	./dump.rdb
[kou@python src]$ cat 1.sh 
#!/bin/bash

starttime=`date +'%Y-%m-%d %H:%M:%S'`
#执行程序
for ((i=0;i<50000;i++))
do
    echo -en "helloworld" | /home/kou/redis_tar/redis-3.2.10/src/redis-cli -p 6379 -x set name$i >>redis.log
done

endtime=`date +'%Y-%m-%d %H:%M:%S'`
start_seconds=$(date --date="$starttime" +%s);
end_seconds=$(date --date="$endtime" +%s);
echo "本次运行时间: "$((end_seconds-start_seconds))"s"
Published 257 original articles · won praise 223 · views 320 000 +

Guess you like

Origin blog.csdn.net/csdn_kou/article/details/104091942