Skip to content

Commit 3a2364b

Browse files
authored
Add the benchmark test for vineyard clients. (#1966)
Fixes #1946 Signed-off-by: Ye Cao <[email protected]>
1 parent 87c8c02 commit 3a2364b

File tree

7 files changed

+908
-2
lines changed

7 files changed

+908
-2
lines changed

benchmark/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
if(BUILD_VINEYARD_MALLOC)
22
add_subdirectory(alloc_test)
3+
add_subdirectory(blob_test)
34
endif()

benchmark/alloc_test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
set(BENCH_ALLOCATOR_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/bench_allocator.cpp)
1+
set(BENCH_ALLOCATOR_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/bench_allocator.cc)
22

33
macro(add_benchmark target)
44
if(BUILD_VINEYARD_BENCHMARKS_ALL)

benchmark/alloc_test/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Referred from <https://github.com/daanx/mimalloc-bench/blob/master/bench/alloc-t
99
Configure with the following arguments when building vineyard:
1010

1111
```bash
12-
cmake .. -DBUILD_VINEYARD_MALLOC=ON -DBUILD_VINEYARD_BENCHMARK=ON
12+
cmake .. -DBUILD_VINEYARD_MALLOC=ON -DBUILD_VINEYARD_BENCHMARKS=ON
1313
```
1414

1515
Then make the following targets:

benchmark/alloc_test/bench_allocator.cpp renamed to benchmark/alloc_test/bench_allocator.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
#include <time.h>
3737
#include <chrono>
38+
#include <cstring>
3839
#include <fstream>
3940
#include <iostream>
4041
#include <memory>

benchmark/blob_test/CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
set(BENCH_BLOB_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/blob_test.cc)
2+
3+
if(BUILD_VINEYARD_BENCHMARKS_ALL)
4+
set(blob_benchmark_options "")
5+
else()
6+
set(blob_benchmark_options "EXCLUDE_FROM_ALL")
7+
endif()
8+
9+
add_executable(blob_benchmark ${blob_benchmark_options} ${BENCH_BLOB_SRCS})
10+
11+
target_include_directories(blob_benchmark PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
12+
13+
target_link_libraries(blob_benchmark PRIVATE vineyard_client)
14+
15+
add_dependencies(vineyard_benchmarks blob_benchmark)

benchmark/blob_test/README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Blob benchmark test
2+
3+
In the blob benchmark test, we will focus on the performance of the basic blob
4+
operations:
5+
6+
- `PutBlob`: Put data into local vineyard. It contains two steps: first, create a blob in vineyard, then copy the data into the blob.
7+
- `GetBlob`: Get data from local vineyard.
8+
- `PutBlobs`: Put multiple blobs into local vineyard.
9+
- `GetBlobs`: Get multiple blobs from local vineyard.
10+
- `PutRemoteBlob`: Put data into remote vineyard. Unlike `PutBlob`, the data is prepared beforehand and then copied into a Vineyard blob. Therefore, this operation avoids manual memory copying.
11+
- `GetRemoteBlob`: Get data from remote vineyard.
12+
- `PutRemoteBlobs`: Put multiple blobs into remote vineyard.
13+
- `GetRemoteBlobs`: Get multiple blobs from remote vineyard.
14+
15+
Also, the performance is measured in terms of **throughput** and **latency**.
16+
17+
## Build the benchmark
18+
19+
Configure with the following arguments when building vineyard:
20+
21+
```bash
22+
cmake .. -DBUILD_VINEYARD_BENCHMARKS=ON
23+
```
24+
25+
Then make the following targets:
26+
27+
```bash
28+
make vineyard_benchmarks -j
29+
```
30+
31+
The artifacts will be placed under the `${CMAKE_BINARY_DIR}/bin/` directory:
32+
33+
```bash
34+
./bin/blob_benchmark
35+
```
36+
37+
## Run the benchmark with customized parameters
38+
39+
**Important** Before running the benchmark, you need to start the vineyard server first. You could refer to the [launching vineyard server guide](https://v6d.io/notes/getting-started.html#launching-vineyard-server) for more information.
40+
41+
After that, you could get the help information by running the following command:
42+
43+
```bash
44+
./bin/blob_benchmark --help
45+
Usage: ./bin/blob_benchmark [OPTIONS]
46+
Options:
47+
-h, --help Show this help message and exit
48+
-i, --ipc_socket=IPC_SOCKET Specify the IPC socket path (required)
49+
-r, --rpc_endpoint=RPC_ENDPOINT Specify the RPC endpoint (required)
50+
-d, --rdma_endpoint=RDMA_ENDPOINT Specify the RDMA endpoint (required)
51+
-c, --clients_num=NUM Number of clients (required)
52+
-s, --data_size=SIZE Data size (e.g., 1KB, 1MB) (required)
53+
-n, --requests_num=NUM Number of requests (required)
54+
-t, --num_threads=NUM Number of threads (required)
55+
-o, --operation=TYPE Operation type (put_blob, get_blob, put_blobs, get_blobs, put_remote_blob, get_remote_blob, put_remote_blobs, get_remote_blobs) (required)
56+
```
57+
58+
For example, you could run the following command to test the performance of `PutBlob`:
59+
60+
```bash
61+
./bin/blob_benchmark -i /tmp/vineyard.sock -r "127.0.0.1:9600" -d "" -c 50 -s 8MB -n 1000 -t 10 -o "put_blob"
62+
```

0 commit comments

Comments
 (0)