Categorygithub.com/maguec/RedisSim
modulepackage
0.1.7
Repository: https://github.com/maguec/redissim.git
Documentation: pkg.go.dev

# README

Redis Sim

This is a command line tool to simulate various scenarios running against a Redis compatable cluster. The goal is to make it easy to show how a cluster responds under CPU pressure and Memory Pressure

Building

git clone https://github.com/maguec/RedisSim.git
cd RedisSim
# install go and make
sudo apt-get install -y golang-1.21 make
make

Options

To see what is available run

./RedisSim -h

String Fill

Create a large number of keys in a Redis database of type STRING

For example the following create 1M keys in about 40 seconds

./RedisSim 	--port 30001 --clients 100 \
		--server localhost stringfill \
		--string-count 1000000 \
		--prefix stringprefix

Exercise

Update a large number of keys in a Redis database of type STRING

For example the following read then update 100K keys two times in a loop

./RedisSim 	--port 30001 exercise  \
		--prefix stringprefix  --runs 2 \
		--key-count 100000 --ratio 1:1

Load CSV

Load a CSV file into Redis type HASH and set the keyname

If we have the following csv file

Name,Age,Profession,Team
Tim,35,Pitcher,Giants
Joe,71,Quarterback,49ers
Steph,34,Guard,Warriors

it can be loaded into Redis using the Name as the key with a prefix of athletes

./RedisSim 	loadcsv --port 30001  \
		--csv-file /tmp/test.csv \
		--key-field Name  --csv-prefix athletes
$ redis-cli -c -p 30001 hgetall athletes:Tim
1) "Name"
2) "Tim"
3) "Age"
4) "35"
5) "Profession"
6) "Pitcher"
7) "Team"
8) "Giants"

HyperLogLog Benchmark

Add entries to a HYPERLOGLOG and count them.

This will return the latencies and rates for both the PFADD and PFCOUNT commands.

Hyperloglog will return the approximated cardinality of a set of values and is often used to get real time statistics in a very performant and efficient manner.

Create 1000 separate Hyperloglog keys, add 1000000 entries to each key and then count 100 times

./RedisSim 	--port 30001  --hll-count 1000   \
		 --hll-entry-count 10000 --hll-runs 10

Hotkey Simulation

Since Redis is single threaded, it is possible to have a single hot key that is taking all of the writes. In a cluster setup, this can mean that even scaling the cluster does not eliminate slow performance.

./RedisSim 	hotkey

CPU Kill

Run the most expensive Redis command of SUNION in a loop to really ramp up CPU usage. This will get your command latency in the hundreds of milliseconds quite easily

./RedisSim 	cpukill -c --port 30001 --clients 100

# Packages

Copyright © 2023 Chris Mague [email protected] */.
No description provided by the author
No description provided by the author