-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: don't reuse connection when it closed (#443)
* add benchmark * feat: don't reuse connection when it closed
- Loading branch information
Showing
33 changed files
with
1,336 additions
and
81 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.vscode | ||
.idea | ||
target | ||
/test | ||
/test | ||
/benchmark/output |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
[package] | ||
name = "benchmark" | ||
version = "0.0.0" | ||
edition.workspace = true | ||
homepage.workspace = true | ||
repository.workspace = true | ||
license.workspace = true | ||
authors.workspace = true | ||
publish = false | ||
|
||
[[bin]] | ||
name = "bench-client" | ||
path = "src/bin/client.rs" | ||
[[bin]] | ||
name = "bench-server" | ||
path = "src/bin/server.rs" | ||
|
||
[dependencies] | ||
anyhow.workspace = true | ||
bytes.workspace = true | ||
chrono.workspace = true | ||
clap = { workspace = true, features = ["derive"] } | ||
faststr.workspace = true | ||
governor.workspace = true | ||
lazy_static.workspace = true | ||
metainfo.workspace = true | ||
motore.workspace = true | ||
serde.workspace = true | ||
sysinfo.workspace = true | ||
tokio = { workspace = true, features = ["full"] } | ||
tokio-util.workspace = true | ||
tracing.workspace = true | ||
tracing-subscriber.workspace = true | ||
pilota.workspace = true | ||
volo = { path = "../volo" } | ||
volo-thrift = { path = "../volo-thrift", features = ["multiplex"] } | ||
|
||
[build-dependencies] | ||
volo-build = { path = "../volo-build" } |
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,9 @@ | ||
use std::path::PathBuf; | ||
|
||
fn main() { | ||
volo_build::Builder::thrift() | ||
.add_service("idl/echo.thrift") | ||
.filename(PathBuf::from("benchmark.rs")) | ||
.write() | ||
.unwrap() | ||
} |
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,46 @@ | ||
namespace rs echo | ||
|
||
struct Request { | ||
1: required string action, | ||
2: required string msg, | ||
} | ||
|
||
struct Response { | ||
1: required string action, | ||
2: required string msg, | ||
} | ||
|
||
struct SubMessage { | ||
1: optional i64 id; | ||
2: optional string value; | ||
} | ||
struct Message { | ||
1: optional i64 id; | ||
2: optional string value; | ||
3: optional list<SubMessage> subMessages; | ||
} | ||
|
||
// 复杂参数 | ||
struct ObjReq { | ||
1: required string action(api.path = 'action') | ||
2: required string msg(api.header = 'msg') | ||
3: required map<string, SubMessage> msgMap(api.body = 'msgMap') | ||
4: required list<SubMessage> subMsgs(api.body = 'subMsgs') | ||
5: optional set<Message> msgSet(api.body = 'msgSet') | ||
6: required Message flagMsg(api.body = 'flagMsg') | ||
7: optional string mockCost, | ||
} | ||
|
||
struct ObjResp { | ||
1: required string action(api.header = 'action') | ||
2: required string msg(api.header = 'msg') | ||
3: required map<string, SubMessage> msgMap(api.body = 'msgMap') | ||
4: required list<SubMessage> subMsgs(api.body = 'subMsgs') | ||
5: optional set<Message> msgSet(api.body = 'msgSet') | ||
6: required Message flagMsg(api.body = 'flagMsg') | ||
} | ||
|
||
service EchoServer { | ||
Response Echo(1: Request req) | ||
ObjResp TestObj(1: ObjReq req)(api.post = '/test/obj/:action', api.baseurl = 'example.com', api.param = 'true', api.serializer = 'json') | ||
} |
Oops, something went wrong.