Comments (8)
Thanks @vaind. I will try to reproduce it on some minimum functionality branch - maybe will be able to catch it ...
from sentry-dotnet.
cc @vaind
Could we have some details about what the app is doing? With a repro we can look exactly what's going on and make improvements but with the currently provided information it's hard for us to figure out where the problem is.
Is this a web server? How many requests in parallel are running?
If this has high thrughput, changing sample rate to:
options.TracesSampleRate = 0.001;
options.ProfilesSampleRate = 0.001;
Does that reduce the CPU overhead considerably?
from sentry-dotnet.
@bruno-garcia I tried to put sample rates to 0.001 and there is still quite a significant spike (from 7 % CPU -> 40 % CPU)
In fact, it was about the same as with sampling rate 1.0, which is weird...
The behaviour is, it first jumps to 60% and then stabilises at 40%.
It is a web server, but in sandbox environment, and we are running 20 workers in parallel
I have mentioned before that we are using hang fire to queue background jobs and I have noticed call like that: Sentry.AspNetCore.SentryTracingMiddleware.InvokeAsync(HttpContext context). But when it is a hangfire background job HttpContext will be null, so that might somehow explain what is going on
from sentry-dotnet.
I tried to put sample rates to 0.001 and there is still quite a significant spike (from 7 % CPU -> 40 % CPU)
In fact, it was about the same as with sampling rate 1.0, which is weird...
This didn't come up during our tests so I'm a bit surprised but I wonder if it might be the overhead of the .NET profiler itself which unfortunately has a high frequency and we down sample after the fact.
I have mentioned before that we are using hang fire to queue background jobs and I have noticed call like that: Sentry.AspNetCore.SentryTracingMiddleware.InvokeAsync(HttpContext context). But when it is a hangfire background job HttpContext will be null, so that might somehow explain what is going on
I wonder if this is to get the transaction
name automatically.
Do you get the overhead without Profiling turned on? Just keep transactions (TracesSampleRate
set to some value)
By any chance in the profiles in Sentry, do you see any frames from Sentry that seem to be taking significant part time?
from sentry-dotnet.
Thanks @bruno-garcia. Without profiling it works like a charm without any noticable overhead.
I could not find anything from Sentry taking a lot of time, in fact I couldn't see any sentry frames at all - which is weird, right, I should be able to see sentry-related process there...
from sentry-dotnet.
sorry for the delay here. any chance you can get a repro to help us debug this?
@vaind any ideas to further investigate?
from sentry-dotnet.
I've tried reproducing this locally with our aspnetcore sample and ab
but haven't seen any significant overhead from enabling profiling.
I've launched the example with dotnet run -c Release
with this branch and then tested various ab
confs. E.g. with ab -c 10 -n 1000
(10 concurrent requests, 1000 total request), the CPU usage I'm seeing on my PC be it with or without profiling is about 60 % and the average response time is 80 ms without profiling and about 82 ms with profiling 100 % transactions.
Some reproducable example would be of great help here. Or any more details on what is actually happening. Maybe you can run dotnet-trace
manually (with Sentry profiling disabled) and see if that has any effect on the CPU usage?
from sentry-dotnet.
I just ran into this issue also. Last night I installed the Sentry profiler. With profiling enabled at 0.2 with tracing at 0.2 my app which normally runs at 5-10% CPU was redlining at 100% to the point where HTTP requests were timing out and I was getting 502 gateway errors and health check alerts.
I disabled the profiler (keeping only tracing) and things returned to normal. There's definitely something up with the .NET Core profiler.
My app is a web app, .NET Core 8, hosted on Azure, uses standard MVC + some SignalR for live data feeds. Backed by MSSQL.
In the above image you can pinpoint where I deployed the profiler, and also where I just turned it off.
Here's my Sentry config:
// Sentry monitoring
builder.WebHost.UseSentry((ctx, sentryConfig) =>
{
sentryConfig.Dsn = "<REDACTED>";
// Don't need debug messages
sentryConfig.Debug = false;
// Set TracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring. We recommend adjusting this value in production
sentryConfig.TracesSampleRate = 0.2;
// Sample rate for profiling, applied on top of the TracesSampleRate e.g. 0.2 means we want to profile 20 % of the captured transactions. We recommend adjusting this value in production.
//sentryConfig.ProfilesSampleRate = 0.2;
// Note: By default, the profiler is initialized asynchronously. This can be tuned by passing a desired initialization timeout to the constructor.
//sentryConfig.AddIntegration(new ProfilingIntegration(
// During startup, wait up to 500ms to profile the app startup code. This could make launching the app a bit slower so comment it out if you prefer profiling to start asynchronously.
//TimeSpan.FromMilliseconds(500)
//));
});
from sentry-dotnet.
Related Issues (20)
- Sentry dotnet SDK is blowing away User.IpAddress if we set it explicitly and SendDefaultPii is true HOT 7
- Mobile: User.Other is included in managed errors but not native ones HOT 2
- No debug logs on MAUI when launching within Visual Studio HOT 3
- Support `UWP` via package
- Missing AddAttachment from memory in SentryHint HOT 1
- De-obfuscate stack traces with Babel Obfuscator HOT 3
- [MAUI] Make it possible to programmatically decide whether to attach a screenshot or not HOT 2
- Profiling: Error out in the editor if added to unsuported platform HOT 3
- Add SentrySdk.RunAsyncVoid helper method to Sentry SDK
- Memory Profiling HOT 1
- Unable to cast object of type 'Sentry.Log4Net.SentryAppender' to type 'log4net.Appender.IAppender' HOT 4
- OOTB metrics HOT 1
- Could not get pinvoke, or callbacks for method 'Sentry.Native.C::sentry_options_set_logger' HOT 2
- Document requirement for active scope transaction
- Url parameter secrets are not sanitized by default in ASP.NET HOT 6
- Windows Service memory grows indefinitely with Tracing and Profiling enabled. HOT 5
- Improve Sentry CLI utilization HOT 1
- Deprecate `EnableTracing`
- Consider `Mechanism.Handled` for non-thrown captured exceptions HOT 21
- Envelopes stuck in `__processing` until restart HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sentry-dotnet.