A multi-write benchmark for Boost redis client
This benchmarks makes a relatively large number of HSET
requests to the Redis server using Boost.Redis
client.
- C++20 compiler (tested on
gcc
12) boost
(tested v1.83.0, 1.84.0 develop, built with SSL support)boost::redis
installed to the same directory asboost
.
git clone --recurse-submodules -b develop https://github.com/boostorg/boost.git
cd boost
./bootstrap.sh
./b2 --layout=system \
--with-system \
--with-thread \
cxxflags="-std=c++20 -fPIC" \
cflags="-fPIC" \
variant=release \
link=static \
-d0 \
-j 8 \
install
g++ -std=c++20 batch_send_benchmark.cpp -o batch_send_benchmark -lboost_system -lssl -lcrypto
Make sure Boost and SSL can be found by GCC.
mkdir build
cd build
cmake ..
cmake --build .
./batch_send_benchmark [n_req [payload_size]]
where
n_req
is a number ofHSET
requests sent.payload_size
is a number of characters in a payload string.
All the boilerplate aside, this benchmark sends the requests to Redis in two ways. In the separate
part, in function runSeparateRequestsOnce()
, all the requests are sent for execution independently. In the combined
part, in function runCombinedRequestsOnce()
, all the HSET
commands are put into the same request, which is then sent for execution.
The benchmark does three runs in a row: the first one contains only separate part, the second one contains only conbimed part, and the last one contains both parts.