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 use redis-benchmark, a benchmark tool for stress testing in nosql redis database

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article will explain in detail how to use redis-benchmark, a benchmark tool for stress testing in nosql redis database. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

1. Check the usage of the benchmark tool

[root@langfang src] # pwd

/ redis_dir/redis-4.0.9/src

[root@langfang src] #. / redis-benchmark-help

Invalid option "- help" or option argument missing

Usage: redis-benchmark [- h] [- p] [- c] [- n] [- k]

-h Server hostname (default 127.0.0.1)-h connects to REDIS server IP. Default is 127.0.0.1.

-p Server port (default 6379)-P REDIS server port, default is 6379

-s Server socket (overrides host and port)-S server socket (override host and port)

-a Password for Redis Auth-- the authentication password of A REDIS AUTH

-c Number of parallel connections (default 50)-- c indicates the number of concurrent connections. The default is 50.

-n Total number of requests (default 100000)-n the total number of requests. Default is 100000, that is, 100000

-d Data size of SET/GET value in bytes (default 3)-- D represents the size of the SET GET. The default size is 3.

-- dbnum SELECT the specified db number (default 0)-- dbnum specifies which database to connect to. Default is database 0.

-k 1=keep alive 0=reconnect (default 1)-k Boolean type. 1: keep the connection. Default: 0: reconnect.

-r Use random keys for SET/GET/INCR, random values for SADD-- r uses random keys for SET GET INCR operations and random values for SADD

Using this option the benchmark will expand the string _ _ rand_int__

Inside an argument with a 12 digits number in the specified range

From 0 to keyspacelen-1. The substitution changes every time a command

Is executed. Default tests use this to hit random keys in the

Specified range.

-P Pipeline requests. Default 1 (no pipeline). -- P is related to pipeline technology. The number of requests is 1 by default, that is, pipeline technology is disabled. If the server reports an error, the error message is displayed.

-e If server replies with errors, show them on stdout.

(no more than 1 error per second is displayed)-only 1 error per second is displayed

-Q Quiet. Just show query/sec values-Q is quiet, showing only query values per second

-- csv Output in CSV format-- CSV output in CSV format

-l Loop. Run the tests forever-L has been pressure testing, does not stop

-t Only run the comma separated list of tests. The test-T-L runs a list of tests separated by commas, specifying specific stress test scenarios, such as set or mget or get and so on

Names are the same as the ones produced as output.

-I Idle mode. Just open N idle connections and wait. -- L idle mode, just open N idle connections and wait

Examples:-example

Run the benchmark with the default configuration against 127.0.0.1:6379:

$redis-benchmark

Use 20 parallel clients, for a total of 100k requests, against 192.168.1.1:

$redis-benchmark-h 192.168.1.1-p 6379-n 100000-c 20

Fill 127.0.0.1:6379 with about 1 million keys only using the SET test:

$redis-benchmark-t set-n 1000000-r 100000000

Benchmark 127.0.0.1:6379 for a few commands producing CSV output:

$redis-benchmark-t ping,set,get-n 100000-- csv

Benchmark a specific command line:

$redis-benchmark-r 10000-n 10000 eval 'return redis.call ("ping")' 0

Fill a list with 10000 random elements:

$redis-benchmark-r 10000-n 10000 lpush mylist _ _ rand_int__

On user specified command lines _ _ rand_int__ is replaced with a random integer

With a range of values selected by the-r option.

[root@langfang src] #

2 the default stress test of the recording redispose

Stress test conclusions include the time consumed by the stress test and the maximum number of requests processed per second, as well as different subsections of various stress test scenarios

[root@langfang src] #. / redis-benchmark

= PING_INLINE =-name of the overview

100000 requests completed in 1.51seconds-Summary conclusion, 100000 requests completed in 1.51s

50 parallel clients

3 bytes payload

Keep alive: 1

96.26%

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

Database

Wechat

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

12
Report