-
Notifications
You must be signed in to change notification settings - Fork 841
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
YARP has a higher cpu usage than Nginx #2427
Comments
How does the load / RPS compare? |
Hi @MihaZupan , any news? |
Is it related to the dotnet/runtime#70098 |
@MihaZupan hi,is there any news? |
The performance gap is so obvious, is there any room for improvement? |
Is there any news about this issue?
|
Later we made some adjustments to the configuration <PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<GarbageCollectionAdaptationMode>0</GarbageCollectionAdaptationMode>
</PropertyGroup> Environment variables DOTNET_ThreadPool_UnfairSemaphoreSpinLimit=0 After turning off spin, the CPU performance increased by nearly 40%, which is indeed a big improvement. However, according to the data, it will affect qps. However, we have not yet added link monitoring, so the impact on qps is not yet known. From the perspective of upstream requests, the average response time is not greatly affected. However, compared with nginx, yarp still has a lot of room for improvement. We hope to use it instead of other reverse proxy products. |
@Tratcher @MihaZupan |
We are also choosing between nginx and yarp. As. net developers, we prefer to use yarp. Has there been any progress on this issue? |
We do not see such huge differences in our perf lab between YARP and NGINX. The ratio is currently about 2:3 I believe. @MihaZupan can link our public perf dashboard. |
Only in the sense that this PR is improving HttpClient (and therefore also YARP) performance.
This is a surprisingly high number of threads to see on a 4-core machine if everything is fully
Settings like these seem excessive for the machine size and are more likely to hurt performance than improve it. I'd recommend removing them unless you have real evidence that they're improving things.
How come you're disabling this? I was under the impression that you were worried about the memory footprint (#2527) after load spikes without this functionality.
How did you arrive at the 40 number?
While this may reduce the CPU usage reported for a process, it may negatively impact throughput while under load. There may be other factors impacting the performance between Nginx and YARP. Are both proxies using the same HTTP protocol version? Both between client-proxy and proxy-backend (e.g. YARP will default to HTTP/2 if the backend supports it)? |
Glad to receive your reply. After confirmation with the business side, we got the ratio of 3:11, close to 1:4. Currently, no special optimization has been done on nginx. Only two operations have been done on yarp.
Our scenario is that the response is longer and the current_request execution is higher. |
nginx
yarp
|
Why are you forcing connections from the client to the proxy to never be reused? |
Thank you very much, It has been too long. We are unable to track down why the two configurations were added. We need some time to conduct verification tests. |
After adjusting the configuration, the ratio between nginx and yarp is about 1:2.5. The |
Sorry, I don't know if it is a bug.
Describe the bug
I deployed 3 nginx at HongKong, and deployed 3 YARP at HangZhou.
Nginx forwards some services, and YARP forward one of them.
Nginx CPU
YARP CPU
YARP other metrics
Htop (Cat.Service.dll is based on YARP)
I tried to analyze the CPU on vs
Top function
Module View
To Reproduce
No exception.
Further technical details
2.1.0
Linux
They're all 4c8g, YARP on ubuntu 22.04, nginx on centos.
YARP 2.1.0 runs on .NET 8.
The text was updated successfully, but these errors were encountered: