Dante
Dante

Reputation: 59

how to increase max ThreadPool Limit in asp.net Core

How can I increase the max thread pool limit in ASP.NET Core, and which is the default value? Can you show an example?
I know in ASP.NET the default max threads limit is 5000, but what's the value in ASP.NET Core?
I got "thread-pool exhaustion" and need to increase it, because naturally the amount of user threads increases in the company.

Upvotes: 1

Views: 5749

Answers (2)

palota
palota

Reputation: 652

Recommended solution is to rewrite all your synchronous methods to asynchronous. You don't need more threads if you properly use async/await everywhere. The thread pool exhaustion is usually caused by synchronous methods which block threads for a long time. Those methods should be started with a parameter TaskCreationOptions.LongRunning.

Task.Factory.StartNew(action, TaskCreationOptions.LongRunning);

Upvotes: 1

Halil Saltık
Halil Saltık

Reputation: 11

.Net Core 3.1 Console App ThreadPool Max Thread Information : Result (Worker Threads: 32,767, Asynchronous I/O Threads: 1,000)

.Net Framework 4.8 Console App ThreadPool Max Thread Information : Result (Worker Threads: 2,047, Asynchronous I/O Threads: 1,000)

Note: Used GetMaxThreads Method

Upvotes: 1

Related Questions