actix / actix/actix-web

Unreasonable increase in latency between localhost and remote

未關閉
#3,484 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
needs-investigation
主要語言
Rust
星號
24.8k
分支
1.9k
平均合併
23 小時 10 分鐘
30 天內合併 PR
26

描述

I'm benchmarking my web server code for JSON deserialization against Golang. Code can be found at https://github.com/yourarj/rust-vs-go-performance-benchmark

We benchmarked the server response in TWO setups

1. localhost (server and K6 on same server)
2. remote (server and K6 are on independent machines)

Note : for both go and rust same setup has been used for localhost and remote cases.

## Expected Behavior

When we move our K6 from localhost setup to remote setup go and rust should see the same network overhead.

## Current Behavior

![image](https://github.com/user-attachments/assets/b832ab25-df01-4947-846e-a72042ed1e48)

E.g. If we consider **http_req_waiting** for go the average request overhead is _151.3678_ but in case of actix-web overhead is whopping _471.5906_.

## Possible Solution

Tried to play with worker count, backlog values, connection timeouts. It didn't workout. So no clear idea.

## Steps to Reproduce (for bugs)

1. checkout code from https://github.com/yourarj/rust-vs-go-performance-benchmark
3. build docker images for rust and go from respective folder
4. create deployments in K8S with deployment and service file in k8s folder
5. benchmark with K6 with given scirpt.js file in test folder (k6 run script.js)

## Context

We are working on adoption of rust for web on massive scale. If we can mitigate this issue that would be great selling point for rust.
Why I see this as huge potential is if Rust can beat go on localhost by 4x (8k rps vs 45k rps) if we can replicate same over network, It would mean heavens for dev and product owner in terms of performance and cost.

## Your Environment

Testing environment for both.

MicroK8S Kubernetes cluster.
8cpu, 16gb, single pod exposed via node port.

Rust : version: 1.80.1, actix-web: 4.9, serde 1.0
Go: version 1.23

Load testing: Grafana K6 (vu : 10,000 (test/script.js)

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。