ASP. NET Process Optimization

Source: Internet
Author: User

ASP. NET worker processes can promote their restrictions to achieve higher performance. Configure ASP. NET process model settings on the Internet information service (IIS) Web server. It can only be set in the machine. config file <Processmodel>And affects all ASP. NET applications running on the server. Can Reference Document Description: http://doc.51windows.net/iismmc? Url =/iismmc/htm/aaconprocessmodelelement.htm.

ASP. net Process Model configuration defines some process-level attributes, such as ASP. the number of threads used by. net, how long it takes to block threads before timeout, and how many requests are waiting for the completion of Io. By default, many restrictions are imposed. Currently, all the hardware we use is a dual-core multi-gb ram server. Therefore, Process Model configuration can reduce ASP.. Net processes consume more system resources and provide better scalability for each server.

ASP. NET 2.0 installation will create the following configuration nodes in the machine. config file:

<system.web>
<processModel autoConfig="true" />

Reduce this automatic configuration and use specific values for different features to customize the way ASP. NET worker processes work. For example:

<Processmodel

Enable = "true"

Timeout = "infinite"

Idletimeout = "infinite"

Shutdowntimeout = "00:00:05"

Requestlimit = "infinite"

Requestqueuelimit = "5000"

Restartqueuelimit = "10"

Memorylimit = "60"

Webgarden = "false"

Username = "machine"

Password = "autogenerate"

Loglevel = "errors"

Clientconnectedcheck = "00:00:05"

Comauthenticationlevel = "Connect"

Comimpersonationlevel = "Impersonate"

Responsedeadlockinterval = "00:03:00"

Responserestartdeadlockinterval = "00:03:00"

AutoConfig = "false"

Maxworker threads = "100"

Maxiothreads = "100"

Minworkerthreads = "40"

Miniothreads = "30"

Servererrormessagefile = ""

Pingfrequency = "infinite"

Pingtimeout = "infinite"

Maxappdomains = "2000"

/>

Except for the following non-default values, the others are system default values:

Maxworkerthreads

The default value is 20 for each processing. On a dual-core computer, ASP. NET requires 40 for processing. This means that ASP. NET can process 40 requests each time on a parallel dual-core server. I increased the number to 100 to provide more threads for each processing of ASP. NET. If you have an application whose CPU processing capability is not strong, but it can process multiple requests more easily per second, you can increase the value.

Especially when your web application uses a large number of web services to call or download/upload a lot of data that will not put pressure on the CPU. When ASP. NET runs out of these worker threads, it stops sending multiple requests. At this time, the request will be placed in a queue and will wait until there is an idle worker thread. This usually happens when your site begins to accept more than expected clicks. In that case, if you need to save CPU usage, you can increase the number of worker threads processed each time to achieve the goal.

Maxiothreads

The default value is 20 for each processing. On a dual-core computer, ASP. NET requires 40 threads for I/O operations. This means that ASP. NET can process 40 I/O Requests each time on a parallel dual-core server. I/O requests can read/write files, perform database operations, call Web Services, and generate HTTP requests from web applications. Therefore, if your server has enough system resources to process more I/O requests, you can set this value to 100. This is especially useful when your web application downloads/uploads data in parallel mode and calls many external web services.

Minworkerthreads

When the number of idle ASP. NET worker threads is lower than this number, ASP. NET starts to push these requests into the queue. Therefore, you can set a lower value for the change to increase the number of current requests. In addition, we recommend that you do not set this value too low, because the web application code may need some background processing and parallel processing, and more idle worker threads are required.

Miniothreads

Except for the I/O thread, it is the same as minworkerthreads. However, you can set this value lower than minworkerthreads. As far as I/O threads are concerned, parallel processing will not occur here.

Memorylimit

Specify the maximum value allowed by the memory size as the percentage of the system memory, so that ASP. NET can consume these worker processes before starting a new process and rescheduling existing requests. If you only run your website application on your server and no other processes need RAM, you can set a higher value, such as 80.

However, if you have an application that may cause memory leakage at the same time, therefore, it is best to set this value to a lower value so that the leaked memory can be recycled in a timely manner before a major problem occurs, so as to keep your site stable. Especially when you use COM components and the memory leaks. However, this is only a temporary solution to this problem; of course, you need to solve the leakage problem.

In addition to processmodel, there is also a very important node system.net. You can specify the maximum number of requests to be sent as a separate IP address.

<system.net>
<connectionManagement>
<add address="*" maxconnection="100" />
</connectionManagement>
</system.net>

The default value is 2, which is relatively low. This means that you cannot use one IP address to link more than two links from your web application at the same time. Many external content obtained by the site is blocked due to the default settings. Here I set it to 100. If your web application calls a specified server in large quantities, you can even consider setting a higher value.

Related Article

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.