本地redis(规格2核16G)与云服务redis(华为云或阿里云等,规格1G和16G)的性能对比。
第1个对比:内存规格都是16G时,1000字节时的写入结果
可以看到,在1000字节时性能都差不多
1.1 本地localhost的redis测试结果
/usr/local/redis/bin/redis-benchmark -h 127.0.0.1 -p 6379 -t set -c 100 -n 10000 -d 1000 ====== SET ====== 10000 requests completed in 0.10 seconds 100 parallel clients 1000 bytes payload keep alive: 1 100.00% <= 0 milliseconds 104166.66 requests per second
1.2 云redis测试结果
/usr/local/redis/bin/redis-benchmark -h 192.168.0.102 -p 6379 -t set -c 100 -n 10000 -d 1000 ====== SET ====== 10000 requests completed in 0.11 seconds 100 parallel clients 1000 bytes payload keep alive: 1 53.25% <= 1 milliseconds 99.77% <= 2 milliseconds 99.81% <= 4 milliseconds 100.00% <= 4 milliseconds 90090.09 requests per second
2.1 本地localhost的redis测试结果
/usr/local/redis/bin/redis-benchmark -h 127.0.0.1 -p 6379 -t set -c 100 -n 10000 -d 100000 ====== SET ====== 10000 requests completed in 0.58 seconds 100 parallel clients 100000 bytes payload keep alive: 1 …… 17211.71 requests per second
2.2 云redis测试结果
/usr/local/redis/bin/redis-benchmark -h 192.168.0.102 -p 6379 -t set -c 100 -n 10000 -d 100000 ====== SET ====== 10000 requests completed in 13.68 seconds 100 parallel clients 100000 bytes payload keep alive: 1 …… 730.94 requests per second
写入的值如果是1000字节以内的,差别不大。如果是大于1000字节的,特别是到了100000,就太慢了。