Bật container redis như sau
sudo docker run --name my-redis-containerhost -p 7001:6379 -d redis
Benchmark từ bên ngoài
root@hao:~# redis-benchmark -q -n 100000 -p 7001
PING_INLINE: 82918.74 requests per second
PING_BULK: 88888.89 requests per second
SET: 88573.96 requests per second
GET: 85106.38 requests per second
INCR: 87489.06 requests per second
LPUSH: 86580.09 requests per second
RPUSH: 87873.46 requests per second
LPOP: 87796.30 requests per second
RPOP: 87260.03 requests per second
SADD: 87642.41 requests per second
HSET: 86430.43 requests per second
SPOP: 87565.68 requests per second
LPUSH (needed to benchmark LRANGE): 83472.46 requests per second
LRANGE_100 (first 100 elements): 57670.13 requests per second
LRANGE_300 (first 300 elements): 28248.59 requests per second
LRANGE_500 (first 450 elements): 21008.40 requests per second
LRANGE_600 (first 600 elements): 16334.53 requests per second
MSET (10 keys): 77519.38 requests per second
Chạy thẳng vào container bằng lệnh sau và chạy lại benchmark
docker exec -it my-redis-container bash
root@c0d838287161:/data# redis-benchmark -q -n 100000
PING_INLINE: 125313.29 requests per second, p50=0.191 msec
PING_MBULK: 103412.62 requests per second, p50=0.231 msec
SET: 111234.70 requests per second, p50=0.247 msec
GET: 142450.14 requests per second, p50=0.167 msec
INCR: 141442.72 requests per second, p50=0.175 msec
LPUSH: 148367.95 requests per second, p50=0.167 msec
RPUSH: 145772.59 requests per second, p50=0.175 msec
LPOP: 145137.88 requests per second, p50=0.167 msec
RPOP: 142045.45 requests per second, p50=0.167 msec
SADD: 147058.83 requests per second, p50=0.167 msec
HSET: 145137.88 requests per second, p50=0.167 msec
SPOP: 106837.61 requests per second, p50=0.223 msec
ZADD: 102354.15 requests per second, p50=0.247 msec
ZPOPMIN: 107066.38 requests per second, p50=0.223 msec
LPUSH (needed to benchmark LRANGE): 121359.23 requests per second, p50=0.215 msec
LRANGE_100 (first 100 elements): 56980.06 requests per second, p50=0.439 msec
LRANGE_300 (first 300 elements): 25265.29 requests per second, p50=0.911 msec
LRANGE_500 (first 500 elements): 18281.54 requests per second, p50=1.263 msec
LRANGE_600 (first 600 elements): 15292.86 requests per second, p50=1.527 msec
MSET (10 keys): 105152.48 requests per second, p50=0.287 msec
Article Categories:
config