Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to view Redis benchmark parameters

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to check the Redis benchmark". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to check the Redis benchmark"!

Redis comes with a tool called redis-benchmark to simulate N clients issuing M requests at the same time. (similar to Apacheab programs). You can use redis-benchmark-h to view the benchmark parameters.

The following parameters are supported: Usage: redis-benchmark [- h] [- p] [- c] [- n [- k]-h Server hostname (default 127.0.0.1)-p Server port (default 6379)-s Server socket (overrides host and port)-c Number of parallel connections (default 50)-n Total number of requests ( Default 10000)-d Data size of SET/GET value in bytes (default 2)-k 1=keep alive 0=reconnect (default 1)-r Use random keys for SET/GET/INCR Random values for SADD Using this option the benchmark will get/set keys in the form mykey_rand:000000012456 instead of constant keys, the argument determines the max number of values for the random number. For instance if set to 10 only rand:000000000000-rand:000000000009 range will be allowed. -P Pipeline requests. Default 1 (no pipeline). -Q Quiet. Just show query/sec values-- csv Output in CSV format-l Loop. Run the tests forever-t Only run the comma separated list of tests. The test names are the same as the ones produced as output. -I Idle mode. Just open N idle connections and wait.

You need to start an instance of Redis before benchmarking. The test is usually started like this:

Redis-benchmark-Q-n 100000

This tool is very easy to use, and you can use your own benchmarking tool, but we need to pay attention to some details when we start the benchmarking.

Run only a subset of test cases

You don't have to run all of redis-benchmark 's default tests every time. Use the-t parameter to select the test cases you need to run, such as the following example:

$redis-benchmark-t set,lpush-n 100000-qSET: 74239.05 requests per secondLPUSH: 79239.30 requests per second

In the above test, we only ran the SET and LPUSH commands and ran them in quiet mode (using the-Q parameter).

You can also specify commands to run directly, such as the following example:

$redis-benchmark-n 100000-q script load "redis.call ('set','foo','bar')" script load redis.call (' set','foo','bar'): 69881.20 requests per second select the range size of the test key

By default, the benchmark uses a single key. In a memory-based database, there is no big change between a single key test and the real situation. Of course, using a large key range space, you can simulate cache misses in the real world.

At this point we can use the-r command. For example, suppose we want to set 100, 000 random key consecutive SET 1 million times, we can use the following command:

$redis-cli flushallOK$ redis-benchmark-t set-r 100000-n 1000000 = SET = 1000000 requests completed in 13.86 seconds 50 parallel clients 3 bytes payload keep alive: 199.76% `

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report