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

[Rust] Bump ohkami to v0.21 and Add various tests #9567

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
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 frameworks/Rust/ohkami/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/target
**/target
32 changes: 14 additions & 18 deletions frameworks/Rust/ohkami/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
[package]
name = "ohkami_framework_benchmarks"
version = "0.20.0"
name = "framework_benchmarks"
version = "0.21.0"
edition = "2021"
authors = ["kanarus <[email protected]>"]

[dependencies]
ohkami = { version = "=0.20.0", features = ["rt_tokio"] }
tokio = { version = "1.40.0" , features = ["full"] }
rand = { version = "0.8.5" , features = ["small_rng"] }
sqlx = { version = "0.8.1" , features = ["postgres", "macros", "runtime-tokio-native-tls"] }
yarte = { version = "0.15.7" }
futures-util = { version = "0.3.30" }
ohkami = { version = "0.21" }
yarte = { optional = true, version = "0.15" }
futures-util = { optional = true, version = "0.3" }
rand = { optional = true, version = "0.8", features = ["small_rng"] }
sqlx = { optional = true, version = "0.8", features = ["postgres", "tls-native-tls"] }

[profile.release]
opt-level = 3
debug = false
debug-assertions = false
lto = true
panic = "abort"
incremental = false
codegen-units = 1
rpath = false
strip = false
[features]
db = ["yarte", "futures-util", "rand", "sqlx"]
rt_tokio = ["ohkami/rt_tokio", "db", "sqlx/runtime-tokio"]
rt_async-std = ["ohkami/rt_async-std", "db", "sqlx/runtime-async-std"]
rt_smol = ["ohkami/rt_smol"]
rt_glommio = ["ohkami/rt_glommio"]
rt_nio = ["ohkami/rt_nio"]
93 changes: 86 additions & 7 deletions frameworks/Rust/ohkami/benchmark_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,106 @@
"tests": [
{
"default": {
"dockerfile": "rt_tokio.dockerfile",
"display_name": "Ohkami [tokio]",
"framework": "Ohkami",
"webserver": "Ohkami",
"language": "Rust",
"approach": "Realistic",
"classification": "Micro",
"database": "Postgres",
"orm": "Raw",
"platform": "None",
"os": "Linux",
"database_os": "Linux",
"port": 8000,
"json_url": "/json",
"db_url": "/db",
"query_url": "/queries?q=",
"fortune_url": "/fortunes",
"update_url": "/updates?q=",
"plaintext_url": "/plaintext"
}
},
{
"rt_async-std": {
"dockerfile": "rt_async-std.dockerfile",
"display_name": "Ohkami [async-std]",
"framework": "Ohkami",
"webserver": "Ohkami",
"language": "Rust",
"approach": "Realistic",
"classification": "Micro",
"database": "Postgres",
"orm": "Raw",
"platform": "None",
"os": "Linux",
"database_os": "Linux",
"port": 8000,
"json_url": "/json",
"db_url": "/db",
"query_url": "/queries?q=",
"fortune_url": "/fortunes",
"update_url": "/updates?q=",
"plaintext_url": "/plaintext",
"plaintext_url": "/plaintext"
}
},
{
"rt_smol": {
"dockerfile": "rt_smol.dockerfile",
"display_name": "Ohkami [smol]",
"framework": "Ohkami",
"webserver": "Ohkami",
"language": "Rust",
"approach": "Realistic",
"classification": "Micro",
"database": "Postgres",
"orm": "Raw",
"platform": "None",
"os": "Linux",
"database_os": "Linux",
"port": 8000,
"json_url": "/json",
"plaintext_url": "/plaintext"
}
},
{
"rt_glommio": {
"dockerfile": "rt_glommio.dockerfile",
"display_name": "Ohkami [glommio]",
"framework": "Ohkami",
"webserver": "Ohkami",
"language": "Rust",
"approach": "Realistic",
"classification": "Micro",
"database": "Postgres",
"framework": "ohkami",
"orm": "Raw",
"platform": "None",
"os": "Linux",
"database_os": "Linux",
"port": 8000,
"json_url": "/json",
"plaintext_url": "/plaintext"
}
},
{
"rt_nio": {
"dockerfile": "rt_nio.dockerfile",
"display_name": "Ohkami [nio]",
"framework": "Ohkami",
"webserver": "Ohkami",
"language": "Rust",
"approach": "Realistic",
"classification": "Micro",
"database": "Postgres",
"orm": "Raw",
"platform": "None",
"webserver": "ohkami",
"os": "Linux",
"database_os": "Linux",
"display_name": "ohkami",
"notes": "",
"versus": "None"
"port": 8000,
"json_url": "/json",
"plaintext_url": "/plaintext"
}
}
]
}
}
19 changes: 0 additions & 19 deletions frameworks/Rust/ohkami/config.toml

This file was deleted.

18 changes: 0 additions & 18 deletions frameworks/Rust/ohkami/ohkami.dockerfile

This file was deleted.

26 changes: 26 additions & 0 deletions frameworks/Rust/ohkami/rt_async-std.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM rust:1.84-slim-bookworm AS builder

RUN apt update && apt install -y --no-install-recommends \
pkg-config \
libpq-dev libssl-dev \
&& rm -rf /var/lib/apt/lists/*

COPY ./Cargo.toml /build/
COPY ./src/ /build/src/
COPY ./rt_async-std/ /build/rt_async-std/

WORKDIR /build/rt_async-std
ENV RUSTFLAGS="-C target-cpu=native"
RUN cargo build --release

##########################################################

FROM gcr.io/distroless/cc-debian12

COPY --from=builder /build/rt_async-std/target/release/framework_benchmarks-async-std /app/

EXPOSE 8000
ENV DATABASE_URL=postgres://benchmarkdbuser:benchmarkdbpass@tfb-database/hello_world
ENV MAX_CONNECTIONS=56
ENV MIN_CONNECTIONS=56
CMD [ "/app/framework_benchmarks-async-std" ]
Loading
Loading