Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added benchmarking binary for torrent repository struct #522

Merged
merged 3 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/contract.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
toolchain: [stable, nightly]
toolchain: [nightly]

steps:
- id: checkout
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
toolchain: [stable, nightly]
toolchain: [nightly]

steps:
- id: checkout
Expand Down Expand Up @@ -44,7 +44,7 @@ jobs:
name: Setup Toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
toolchain: ${{ matrix.toolchain }}

- id: publish
name: Publish Crates
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

strategy:
matrix:
toolchain: [stable, nightly]
toolchain: [nightly]

steps:
- id: checkout
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:

strategy:
matrix:
toolchain: [stable, nightly]
toolchain: [nightly]

steps:
- id: checkout
Expand Down
97 changes: 97 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ version = "3.0.0-alpha.12-develop"
[dependencies]
aquatic_udp_protocol = "0"
async-trait = "0"
axum = "0.6"
axum = { version = "0.6", features = ["macros"] }
axum-client-ip = "0.4"
axum-server = { version = "0", features = ["tls-rustls"] }
binascii = "0"
Expand Down Expand Up @@ -68,16 +68,18 @@ tower-http = { version = "0.4", features = ["compression-full"] }
uuid = { version = "1", features = ["v4"] }

[dev-dependencies]
criterion = { version = "0.5.1", features = ["async_tokio"] }
local-ip-address = "0"
mockall = "0"
once_cell = "1.18.0"
reqwest = { version = "0", features = ["json"] }
serde_bytes = "0"
serde_repr = "0"
serde_urlencoded = "0"
torrust-tracker-test-helpers = { version = "3.0.0-alpha.12-develop", path = "packages/test-helpers" }

[workspace]
members = ["contrib/bencode", "packages/configuration", "packages/located-error", "packages/primitives", "packages/test-helpers"]
members = ["contrib/bencode", "packages/configuration", "packages/located-error", "packages/primitives", "packages/test-helpers", "packages/torrent-repository-benchmarks"]

[profile.dev]
debug = 1
Expand Down
4 changes: 2 additions & 2 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
# Torrust Tracker

## Builder Image
FROM rust:bookworm as chef
FROM rustlang/rust:nightly-bookworm as chef
WORKDIR /tmp
RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
RUN cargo binstall --no-confirm cargo-chef cargo-nextest

## Tester Image
FROM rust:slim-bookworm as tester
FROM rustlang/rust:nightly-bookworm-slim as tester
WORKDIR /tmp

RUN apt-get update; apt-get install -y curl sqlite3; apt-get autoclean
Expand Down
21 changes: 21 additions & 0 deletions packages/torrent-repository-benchmarks/Cargo.toml
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 = "../../" }
15 changes: 15 additions & 0 deletions packages/torrent-repository-benchmarks/src/args.rs
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)]

Check warning on line 4 in packages/torrent-repository-benchmarks/src/args.rs

View check run for this annotation

Codecov / codecov/patch

packages/torrent-repository-benchmarks/src/args.rs#L3-L4

Added lines #L3 - L4 were not covered by tests
pub struct Args {
/// Amount of benchmark worker threads

Check warning on line 6 in packages/torrent-repository-benchmarks/src/args.rs

View check run for this annotation

Codecov / codecov/patch

packages/torrent-repository-benchmarks/src/args.rs#L6

Added line #L6 was not covered by tests
#[arg(short, long)]
pub threads: usize,
/// Amount of time in ns a thread will sleep to simulate a client response after handling a task

Check warning on line 9 in packages/torrent-repository-benchmarks/src/args.rs

View check run for this annotation

Codecov / codecov/patch

packages/torrent-repository-benchmarks/src/args.rs#L8-L9

Added lines #L8 - L9 were not covered by tests
#[arg(short, long)]
pub sleep: Option<u64>,
/// Compare with old implementations of the torrent repository

Check warning on line 12 in packages/torrent-repository-benchmarks/src/args.rs

View check run for this annotation

Codecov / codecov/patch

packages/torrent-repository-benchmarks/src/args.rs#L11-L12

Added lines #L11 - L12 were not covered by tests
#[arg(short, long)]
pub compare: Option<bool>,

Check warning on line 14 in packages/torrent-repository-benchmarks/src/args.rs

View check run for this annotation

Codecov / codecov/patch

packages/torrent-repository-benchmarks/src/args.rs#L14

Added line #L14 was not covered by tests
}
Loading
Loading