actix / actix/actix-web

[Windows] Web Client is unreasonably slow

未关闭
#2,256 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Rust
星标
24.8k
派生
1.9k
平均合并
23 小时 10 分钟
30 天内合并 PR
26

描述

Reproduce snippet:
```rust
#[actix_web::main]
async fn main() -> std::io::Result<()> {
let sys_time = std::time::SystemTime::now();
let start_time = sys_time.elapsed().unwrap();

let client = actix_web::client::Client::builder()
.connector(actix_web::client::Connector::new()
.timeout(Duration::from_secs(35))
.finish())
.timeout(Duration::from_secs(35))
.finish();

let response = client.get("https://google.com")
.send()
.await
.unwrap()
.body()
.await
.unwrap();
let end_time = sys_time.elapsed().unwrap();
let secs = end_time - start_time;
println!("{}", secs.as_secs());
return Ok(());
}
```

This code prints "20" on Windows, i.e. get request to Google takes 20 seconds.

Same code on Linux (WSL2) takes 0 seconds.

I don't have any clues what might be wrong, but perhaps it's related to DNS resolution?

`Cargo.toml`:
```toml
// ...

[dependencies]
actix-web = { version = "3", features = ["rustls"] }
```

贡献指南

打开贡献指南

调研方向

Start with the Rust client code in the reproduction and the actix-web version 3 dependency in Cargo.toml. Run the snippet on Windows and Linux/WSL2, then investigate the request path and DNS-resolution hypothesis. Done means the same Google request no longer takes about 20 seconds on Windows and the behavior is covered by an appropriate regression test.

由索引模型根据 Issue 内容生成。

评估

技术栈
rust
领域
networking
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。