DotNet RabbitMQClient: Unmarked long running tasks interfere with PortableThreadPool heuristics

102 views
Skip to first unread message

dharshana jagoda

unread,
Mar 20, 2023, 5:49:59 PM3/20/23
to rabbitmq-users
Hi,

The RabbitMQClient library uses long running tasks without marking them as "long running".

Is it possible to get them changed?
For example is it possible to change
_mainLoopTask = Task.Run(MainLoop);
to
_mainLoopTask = Task.Factory.StartNew(MainLoop, TaskCreationOptions.LongRunning);

As you might know, the CoreCLR in Linux uses the PortableThreadPool to dispatch data received via asynchronous IO compared to IOCP threads on Windows. Having unmarked long running tasks interferes with the heuristics used by the PortableThreadPool and delays the expansion of the thread pool due to late detection of low throughput. Practical impact of this is the regular health probe failures of services running Kestrel.

Many thanks,
Dharshana.

Luke Bakken

unread,
Mar 21, 2023, 9:40:56 AM3/21/23
to rabbitmq-users
Hello,

Thanks for the information. I have filed the following request - https://github.com/rabbitmq/rabbitmq-dotnet-client/issues/1318

Please note that you can feel free to open issues and submit pull requests to fix them.

Thanks,
Luke

Luke Bakken

unread,
Mar 21, 2023, 9:45:58 AM3/21/23
to rabbitmq-users

dharshana jagoda

unread,
Mar 21, 2023, 10:52:25 AM3/21/23
to rabbitmq-users
Hey Luke,

Thanks for filing the request. Happy to submit a pull request. Do I raise it against the Main branch or 6.x?

Thanks,
Dharshana.

Luke Bakken

unread,
Mar 21, 2023, 10:54:11 AM3/21/23
to rabbitmq-users
Hi  Dharshana,

You can open it against 6.x. I feel like the code used to have  TaskCreationOptions.LongRunning and it was removed at some point, but I can't find it in the project history. That long discussion to which I linked may have some clues.

Reply all
Reply to author
Forward
0 new messages