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

[ntex] replace async-std with compio runtime #9222

Merged
merged 3 commits into from
Aug 26, 2024
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
21 changes: 14 additions & 7 deletions frameworks/Rust/ntex/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "ntex"
name = "ntex-bench"
version = "2.0.0"
edition = "2018"

Expand All @@ -8,23 +8,23 @@ name = "ntex"
path = "src/main.rs"

[[bin]]
name = "ntex-astd"
name = "ntex-compio"
path = "src/main.rs"

[[bin]]
name = "ntex-db"
path = "src/main_db.rs"

[[bin]]
name = "ntex-db-astd"
name = "ntex-db-compio"
path = "src/main_db.rs"

[[bin]]
name = "ntex-plt"
path = "src/main_plt.rs"

[[bin]]
name = "ntex-plt-astd"
name = "ntex-plt-compio"
path = "src/main_plt.rs"

[features]
Expand All @@ -33,11 +33,11 @@ default = []
# tokio runtime
tokio = ["ntex/tokio"]

# async-std runtime
async-std = ["ntex/async-std"]
# compio runtime
compio = ["ntex/compio"]

[dependencies]
ntex = "=2.1.0"
ntex = "2.4"
ntex-bytes = { version = "0.1.21", features=["simd"] }
mimalloc = { version = "0.1.25", default-features = false }
snmalloc-rs = { version = "0.3.3", features = ["native-cpu"] }
Expand All @@ -63,3 +63,10 @@ lto = "thin"
debug = false
incremental = false
overflow-checks = false

[patch.crates-io]
ntex = { git = "https://github.com/ntex-rs/ntex.git", branch = "compio" }
ntex-io = { git = "https://github.com/ntex-rs/ntex.git", branch = "compio" }
ntex-rt = { git = "https://github.com/ntex-rs/ntex.git", branch = "compio" }
ntex-net = { git = "https://github.com/ntex-rs/ntex.git", branch = "compio" }
ntex-compio = { git = "https://github.com/ntex-rs/ntex.git", branch = "compio" }
12 changes: 6 additions & 6 deletions frameworks/Rust/ntex/benchmark_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"notes": "",
"versus": ""
},
"astd": {
"compio": {
"json_url": "/json",
"plaintext_url": "/plaintext",
"port": 8080,
Expand All @@ -33,7 +33,7 @@
"webserver": "ntex",
"os": "Linux",
"database_os": "Linux",
"display_name": "ntex [async-std]",
"display_name": "ntex [compio]",
"notes": "",
"versus": ""
},
Expand All @@ -57,7 +57,7 @@
"notes": "",
"versus": ""
},
"db-astd": {
"db-compio": {
"fortune_url": "/fortunes",
"db_url": "/db",
"query_url": "/query?q=",
Expand All @@ -73,7 +73,7 @@
"webserver": "ntex",
"os": "Linux",
"database_os": "Linux",
"display_name": "ntex [async-std,db]",
"display_name": "ntex [compio,db]",
"notes": "",
"versus": ""
},
Expand All @@ -95,7 +95,7 @@
"notes": "",
"versus": ""
},
"plt-astd": {
"plt-compio": {
"json_url": "/json",
"plaintext_url": "/plaintext",
"port": 8080,
Expand All @@ -109,7 +109,7 @@
"webserver": "ntex",
"os": "Linux",
"database_os": "Linux",
"display_name": "ntex [async-std,platform]",
"display_name": "ntex [compio,platform]",
"notes": "",
"versus": ""
}
Expand Down
6 changes: 3 additions & 3 deletions frameworks/Rust/ntex/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ platform = "None"
webserver = "ntex"
versus = ""

[astd]
[compio]
urls.plaintext = "/plaintext"
urls.json = "/json"
approach = "Realistic"
Expand Down Expand Up @@ -42,7 +42,7 @@ platform = "None"
webserver = "ntex"
versus = ""

[db-astd]
[db-compio]
urls.db = "/db"
urls.query = "/query?q="
urls.update = "/update?q="
Expand Down Expand Up @@ -70,7 +70,7 @@ platform = "None"
webserver = "ntex"
versus = ""

[plt-astd]
[plt-compio]
urls.plaintext = "/plaintext"
urls.json = "/json"
approach = "Realistic"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ ADD ./ /ntex
WORKDIR /ntex

RUN cargo clean
RUN RUSTFLAGS="-C target-cpu=native" cargo build --release --features="async-std"
RUN RUSTFLAGS="-C target-cpu=native" cargo build --release --features="compio"

EXPOSE 8080

CMD ./target/release/ntex-astd
CMD ./target/release/ntex-compio
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ ADD ./ /ntex
WORKDIR /ntex

RUN cargo clean
RUN RUSTFLAGS="-C target-cpu=native" cargo build --release --features="async-std"
RUN RUSTFLAGS="-C target-cpu=native" cargo build --release --features="compio"

EXPOSE 8080

CMD ./target/release/ntex-db-astd
CMD ./target/release/ntex-db-compio
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ ADD ./ /ntex
WORKDIR /ntex

RUN cargo clean
RUN RUSTFLAGS="-C target-cpu=native" cargo build --release --features="async-std"
RUN RUSTFLAGS="-C target-cpu=native" cargo build --release --features="compio"

EXPOSE 8080

CMD ./target/release/ntex-plt-astd
CMD ./target/release/ntex-plt-compio
1 change: 0 additions & 1 deletion frameworks/Rust/ntex/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
// static GLOBAL: snmalloc_rs::SnMalloc = snmalloc_rs::SnMalloc;

use ntex::http::header::{CONTENT_TYPE, SERVER};
use ntex::{http, time::Seconds, util::BytesMut, util::PoolId, web};
Expand Down
2 changes: 1 addition & 1 deletion frameworks/Rust/ntex/src/main_plt.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[global_allocator]
static GLOBAL: snmalloc_rs::SnMalloc = snmalloc_rs::SnMalloc;
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;

use std::{future::Future, io, pin::Pin, task::Context, task::Poll};

Expand Down
Loading