redis 为啥写比读快
发布网友
发布时间:2022-04-29 11:14
我来回答
共4个回答
热心网友
时间:2022-05-03 17:14
Actually this is only an effect that by default you measure more I/O than the actual command execution time. If you start enabling pipelining in the benchmark, it is a bit more the measure of the actual command performance, and the numbers will change:
$ redis-benchmark -q -n 1000000 -P 32 set foo bar
set foo bar: 338964.03
$ redis-benchmark -q -n 1000000 -P 32 get foo
get foo: 432713.09 requests per second
Now GET is faster :-)
We should include pipelining in our benchmark doc page.
EDIT: This is even more evident here:
redis 127.0.0.1:6379> info commandstats
# Commandstats
cmdstat_get:calls=1001568,usec=221845,usec_per_call=0.22
cmdstat_set:calls=831104,usec=498235,usec_per_call=0.60
This command provides CPU time to serve the request internally, without accounting for I/O. SET is three times slower to process.
热心网友
时间:2022-05-03 18:32
惩究挤蒜吐亲腰休钟诵
热心网友
时间:2022-05-03 20:06
谜义肯搂徒革井鹿场卡
热心网友
时间:2022-05-03 21:58
界典议病忍伙至界奴临