Is there any limitation for number of Asynchronous threads that we can create using ASP.net with configuration: IIS6.0, win 2003 server, net2.0, webservice, app pools.

Dani AI

Generated

Following and : the number of async threads you can create is governed by the CLR thread pool and the resources of each worker process (w3wp). On IIS6 / Win2003 with .NET 2.0 each application pool process has its own CLR thread pool; enabling a web garden multiplies the effective threads because it runs multiple worker processes. The CLR uses defaults and runtime heuristics, so raising counts without addressing blocking work often just hides a bottleneck.

Practical guidance:

  • Measure first. Use perfmon counters in the ASP.NET and .NET CLR Threading categories (requests queued, thread-pool usage) and reproduce load before changing settings.
  • Prefer true asynchronous IO (Begin/End APM in .NET 2.0) so threads are not blocked waiting for network or DB calls.
  • If you must change pool sizes, do it early in the app (Application_Start) via the ThreadPool API rather than relying on machine-wide edits; adjust MinThreads to reduce startup latency and MaxThreads only after careful testing.

Example (Global.asax):

// Global.asax.cs
using System.Threading;

protected void Application_Start(object sender, EventArgs e)
{
    int minWorker, minIOC;
    ThreadPool.GetMinThreads(out minWorker, out minIOC);
    // increase min worker threads cautiously
    ThreadPool.SetMinThreads(Math.Max(minWorker, 50), minIOC);
}

Cautions: increasing threads increases memory and context switching and can reduce throughput. Tune gradually, load-test, and prefer fixing blocking code or using async patterns over simply raising thread counts.

Recommended Answers

All 2 Replies

The default size of the threadpool is 25 ;)

Regards,

Richard
The Netherlands

can we increase this size, if so how? is this the machine config change for maxWorkerThreads

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.