Skip to content

default logging to console has bad perf on windows, should be disabled by default #40770

Open
@Maoni0

Description

@Maoni0

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

this is without much logging and it's taking up 8.8% inclusive CPU. disabling colors didn't help. it's just really non performant to log to console on windows. please consider disabling this by default.

  • Thread (10844) CPU=1886ms (Console logger queue processing thread) | 8.8 | 1,886
    |+ ntdll!RtlUserThreadStart | 8.5 | 1,836
    ||+ kernel32!BaseThreadInitThunk | 8.5 | 1,836
    || + coreclr!ThreadNative::KickOffThread | 8.5 | 1,836
    ||  + coreclr!ManagedThreadBase_DispatchOuter | 8.5 | 1,836
    ||   + coreclr!ManagedThreadBase_DispatchMiddle | 8.5 | 1,836
    ||    + coreclr!ThreadNative::KickOffThread_Worker | 8.5 | 1,836
    ||     + coreclr!DispatchCallSimple | 8.5 | 1,836
    ||      + coreclr!CallDescrWorkerInternal | 8.5 | 1,836
    ||       + system.private.corelib!System.Threading.Thread::StartCallback() | 8.5 | 1,836
    ||        + microsoft.extensions.logging.console!Microsoft.Extensions.Logging.Console.ConsoleLoggerProcessor::ProcessLogQueue() | 8.5 | 1,836
    ||         + Microsoft.Extensions.Logging.Console.il!AnsiParser.Parse | 5.1 | 1,106
    ||         |+ Microsoft.Extensions.Logging.Console.il!AnsiParsingLogConsole.WriteToConsole | 5.0 | 1,070
    ||         ||+ system.console.il!ConsolePal.set_BackgroundColor | 1.6 | 347
    ||         |||+ system.console.il!ConsolePal.GetBufferInfo | 1.6 | 345
    ||         ||||+ system.console.il!dynamicClass.IL_STUB_PInvoke(int,value class CONSOLE_SCREEN_BUFFER_INFO&) | 1.5 | 333

Expected Behavior

for something so non performant, should disable by default or change to another form of logging (ie to a file).

Steps To Reproduce

I have an internal app that I cannot share - if you can't repro feel free to let me know.

Exceptions (if any)

No response

.NET Version

.net 6

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Perfarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsinvestigate

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions