Open jinzaz opened 2 weeks ago
Was the memory dump screenshot you shared taken after all the requests already completed?
Also just in case, can you share how you're using YARP (e.g. config file) / whether and how you're using the IHttpForwarder
directly.
yeah this dump was after all the requests already completed!,this is my YARP config
"ReverseProxy": {
"Routes": {
"basic-apiservice": {
"Match": {
"Methods": null,
"Hosts": null,
"Path": "/xxx/xxxx/{**catch-all}",
"QueryParameters": null,
"Headers": null
},
"ClusterId": "basic-apiservice",
"AuthorizationPolicy": null,
"RateLimiterPolicy": null,
"Timeout": "00:00:20",
"CorsPolicy": null,
"Metadata": null,
"Transforms": [
{
"PathRemovePrefix": "/xxxx/xxxx"
}
]
}
},
"Clusters": {
"basic-apiservice": {
"LoadBalancingPolicy": null,
"SessionAffinity": null,
"HealthCheck": null,
"HttpClient": {
"EnableMultipleHttp2Connections": true
},
"HttpRequest": {
"AllowResponseBuffering": "false"
},
"Destinations": {
"basic-apiservice/destination1": {
"Address": "http://xxxx",
"Health": "http://xxxxxx",
"Metadata": null,
"Host": null
}
},
"Metadata": null
}
}
}
I seem to have found a solution, I seem to have found the cause of the problem, partly due to the PinnedBlockMemoryPool
in aspnetcore when the container memory is not restricted. This is similar to this problem ,https://github.com/dotnet/aspnetcore/issues/24958
and partly due to the low execution frequency of GC Server Mode in GC mode,But now I'm solving it by using GarbageCollectionAdaptationMode
But I found that YARP's CPU usage is very high, and I'm not sure if this is normal, or can you recommend optimization methods
Describe the bug
When I created an empty Web API Project and only added the reverse proxy service, and then used JMeter for load testing, I found a surge in memory. Below was the stack information monitored using
dotnet dump
anddotnet counters
. I suspected that Jeeter was usingkeep-alive
, but I added the appUseRequestTimeouts();
There will still be these phenomena, and I don't know what causes themFurther technical details