Asp.net workthreads and request queues

Source: Internet
Author: User

When ASP. NET receives a page-based request, it extracts a thread from the thread pool and distributes the request to the thread.

A normal (or synchronous) page retains the thread during this request to prevent this thread from being used to process other requests. If a synchronous request becomes an I/O bound (for example, if it calls a remote web service or queries a remote database and waits for the call to return ), the thread allocated to the request is in the suspended state before the return result is called. This affects scalability because the available threads in the thread pool are limited.

The setting of this number is the maxworkerthreads attribute of the following node in machine. config.

<System. Web>
<Processmodel requestqueuelimit = "Num | infinite" maxworkerthreads = "num"/>
System. Web>

Maxworkerthreads

Configure the maximum number of worker threads used for processes by CPU. For example, if this value is 25 on a single processor server, ASP. NET uses the Runtime API to set the process limit to 25. On a dual-processor server, this limit is set to 50. The value of this attribute must be equal to or greater than the minfreethread attribute setting in the httpruntime configuration section. This attribute ranges from 5 to 100.

In the above settings of Asp.net Request queue, there is also a queue setting, as follows: requestqueuelimit specifies the number of requests allowed in the queue. After this number is exceeded, Asp. net will begin to return the "503-the server is too busy" message to the new request. By default, the number of available threads is 1000. Set this parameter in IIS6 and iis7.

Set the number of threads available for IIS 7

Set the number of threads available for IIS 6

If all request processing threads are blocked to wait for the I/O operation to complete, other requests are queued to wait for the thread to release.

The best case is reduced throughput because requests can be processed after a long wait.

The worst case is that the queue is full, and ASP. Net causes subsequent requests to fail due to the 503 "server unavailable" error.

References:

Use threads in server-side Web code and generate asynchronous handlers

Http://msdn.microsoft.com/zh-cn/library/aa686076.aspx

Asynchronous page http://www.microsoft.com/china/msdn/library/webservices/asp.net/issuesWickedCodetoc.mspx in ASP. NET 2.0

IIS 6.0 Architecture

Http://blog.csdn.net/heaven_pl/archive/2008/02/19/2106572.aspx http://blog.csdn.net/heaven_pl/archive/2008/02/19/2106579.aspx

IIS 7.0 Architecture

Http://blog.csdn.net/SKY_VID/archive/2008/03/04/2147732.aspx

Understand the underlying architecture of ASP. NET

Http://blog.csdn.net/fanweiwei/archive/2007/04/10/1558912.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.