-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
im currently investigating lock contention issues in our app due to seeing "high" latency in our app.
(I borrowed the Blocking detector from ben adams)
one thing that pops up is the async sink:
at System.Threading.SynchronizationContext.InvokeWaitMethodHelper(SynchronizationContext syncContext, IntPtr[] waitHandles, Boolean waitAll, Int32 millisecondsTimeout)
at System.Threading.Monitor.ReliableEnter(Object obj, Boolean& lockTaken)
at System.Threading.SemaphoreSlim.Release(Int32 releaseCount)
at System.Threading.SemaphoreSlim.Release()
at System.Collections.Concurrent.BlockingCollection`1.TryAddWithNoTimeValidation(T item, Int32 millisecondsTimeout, CancellationToken cancellationToken)
at Serilog.Sinks.Async.BackgroundWorkerSink.Emit(LogEvent logEvent)
at Serilog.Core.Sinks.SafeAggregateSink.Emit(LogEvent logEvent)
at Serilog.Extensions.Logging.SerilogLogger.Write[TState](LogEventLevel level, EventId eventId, TState state, Exception exception, Func`3 formatter)
at Serilog.Extensions.Logging.SerilogLogger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func`3 formatter)
at Microsoft.Extensions.Logging.Logger.<Log>g__LoggerLog|13_0[TState](LogLevel logLevel, EventId eventId, ILogger logger, Exception exception, Func`3 formatter, List`1& exceptions, TState& state)
at Microsoft.Extensions.Logging.Logger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func`3 formatter)
at Microsoft.Extensions.Logging.LoggerExtensions.Log(ILogger logger, LogLevel logLevel, EventId eventId, Exception exception, String message, Object[] args)
did you consider using immutable collections to avoid locking?
the lock is taken for up to 20ms which is not ideal
Metadata
Metadata
Assignees
Labels
No labels