2023-05-01 17:15:42 +00:00
|
|
|
# Benchmarks
|
|
|
|
|
|
|
|
This directory contains some micro-benchmarks that can help objectively
|
2023-11-18 13:55:01 +00:00
|
|
|
establish the performance implications of a change, and also benchmarks that
|
|
|
|
test the performance of different datastores using both the library and the SDK
|
2023-05-01 17:15:42 +00:00
|
|
|
|
|
|
|
## Manual usage
|
|
|
|
|
2023-11-18 13:55:01 +00:00
|
|
|
### Common
|
|
|
|
|
2023-05-01 17:15:42 +00:00
|
|
|
Execute the following command at the top level of the repository:
|
|
|
|
|
|
|
|
```console
|
2023-11-18 13:55:01 +00:00
|
|
|
$ cargo make bench
|
|
|
|
```
|
|
|
|
|
|
|
|
### Specific datastore
|
|
|
|
Execute the following commands at the top level of the repository:
|
|
|
|
|
|
|
|
* Memory datastore using the lib or the SDK
|
|
|
|
```console
|
|
|
|
$ cargo make bench-lib-mem
|
|
|
|
$ cargo make bench-sdk-mem
|
2023-05-16 22:31:30 +00:00
|
|
|
```
|
|
|
|
|
2023-11-18 13:55:01 +00:00
|
|
|
* RocksDB datastore using the lib or the SDK
|
|
|
|
```console
|
|
|
|
$ cargo make bench-lib-rocksdb
|
|
|
|
$ cargo make bench-sdk-rocksdb
|
|
|
|
```
|
|
|
|
|
|
|
|
* FoundationDB datastore using the lib or the SDK
|
|
|
|
* Start FoundationDB
|
|
|
|
```
|
|
|
|
$ docker run -ti -e FDB_NETWORKING_MODE=host --net=host foundationdb/foundationdb:7.1.30
|
|
|
|
```
|
|
|
|
* Run the benchmarks
|
|
|
|
```console
|
|
|
|
$ cargo make bench-lib-rocksdb
|
|
|
|
$ cargo make bench-sdk-rocksdb
|
|
|
|
```
|
|
|
|
|
|
|
|
* WebSocket remote server using the SDK
|
|
|
|
* Start SurrealDB server
|
|
|
|
```
|
|
|
|
$ cargo make build
|
|
|
|
$ ./target/release/surreal start
|
|
|
|
```
|
|
|
|
* Run the benchmarks
|
|
|
|
```console
|
|
|
|
$ cargo make bench-sdk-ws
|
|
|
|
```
|
|
|
|
|
|
|
|
|
2023-05-16 22:31:30 +00:00
|
|
|
## Profiling
|
|
|
|
|
|
|
|
Some of the benchmarks support CPU profiling:
|
|
|
|
|
|
|
|
```console
|
2023-11-18 13:55:01 +00:00
|
|
|
cargo make bench --profile-time=5
|
2023-05-16 22:31:30 +00:00
|
|
|
```
|
|
|
|
|
2023-11-18 13:55:01 +00:00
|
|
|
Once complete, check the `target/criterion/**/profile/flamegraph.svg` files.
|