做一些小程序要用到数据库,由于Serverless所以不想自建服务器做,就打算借助外力.
提供者:http://redislabs.com/
免费套餐:
- 只在部分地区提供
- 30个并发连接
- 30MB储存
性能测试:
redis-benchmark -h redis-14504.c61.us-east-1-3.ec2.cloud.redislabs.com -p 14504 -a Pldg74aNadkGD6NCsvG3ZaQNUNjouUkk -c 30 -n 500000 -d 32
从us-east-1 AWS EC2测试结果:
====== PING_INLINE ====== 500000 requests completed in 10.20 seconds 30 parallel clients 32 bytes payload keep alive: 1 98.60% <= 1 milliseconds 99.57% <= 2 milliseconds 99.68% <= 3 milliseconds 99.86% <= 4 milliseconds 99.90% <= 5 milliseconds 99.90% <= 6 milliseconds 99.92% <= 7 milliseconds 99.95% <= 8 milliseconds 99.95% <= 9 milliseconds 99.95% <= 10 milliseconds 99.96% <= 11 milliseconds 99.98% <= 12 milliseconds 99.98% <= 13 milliseconds 100.00% <= 14 milliseconds 100.00% <= 205 milliseconds 100.00% <= 208 milliseconds 49034.03 requests per second ====== PING_BULK ====== 500000 requests completed in 10.22 seconds 30 parallel clients 32 bytes payload keep alive: 1 98.54% <= 1 milliseconds 99.52% <= 2 milliseconds 99.72% <= 3 milliseconds 99.90% <= 4 milliseconds 99.92% <= 5 milliseconds 99.92% <= 6 milliseconds 99.95% <= 7 milliseconds 99.95% <= 8 milliseconds 99.96% <= 11 milliseconds 99.96% <= 12 milliseconds 99.97% <= 13 milliseconds 99.98% <= 14 milliseconds 99.99% <= 15 milliseconds 100.00% <= 15 milliseconds 48942.84 requests per second ====== SET ====== 500000 requests completed in 10.09 seconds 30 parallel clients 32 bytes payload keep alive: 1 98.70% <= 1 milliseconds 99.63% <= 2 milliseconds 99.76% <= 3 milliseconds 99.85% <= 4 milliseconds 99.94% <= 5 milliseconds 99.98% <= 6 milliseconds 99.98% <= 7 milliseconds 99.98% <= 8 milliseconds 99.98% <= 9 milliseconds 99.99% <= 10 milliseconds 99.99% <= 11 milliseconds 100.00% <= 12 milliseconds 100.00% <= 12 milliseconds 49554.01 requests per second ====== GET ====== 500000 requests completed in 10.11 seconds 30 parallel clients 32 bytes payload keep alive: 1 98.97% <= 1 milliseconds 99.68% <= 2 milliseconds 99.85% <= 3 milliseconds 99.92% <= 4 milliseconds 99.95% <= 5 milliseconds 99.97% <= 6 milliseconds 99.98% <= 7 milliseconds 99.99% <= 8 milliseconds 99.99% <= 9 milliseconds 99.99% <= 10 milliseconds 99.99% <= 11 milliseconds 100.00% <= 12 milliseconds 100.00% <= 20 milliseconds 100.00% <= 21 milliseconds 49455.98 requests per second ====== INCR ====== 500000 requests completed in 10.01 seconds 30 parallel clients 32 bytes payload keep alive: 1 99.28% <= 1 milliseconds 99.84% <= 2 milliseconds 99.92% <= 3 milliseconds 99.96% <= 4 milliseconds 99.97% <= 5 milliseconds 99.98% <= 6 milliseconds 99.99% <= 7 milliseconds 99.99% <= 8 milliseconds 99.99% <= 13 milliseconds 99.99% <= 14 milliseconds 99.99% <= 17 milliseconds 100.00% <= 18 milliseconds 100.00% <= 18 milliseconds 49950.05 requests per second ====== LPUSH ====== 500000 requests completed in 10.09 seconds 30 parallel clients 32 bytes payload keep alive: 1 99.43% <= 1 milliseconds 99.90% <= 2 milliseconds 99.95% <= 3 milliseconds 99.97% <= 4 milliseconds 99.98% <= 5 milliseconds 99.99% <= 6 milliseconds 100.00% <= 7 milliseconds 100.00% <= 8 milliseconds 100.00% <= 9 milliseconds 100.00% <= 9 milliseconds 49558.93 requests per second ====== RPUSH ====== 500000 requests completed in 10.18 seconds 30 parallel clients 32 bytes payload keep alive: 1 99.12% <= 1 milliseconds 99.88% <= 2 milliseconds 99.94% <= 3 milliseconds 99.96% <= 4 milliseconds 99.98% <= 5 milliseconds 99.98% <= 6 milliseconds 99.98% <= 8 milliseconds 99.99% <= 9 milliseconds 99.99% <= 10 milliseconds 99.99% <= 12 milliseconds 99.99% <= 16 milliseconds 100.00% <= 16 milliseconds 49096.62 requests per second ====== LPOP ====== 500000 requests completed in 10.19 seconds 30 parallel clients 32 bytes payload keep alive: 1 99.13% <= 1 milliseconds 99.89% <= 2 milliseconds 99.96% <= 3 milliseconds 99.97% <= 4 milliseconds 99.99% <= 5 milliseconds 99.99% <= 6 milliseconds 100.00% <= 7 milliseconds 100.00% <= 8 milliseconds 100.00% <= 12 milliseconds 100.00% <= 13 milliseconds 100.00% <= 13 milliseconds 49053.27 requests per second ====== RPOP ====== 500000 requests completed in 10.35 seconds 30 parallel clients 32 bytes payload keep alive: 1 98.61% <= 1 milliseconds 99.84% <= 2 milliseconds 99.88% <= 3 milliseconds 99.90% <= 4 milliseconds 99.92% <= 5 milliseconds 99.95% <= 6 milliseconds 99.98% <= 7 milliseconds 99.98% <= 8 milliseconds 99.99% <= 13 milliseconds 99.99% <= 15 milliseconds 100.00% <= 15 milliseconds 48285.86 requests per second ====== SADD ====== 500000 requests completed in 10.15 seconds 30 parallel clients 32 bytes payload keep alive: 1 99.01% <= 1 milliseconds 99.91% <= 2 milliseconds 99.95% <= 3 milliseconds 99.96% <= 4 milliseconds 99.98% <= 5 milliseconds 99.99% <= 6 milliseconds 99.99% <= 7 milliseconds 99.99% <= 8 milliseconds 99.99% <= 9 milliseconds 99.99% <= 10 milliseconds 100.00% <= 11 milliseconds 49285.36 requests per second ====== HSET ====== 500000 requests completed in 10.04 seconds 30 parallel clients 32 bytes payload keep alive: 1 99.46% <= 1 milliseconds 99.91% <= 2 milliseconds 99.95% <= 3 milliseconds 99.97% <= 4 milliseconds 99.99% <= 5 milliseconds 99.99% <= 6 milliseconds 100.00% <= 7 milliseconds 100.00% <= 8 milliseconds 100.00% <= 11 milliseconds 100.00% <= 11 milliseconds 49795.84 requests per second ====== SPOP ====== 500000 requests completed in 9.90 seconds 30 parallel clients 32 bytes payload keep alive: 1 99.28% <= 1 milliseconds 99.75% <= 2 milliseconds 99.86% <= 3 milliseconds 99.92% <= 4 milliseconds 99.96% <= 5 milliseconds 99.97% <= 6 milliseconds 99.97% <= 7 milliseconds 99.98% <= 8 milliseconds 99.98% <= 9 milliseconds 99.98% <= 10 milliseconds 99.99% <= 11 milliseconds 99.99% <= 12 milliseconds 99.99% <= 13 milliseconds 99.99% <= 14 milliseconds 100.00% <= 206 milliseconds 100.00% <= 206 milliseconds 50530.57 requests per second ====== LPUSH (needed to benchmark LRANGE) ====== 500000 requests completed in 9.86 seconds 30 parallel clients 32 bytes payload keep alive: 1 99.42% <= 1 milliseconds 99.87% <= 2 milliseconds 99.93% <= 3 milliseconds 99.96% <= 4 milliseconds 99.97% <= 5 milliseconds 99.98% <= 6 milliseconds 99.98% <= 7 milliseconds 99.99% <= 8 milliseconds 99.99% <= 9 milliseconds 99.99% <= 10 milliseconds 99.99% <= 11 milliseconds 99.99% <= 17 milliseconds 100.00% <= 205 milliseconds 50720.23 requests per second ====== LRANGE_100 (first 100 elements) ====== 500000 requests completed in 25.16 seconds 30 parallel clients 32 bytes payload keep alive: 1 13.79% <= 1 milliseconds 96.16% <= 2 milliseconds 99.29% <= 3 milliseconds 99.68% <= 4 milliseconds 99.83% <= 5 milliseconds 99.93% <= 6 milliseconds 99.97% <= 7 milliseconds 99.98% <= 8 milliseconds 99.98% <= 9 milliseconds 99.98% <= 10 milliseconds 99.99% <= 12 milliseconds 99.99% <= 13 milliseconds 99.99% <= 14 milliseconds 99.99% <= 15 milliseconds 100.00% <= 16 milliseconds 100.00% <= 20 milliseconds 100.00% <= 20 milliseconds 19874.39 requests per second ====== LRANGE_300 (first 300 elements) ====== 500000 requests completed in 64.95 seconds 30 parallel clients 32 bytes payload keep alive: 1 0.10% <= 1 milliseconds 7.13% <= 2 milliseconds 43.01% <= 3 milliseconds 81.28% <= 4 milliseconds 96.22% <= 5 milliseconds 98.44% <= 6 milliseconds 99.06% <= 7 milliseconds 99.38% <= 8 milliseconds 99.53% <= 9 milliseconds 99.60% <= 10 milliseconds 99.66% <= 11 milliseconds 99.69% <= 12 milliseconds 99.71% <= 13 milliseconds 99.72% <= 14 milliseconds 99.75% <= 15 milliseconds 99.78% <= 16 milliseconds 99.84% <= 17 milliseconds 99.92% <= 18 milliseconds 99.96% <= 19 milliseconds 99.98% <= 20 milliseconds 99.99% <= 21 milliseconds 100.00% <= 22 milliseconds 100.00% <= 23 milliseconds 100.00% <= 24 milliseconds 100.00% <= 33 milliseconds 100.00% <= 33 milliseconds 7698.70 requests per second ====== LRANGE_500 (first 450 elements) ====== 500000 requests completed in 93.50 seconds 30 parallel clients 32 bytes payload keep alive: 1 0.06% <= 1 milliseconds 0.89% <= 2 milliseconds 10.21% <= 3 milliseconds 36.95% <= 4 milliseconds 63.34% <= 5 milliseconds 86.96% <= 6 milliseconds 95.91% <= 7 milliseconds 98.65% <= 8 milliseconds 99.23% <= 9 milliseconds 99.50% <= 10 milliseconds 99.64% <= 11 milliseconds 99.72% <= 12 milliseconds 99.78% <= 13 milliseconds 99.82% <= 14 milliseconds 99.84% <= 15 milliseconds 99.86% <= 16 milliseconds 99.88% <= 17 milliseconds 99.91% <= 18 milliseconds 99.93% <= 19 milliseconds 99.96% <= 20 milliseconds 99.97% <= 21 milliseconds 99.98% <= 22 milliseconds 99.99% <= 23 milliseconds 99.99% <= 24 milliseconds 100.00% <= 25 milliseconds 100.00% <= 26 milliseconds 100.00% <= 27 milliseconds 100.00% <= 28 milliseconds 100.00% <= 29 milliseconds 100.00% <= 30 milliseconds 100.00% <= 31 milliseconds 5347.65 requests per second ====== LRANGE_600 (first 600 elements) ====== 500000 requests completed in 123.88 seconds 30 parallel clients 32 bytes payload keep alive: 1 0.06% <= 1 milliseconds 0.60% <= 2 milliseconds 2.00% <= 3 milliseconds 15.75% <= 4 milliseconds 30.85% <= 5 milliseconds 54.88% <= 6 milliseconds 71.88% <= 7 milliseconds 82.47% <= 8 milliseconds 91.94% <= 9 milliseconds 97.49% <= 10 milliseconds 98.65% <= 11 milliseconds 99.08% <= 12 milliseconds 99.31% <= 13 milliseconds 99.45% <= 14 milliseconds 99.53% <= 15 milliseconds 99.59% <= 16 milliseconds 99.64% <= 17 milliseconds 99.69% <= 18 milliseconds 99.74% <= 19 milliseconds 99.80% <= 20 milliseconds 99.86% <= 21 milliseconds 99.91% <= 22 milliseconds 99.95% <= 23 milliseconds 99.97% <= 24 milliseconds 99.98% <= 25 milliseconds 99.99% <= 26 milliseconds 99.99% <= 27 milliseconds 100.00% <= 28 milliseconds 100.00% <= 29 milliseconds 100.00% <= 30 milliseconds 100.00% <= 31 milliseconds 100.00% <= 32 milliseconds 100.00% <= 33 milliseconds 100.00% <= 36 milliseconds 4036.23 requests per second ====== MSET (10 keys) ====== 500000 requests completed in 10.60 seconds 30 parallel clients 32 bytes payload keep alive: 1 98.74% <= 1 milliseconds 99.59% <= 2 milliseconds 99.72% <= 3 milliseconds 99.87% <= 4 milliseconds 99.95% <= 5 milliseconds 99.97% <= 6 milliseconds 99.97% <= 7 milliseconds 99.99% <= 8 milliseconds 100.00% <= 13 milliseconds 100.00% <= 14 milliseconds 100.00% <= 16 milliseconds 100.00% <= 205 milliseconds 47183.16 requests per second
如果处于不同区域的节点,速度可能就不一样了,下面这个测试来自我博客的服务器,访问日本节点,ICMP延迟在52毫秒左右.
PING dynamodb.ap-northeast-1.amazonaws.com (52.94.8.210) 56(84) bytes of data. 64 bytes from 52.94.8.210 (52.94.8.210): icmp_seq=1 ttl=233 time=52.5 ms 64 bytes from 52.94.8.210 (52.94.8.210): icmp_seq=2 ttl=233 time=52.6 ms 64 bytes from 52.94.8.210 (52.94.8.210): icmp_seq=3 ttl=233 time=52.5 ms 64 bytes from 52.94.8.210 (52.94.8.210): icmp_seq=4 ttl=233 time=52.5 ms 64 bytes from 52.94.8.210 (52.94.8.210): icmp_seq=5 ttl=233 time=52.5 ms 64 bytes from 52.94.8.210 (52.94.8.210): icmp_seq=6 ttl=233 time=52.5 ms 64 bytes from 52.94.8.210 (52.94.8.210): icmp_seq=7 ttl=233 time=52.5 ms 64 bytes from 52.94.8.210 (52.94.8.210): icmp_seq=8 ttl=233 time=52.6 ms 64 bytes from 52.94.8.210 (52.94.8.210): icmp_seq=9 ttl=233 time=52.5 ms 64 bytes from 52.94.8.210 (52.94.8.210): icmp_seq=10 ttl=233 time=52.5 ms 64 bytes from 52.94.8.210 (52.94.8.210): icmp_seq=11 ttl=233 time=52.8 ms 64 bytes from 52.94.8.210 (52.94.8.210): icmp_seq=12 ttl=233 time=52.5 ms 64 bytes from 52.94.8.210 (52.94.8.210): icmp_seq=13 ttl=233 time=52.5 ms 64 bytes from 52.94.8.210 (52.94.8.210): icmp_seq=14 ttl=233 time=52.5 ms 64 bytes from 52.94.8.210 (52.94.8.210): icmp_seq=15 ttl=233 time=52.5 ms 64 bytes from 52.94.8.210 (52.94.8.210): icmp_seq=16 ttl=233 time=53.0 ms 64 bytes from 52.94.8.210 (52.94.8.210): icmp_seq=17 ttl=233 time=52.5 ms 64 bytes from 52.94.8.210 (52.94.8.210): icmp_seq=18 ttl=233 time=52.5 ms 64 bytes from 52.94.8.210 (52.94.8.210): icmp_seq=19 ttl=233 time=52.6 ms 64 bytes from 52.94.8.210 (52.94.8.210): icmp_seq=20 ttl=233 time=52.5 ms 64 bytes from 52.94.8.210 (52.94.8.210): icmp_seq=21 ttl=233 time=52.6 ms 64 bytes from 52.94.8.210 (52.94.8.210): icmp_seq=22 ttl=233 time=52.5 ms 64 bytes from 52.94.8.210 (52.94.8.210): icmp_seq=23 ttl=233 time=52.5 ms
测试结果:
====== PING_INLINE ====== 500000 requests completed in 925.61 seconds 30 parallel clients 32 bytes payload keep alive: 1 0.00% <= 51 milliseconds 4.62% <= 52 milliseconds 14.58% <= 53 milliseconds 26.24% <= 54 milliseconds 54.37% <= 55 milliseconds 77.32% <= 56 milliseconds 91.37% <= 57 milliseconds 92.82% <= 58 milliseconds 93.74% <= 59 milliseconds 94.65% <= 60 milliseconds 95.71% <= 61 milliseconds 97.03% <= 62 milliseconds 97.98% <= 63 milliseconds 98.88% <= 64 milliseconds 99.36% <= 65 milliseconds 99.66% <= 66 milliseconds 99.81% <= 67 milliseconds 99.85% <= 68 milliseconds 99.86% <= 69 milliseconds 99.87% <= 70 milliseconds 99.87% <= 71 milliseconds 99.87% <= 72 milliseconds 99.87% <= 73 milliseconds 99.87% <= 74 milliseconds 99.87% <= 75 milliseconds 99.87% <= 76 milliseconds 99.87% <= 305 milliseconds 99.87% <= 306 milliseconds 99.87% <= 307 milliseconds 99.88% <= 308 milliseconds 99.88% <= 309 milliseconds 99.88% <= 310 milliseconds 99.88% <= 311 milliseconds 99.88% <= 312 milliseconds 99.88% <= 313 milliseconds 99.88% <= 314 milliseconds 99.89% <= 315 milliseconds 99.89% <= 316 milliseconds 99.89% <= 317 milliseconds 99.89% <= 318 milliseconds 99.90% <= 319 milliseconds 99.90% <= 320 milliseconds 99.90% <= 321 milliseconds 99.91% <= 322 milliseconds 99.92% <= 323 milliseconds 99.94% <= 324 milliseconds 99.96% <= 325 milliseconds 99.97% <= 326 milliseconds 99.97% <= 327 milliseconds 99.98% <= 328 milliseconds 99.98% <= 329 milliseconds 99.99% <= 330 milliseconds 99.99% <= 331 milliseconds 99.99% <= 332 milliseconds 99.99% <= 333 milliseconds 100.00% <= 334 milliseconds 100.00% <= 335 milliseconds 100.00% <= 336 milliseconds 100.00% <= 337 milliseconds 100.00% <= 339 milliseconds 100.00% <= 590 milliseconds 100.00% <= 591 milliseconds 100.00% <= 592 milliseconds 100.00% <= 594 milliseconds 100.00% <= 595 milliseconds 540.18 requests per second
所以实际性能和网络关系还挺大的,redis本身足够快,但是想获得好的能力,还需要自己网络本身快.