{"id":8004,"date":"2020-06-22T15:41:00","date_gmt":"2020-06-22T07:41:00","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=8004"},"modified":"2020-06-22T15:41:01","modified_gmt":"2020-06-22T07:41:01","slug":"redis-benchmark","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/redis-benchmark","title":{"rendered":"redis-benchmark\u547d\u4ee4 – Redis\u57fa\u51c6\u6027\u80fd\u6d4b\u8bd5"},"content":{"rendered":"\n

redis-benchmark\u547d\u4ee4\u53ef\u4ee5\u4e3aRedis\u505a\u57fa\u51c6\u6027\u80fd\u6d4b\u8bd5\uff0c\u5b83\u63d0\u4f9b\u4e86\u5f88\u591a\u9009\u9879\u5e2e\u52a9\u5f00 \u53d1\u548c\u8fd0\u7ef4\u4eba\u5458\u6d4b\u8bd5Redis\u7684\u76f8\u5173\u6027\u80fd\u3002<\/p>\n\n\n\n

\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>redis-benchmark [\u53c2\u6570]<\/p>\n\n\n\n

\u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n

-h<\/td>\u670d\u52a1\u7aefIP<\/td><\/tr>
-p<\/td>\u670d\u52a1\u5668\u7aef\u53e3<\/td><\/tr>
-a<\/td>redis\u5bc6\u7801<\/td><\/tr>
-c<\/td>\u5ba2\u6237\u7aef\u8fde\u63a5\u6570\u91cf<\/td><\/tr>
-n<\/td>\u8bf7\u6c42\u603b\u6570<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n

\u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n

\u4f7f\u7528\u9ed8\u8ba4\u914d\u7f6e\u5bf9127.0.0.1:6379\u8fd0\u884c\u57fa\u51c6\u6d4b\u8bd5\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# redis-benchmark<\/pre>\n\n\n\n

\u5bf9192.168.1.1\u4f7f\u752820\u4e2a\u5e76\u884c\u5ba2\u6237\u7aef\uff0c\u603b\u517110\u4e07\u4e2a\u8bf7\u6c42\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# redis-benchmark -h 192.168.1.1 -p 6379 -n 100000 -c 20<\/pre>\n\n\n\n

\u4ec5\u4f7f\u7528SET\u6d4b\u8bd5\uff0c\u7528\u5927\u7ea6100\u4e07\u4e2a\u952e\u586b\u5145127.0.0.1:6379\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# redis-benchmark -t set -n 1000000 -r 100000000<\/pre>\n\n\n\n

\u57fa\u51c6127.0.0.1:6379\uff0c\u7528\u4e8e\u751f\u6210CSV\u8f93\u51fa\u7684\u51e0\u4e2a\u547d\u4ee4\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# redis-benchmark -t ping,set,get -n 100000 --csv<\/pre>\n\n\n\n

\u5bf9\u7279\u5b9a\u547d\u4ee4\u884c\u8fdb\u884c\u57fa\u51c6\u6d4b\u8bd5\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# redis-benchmark -r 10000 -n 10000 eval 'return redis.call(\"ping\")' 0<\/pre>\n\n\n\n

\u752810000\u4e2a\u968f\u673a\u5143\u7d20\u586b\u5145\u5217\u8868\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# redis-benchmark -r 10000 -n 10000 lpush mylist rand_int<\/pre>\n","protected":false},"excerpt":{"rendered":"

redis-benchmark\u547d\u4ee4\u53ef\u4ee5\u4e3aRedis\u505a\u57fa\u51c6\u6027\u80fd\u6d4b\u8bd5\uff0c\u5b83\u63d0\u4f9b\u4e86\u5f88\u591a\u9009\u9879\u5e2e\u52a9\u5f00 \u53d1\u548c\u8fd0\u7ef4\u4eba\u5458\u6d4b\u8bd5Re […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[11],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/8004"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=8004"}],"version-history":[{"count":7,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/8004\/revisions"}],"predecessor-version":[{"id":8080,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/8004\/revisions\/8080"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=8004"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=8004"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=8004"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}