website/docs/benchmarking/resp-bench.md
Garnet project contains a Benchmark tool for running RESP benchmarking using different clients, different workloads and different strategies for measuring throughput, performance and latency.
This tool exists under the folder:
> Garnet\benchmark\Resp.benchmark
The options available with Resp.benchmark can be seen by running the benchmark tool using the --help command line switch. Example:
> cd Garnet\benchmark\Resp.benchmark
> dotnet run -c Release -f net8.0 -- --help
The benchmark operates in two phases.
In both phases ReqGen is used to generate the requests for either loading data or performing the benchmark.
There are several options to generate requests as indicated by the constructor of the ReqGen class.
public ReqGen(
int Start,
int DbSize,
int NumOps,
int BatchSize,
OpType opType,
bool randomGen = true,
bool randomServe = true,
int keyLen = default,
int valueLen = default)
The following method is used to load the data into the database
public void LoadData(
int loadDbThreads = 8,
int BatchSize = 1 << 12,
int keyLen = default,
int valueLen = default)
The following method is used to run an iteration of the benchmark for a given operation with the specified parameters
public void Run(
OpType opType,
int TotalOps,
int[] NumThreads,
int BatchSize = 1 << 12,
TimeSpan runTime = default,
bool randomGen = true,
bool randomServe = true,
int keyLen = default,
int valueLen = default)
The commands that can be benchmarked from each category are:
These options measure performance of the server in a continuous online mode.
From the folder:
Garnet/benchmark/Resp.benchmark
For a run with 1 client session:
dotnet run -c Release -f net8.0 -- --online --op-workload GET,SET --op-percent 50,50 -b 1 -t 1
For a run with 16 client sessions:
dotnet run -c Release -f net8.0 -- --online --op-workload GET,SET --op-percent 50,50 -b 1 -t 16
For a run using ZADD and ZCARD commands:
dotnet run -c Release -f net8.0 -- --online --op-workload ZADD,ZCARD --op-percent 50,50 -b 1 -t 1 --keylength --client SERedis
Where:
This category of benchmark use our LightClient with pre-created batches, to measure how much throughput the server can achieve for a given period of time.
Some examples of running offline benchmarks are:
dotnet run -c Release -f net8.0 -- --op GET -t 2,4,8,16 -b 512 --dbsize 10241024 --keylength 1024
dotnet run -c Release -f net8.0 -- --op ZADDCARD -t 64 --b 512 --dbsize 16777216 --keylength 512
Where:
You can pre-populate the store with keys before running GET benchmarks by performing the following steps:
dotnet run -c Release -f net8.0 -- --op MSET --dbsize 16777216 --keylength 512
Then execute the GET command in online mode:
dotnet run -c Release -f net8.0 -- --op-workload GET --online -b 1 --op-percent 100 -t 64 --client GarnetClientSession --itp 1024 --runtime -1 --dbsize 16777216 --keylength 512
If you want to know how high the hit rate you can execute from any client CLI tool:
INFO stats
Look at the garnet_hit_rate metric, the value ideally, should be close to 100.
Metrics need to be enabled in the Garnet server for getting stats with the INFO command:
--latency-monitor --metrics-sampling-freq 5