Skip to content

Commit 1c3638e

Browse files
authored
[Rust] Bump ohkami to v0.21 and Add various tests (#9567)
* bump ohkami & add various tests * fix dockerfiles * fix dockerfiles * fix cfg * fix dockerfiles * fix around db cfg * fix test names * remove conflict debris
1 parent 51a63ae commit 1c3638e

31 files changed

+6264
-491
lines changed

frameworks/Rust/ohkami/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/target
1+
**/target

frameworks/Rust/ohkami/Cargo.toml

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
[package]
2-
name = "ohkami_framework_benchmarks"
3-
version = "0.20.0"
2+
name = "framework_benchmarks"
3+
version = "0.21.0"
44
edition = "2021"
55
authors = ["kanarus <[email protected]>"]
66

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

15-
[profile.release]
16-
opt-level = 3
17-
debug = false
18-
debug-assertions = false
19-
lto = true
20-
panic = "abort"
21-
incremental = false
22-
codegen-units = 1
23-
rpath = false
24-
strip = false
14+
[features]
15+
db = ["yarte", "futures-util", "rand", "sqlx"]
16+
rt_tokio = ["ohkami/rt_tokio", "db", "sqlx/runtime-tokio"]
17+
rt_async-std = ["ohkami/rt_async-std", "db", "sqlx/runtime-async-std"]
18+
rt_smol = ["ohkami/rt_smol"]
19+
rt_glommio = ["ohkami/rt_glommio"]
20+
rt_nio = ["ohkami/rt_nio"]

frameworks/Rust/ohkami/benchmark_config.json

Lines changed: 86 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,106 @@
33
"tests": [
44
{
55
"default": {
6+
"dockerfile": "rt_tokio.dockerfile",
7+
"display_name": "Ohkami [tokio]",
8+
"framework": "Ohkami",
9+
"webserver": "Ohkami",
10+
"language": "Rust",
11+
"approach": "Realistic",
12+
"classification": "Micro",
13+
"database": "Postgres",
14+
"orm": "Raw",
15+
"platform": "None",
16+
"os": "Linux",
17+
"database_os": "Linux",
18+
"port": 8000,
19+
"json_url": "/json",
20+
"db_url": "/db",
21+
"query_url": "/queries?q=",
22+
"fortune_url": "/fortunes",
23+
"update_url": "/updates?q=",
24+
"plaintext_url": "/plaintext"
25+
}
26+
},
27+
{
28+
"rt_async-std": {
29+
"dockerfile": "rt_async-std.dockerfile",
30+
"display_name": "Ohkami [async-std]",
31+
"framework": "Ohkami",
32+
"webserver": "Ohkami",
33+
"language": "Rust",
34+
"approach": "Realistic",
35+
"classification": "Micro",
36+
"database": "Postgres",
37+
"orm": "Raw",
38+
"platform": "None",
39+
"os": "Linux",
40+
"database_os": "Linux",
41+
"port": 8000,
642
"json_url": "/json",
743
"db_url": "/db",
844
"query_url": "/queries?q=",
945
"fortune_url": "/fortunes",
1046
"update_url": "/updates?q=",
11-
"plaintext_url": "/plaintext",
47+
"plaintext_url": "/plaintext"
48+
}
49+
},
50+
{
51+
"rt_smol": {
52+
"dockerfile": "rt_smol.dockerfile",
53+
"display_name": "Ohkami [smol]",
54+
"framework": "Ohkami",
55+
"webserver": "Ohkami",
56+
"language": "Rust",
57+
"approach": "Realistic",
58+
"classification": "Micro",
59+
"database": "Postgres",
60+
"orm": "Raw",
61+
"platform": "None",
62+
"os": "Linux",
63+
"database_os": "Linux",
1264
"port": 8000,
65+
"json_url": "/json",
66+
"plaintext_url": "/plaintext"
67+
}
68+
},
69+
{
70+
"rt_glommio": {
71+
"dockerfile": "rt_glommio.dockerfile",
72+
"display_name": "Ohkami [glommio]",
73+
"framework": "Ohkami",
74+
"webserver": "Ohkami",
75+
"language": "Rust",
1376
"approach": "Realistic",
1477
"classification": "Micro",
1578
"database": "Postgres",
16-
"framework": "ohkami",
79+
"orm": "Raw",
80+
"platform": "None",
81+
"os": "Linux",
82+
"database_os": "Linux",
83+
"port": 8000,
84+
"json_url": "/json",
85+
"plaintext_url": "/plaintext"
86+
}
87+
},
88+
{
89+
"rt_nio": {
90+
"dockerfile": "rt_nio.dockerfile",
91+
"display_name": "Ohkami [nio]",
92+
"framework": "Ohkami",
93+
"webserver": "Ohkami",
1794
"language": "Rust",
95+
"approach": "Realistic",
96+
"classification": "Micro",
97+
"database": "Postgres",
1898
"orm": "Raw",
1999
"platform": "None",
20-
"webserver": "ohkami",
21100
"os": "Linux",
22101
"database_os": "Linux",
23-
"display_name": "ohkami",
24-
"notes": "",
25-
"versus": "None"
102+
"port": 8000,
103+
"json_url": "/json",
104+
"plaintext_url": "/plaintext"
26105
}
27106
}
28107
]
29-
}
108+
}

frameworks/Rust/ohkami/config.toml

Lines changed: 0 additions & 19 deletions
This file was deleted.

frameworks/Rust/ohkami/ohkami.dockerfile

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM rust:1.84-slim-bookworm AS builder
2+
3+
RUN apt update && apt install -y --no-install-recommends \
4+
pkg-config \
5+
libpq-dev libssl-dev \
6+
&& rm -rf /var/lib/apt/lists/*
7+
8+
COPY ./Cargo.toml /build/
9+
COPY ./src/ /build/src/
10+
COPY ./rt_async-std/ /build/rt_async-std/
11+
12+
WORKDIR /build/rt_async-std
13+
ENV RUSTFLAGS="-C target-cpu=native"
14+
RUN cargo build --release
15+
16+
##########################################################
17+
18+
FROM gcr.io/distroless/cc-debian12
19+
20+
COPY --from=builder /build/rt_async-std/target/release/framework_benchmarks-async-std /app/
21+
22+
EXPOSE 8000
23+
ENV DATABASE_URL=postgres://benchmarkdbuser:benchmarkdbpass@tfb-database/hello_world
24+
ENV MAX_CONNECTIONS=56
25+
ENV MIN_CONNECTIONS=56
26+
CMD [ "/app/framework_benchmarks-async-std" ]

0 commit comments

Comments
 (0)