Skip to content
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

Open
doddgu opened this issue Mar 4, 2024 · 6 comments
Open

YARP has a higher cpu usage than Nginx #2427

doddgu opened this issue Mar 4, 2024 · 6 comments
Assignees
Labels
Type: Bug Something isn't working
Milestone

Comments

@doddgu
Copy link

doddgu commented Mar 4, 2024

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.

Client -> Nginx -> Yarp -> Service

Nginx forwards some services, and YARP forward one of them.

Nginx CPU
image

YARP CPU
image

YARP other metrics
image

Htop (Cat.Service.dll is based on YARP)
image

I tried to analyze the CPU on vs
Top function
image

Module View
image

To Reproduce

No exception.

Further technical details

  • Include the version of the packages you are using
    2.1.0
  • The platform (Linux/macOS/Windows)
    Linux

They're all 4c8g, YARP on ubuntu 22.04, nginx on centos.
YARP 2.1.0 runs on .NET 8.

@doddgu doddgu added the Type: Bug Something isn't working label Mar 4, 2024
@Tratcher
Copy link
Member

Tratcher commented Mar 4, 2024

How does the load / RPS compare?

@doddgu
Copy link
Author

doddgu commented Mar 5, 2024

How does the load / RPS compare?

Every YARP is almost 4000
image

@doddgu doddgu changed the title Yapr has a higher cpu usage than Nginx Yarp has a higher cpu usage than Nginx Mar 5, 2024
@doddgu doddgu changed the title Yarp has a higher cpu usage than Nginx YARP has a higher cpu usage than Nginx Mar 5, 2024
@doddgu
Copy link
Author

doddgu commented Mar 5, 2024

I loaded pdb.
I find that the Thread in WorkerThreadStart method. The Thread.CurrentThread.SetThreadPoolWorkerThreadName() takes up a lot of CPU resources.

I don't know why have to call WorkerThreadStart so many times.

image

image

image

@doddgu
Copy link
Author

doddgu commented Mar 6, 2024

I used YARP source code analysis, I found that YARP itself does not have high cpu usage.

image

@doddgu
Copy link
Author

doddgu commented Mar 8, 2024

Hi @MihaZupan , any news?

@doddgu
Copy link
Author

doddgu commented Mar 11, 2024

Is it related to the dotnet/runtime#70098
And I see there's pr to fix it

@MihaZupan MihaZupan added this to the Backlog milestone Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants