runtime icon indicating copy to clipboard operation
runtime copied to clipboard

IOptionsSnapshot Results in High CPU 100% at 1500 RPS with 15 Node Cluster (8core per vm 32GB Memory)

Open justConfused opened this issue 6 years ago • 5 comments

If you believe you have an issue that affects the security of the platform please do NOT create an issue and instead email your issue details to [email protected]. Your report may be eligible for our bug bounty but ONLY if it is reported through email.

Describe the bug

IOptionsSnapshot Results in High CPU 100% at 1500 RPS with 15 Node Cluster (8core per vm 32GB Memory). HTTP.Sys Asp Net core 2.1

It looks like Wait on GC is blocking for some mutex as captured traces from azure profile show. Image below.

To Reproduce

Steps to reproduce the behavior: 1.) Start Azure Vm StandardDv2_v8 2.) 100 RPS 3.) HTTP.SYS(AspNetCore): Add IOptionsSnapshot as scoped depend so it created on ever request 4.) CPU should 100

Expected behavior

High CPU

Screenshots

image

justConfused avatar Aug 13 '20 05:08 justConfused

IOptionsSnapshot<T> might be a performance trap indeed since binding isn't currently cached and runs per request:

cc @HaoK @Pilchie for 3.x cc @ericstj @maryamariyan

This is something we might want to address in 5.0 or 6.0 and backport to 3.1.

davidfowl avatar Aug 13 '20 05:08 davidfowl

We don't use options snapshot anywhere by default right? But yeah config binding every request is going to be extremely slow

HaoK avatar Aug 13 '20 07:08 HaoK

Tagging subscribers to this area: @maryamariyan See info in area-owners.md if you want to be subscribed.

ghost avatar Sep 14 '20 21:09 ghost

This is something we might want to address in 5.0 or 6.0

6.0 😄

BrennanConroy avatar Sep 14 '20 21:09 BrennanConroy

@maryamariyan we should close as dupe of https://github.com/dotnet/runtime/issues/36130

davidfowl avatar Oct 02 '20 18:10 davidfowl