-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge #522: feat: added benchmarking binary for torrent repository st…
…ruct ebb7d4c chore: make Containerfile use nightly rust (Warm Beer) 1735a7a chore: only run contract, deployment & testing jobs in nightly rust (Warm Beer) 6087e4f feat: added benchmarking binary for torrent repository (Warm Beer) Pull request description: Moved the `Tracker.torrents` field to be its own `TorrentRepository` struct with different implementations. Added a new crate that benchmarks the different `TorrentRepository` implementations for speed. ### Run benchmarks ```shell cargo run --release -p torrust-torrent-repository-benchmarks -- --threads 4 --sleep 0 --compare true ``` #### Example result ```shell tokio::sync::RwLock<std::collections::BTreeMap<InfoHash, Entry>> add_one_torrent: Avg/AdjAvg: (146ns, 0ns) update_one_torrent_in_parallel: Avg/AdjAvg: (5.965616ms, 5.816375ms) add_multiple_torrents_in_parallel: Avg/AdjAvg: (14.050554ms, 14.132902ms) update_multiple_torrents_in_parallel: Avg/AdjAvg: (7.201337ms, 7.120315ms) std::sync::RwLock<std::collections::BTreeMap<InfoHash, Entry>> add_one_torrent: Avg/AdjAvg: (82ns, 83ns) update_one_torrent_in_parallel: Avg/AdjAvg: (27.311075ms, 26.869114ms) add_multiple_torrents_in_parallel: Avg/AdjAvg: (28.967141ms, 28.967141ms) update_multiple_torrents_in_parallel: Avg/AdjAvg: (48.316966ms, 0ns) std::sync::RwLock<std::collections::BTreeMap<InfoHash, Arc<std::sync::Mutex<Entry>>>> add_one_torrent: Avg/AdjAvg: (137ns, 125ns) update_one_torrent_in_parallel: Avg/AdjAvg: (5.057729ms, 5.057729ms) add_multiple_torrents_in_parallel: Avg/AdjAvg: (48.833962ms, 48.833962ms) update_multiple_torrents_in_parallel: Avg/AdjAvg: (6.193212ms, 6.071166ms) tokio::sync::RwLock<std::collections::BTreeMap<InfoHash, Arc<std::sync::Mutex<Entry>>>> add_one_torrent: Avg/AdjAvg: (174ns, 166ns) update_one_torrent_in_parallel: Avg/AdjAvg: (5.56332ms, 5.56332ms) add_multiple_torrents_in_parallel: Avg/AdjAvg: (16.360504ms, 15.872786ms) update_multiple_torrents_in_parallel: Avg/AdjAvg: (6.800225ms, 6.890521ms) tokio::sync::RwLock<std::collections::BTreeMap<InfoHash, Arc<tokio::sync::Mutex<Entry>>>> add_one_torrent: Avg/AdjAvg: (192ns, 208ns) update_one_torrent_in_parallel: Avg/AdjAvg: (6.374304ms, 6.17711ms) add_multiple_torrents_in_parallel: Avg/AdjAvg: (17.313591ms, 17.089898ms) update_multiple_torrents_in_parallel: Avg/AdjAvg: (6.955371ms, 6.975057ms) ``` ### Relevant issues #496 #495 Top commit has no ACKs. Tree-SHA512: 062d18c91b1d89ab95eda5ddc2cb7674d481b705a21c43e9cf3a11e0bf71e52bb6bccd5b5e4404fcf8ebdc442764dd60006c6962aac2a414c4b4cdecfa422a67
- Loading branch information
Showing
19 changed files
with
1,117 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ jobs: | |
|
||
strategy: | ||
matrix: | ||
toolchain: [stable, nightly] | ||
toolchain: [nightly] | ||
|
||
steps: | ||
- id: checkout | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[package] | ||
name = "torrust-torrent-repository-benchmarks" | ||
authors.workspace = true | ||
categories.workspace = true | ||
description.workspace = true | ||
documentation.workspace = true | ||
edition.workspace = true | ||
homepage.workspace = true | ||
keywords.workspace = true | ||
license.workspace = true | ||
publish.workspace = true | ||
repository.workspace = true | ||
rust-version.workspace = true | ||
version.workspace = true | ||
|
||
[dependencies] | ||
aquatic_udp_protocol = "0.8.0" | ||
clap = { version = "4.4.8", features = ["derive"] } | ||
futures = "0.3.29" | ||
tokio = { version = "1", features = ["macros", "net", "rt-multi-thread", "signal", "sync"] } | ||
torrust-tracker = { path = "../../" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use clap::Parser; | ||
|
||
#[derive(Parser, Debug)] | ||
#[command(author, version, about, long_about = None)] | ||
pub struct Args { | ||
/// Amount of benchmark worker threads | ||
#[arg(short, long)] | ||
pub threads: usize, | ||
/// Amount of time in ns a thread will sleep to simulate a client response after handling a task | ||
#[arg(short, long)] | ||
pub sleep: Option<u64>, | ||
/// Compare with old implementations of the torrent repository | ||
#[arg(short, long)] | ||
pub compare: Option<bool>, | ||
} |
Oops, something went wrong.