IIS application Pool Optimization Scenarios
The server often generates the "Application pool ' DefaultAppPool" process that provides service shutdown times beyond the limit. The process ID is ' 3504 '. "Error, which causes IIS to be in suspended animation state, is known to be a setup issue for the IIS application pool. The workaround is as follows (the red character is marked):
Internet Information Services (IIS) Manager-> Application pool->defaultapppool-> right-click Properties
First, recycling
1, recycling process (minutes): selected, value of 1740 (a)
2, recycling worker process (number of requests): (not selected) (originally set to 35000)
3, in the following time recycling process: Do not fill (03:00)
4, consume too much memory when recycling worker process: all do not choose. (2, 3, 4 May avoid server response problems that might be caused by forcing the recycle process to occur when the traffic is high, causing IIS to feign death without responding) ( maximum virtual memory 350, maximum memory usage)
Second, performance (all do not choose)
Select only idle timeout of 20 minutes. No other choice. The maximum number of worker processes in the Web garden is 1 (default). Note that the Web garden must remain the default, if you fill in more than 1 of the number will cause some Web site program background program can not open or refresh non-stop.
The original request queue is limited to 4000 and is now unrestricted. (To choose is 10000)
iii. Operational Status
(ping is enabled, default)
(Start quick fail protection with hooks removed!) )
In order to avoid really encountering a lot of errors without prompting, you can not close, just the protection of the rapid protection of the scope of more, such as the failure of 50 times a period of 5 minutes to close the corresponding program. ( the start time limit is 90 seconds and the shutdown time limit is 180 seconds.) )
"Closing time limit of 180 seconds" is a must, because the process shutdown time, originally 90 seconds limit, is the default value, if the process shutdown time of more than 90 seconds, it is considered timeout, resulting in: Process shutdown time exceeded the limit log, so the appropriate extension of this time, you can avoid this error!
The core of IIS 6 is worker process isolation mode , and the application pool defines how the worker process works, so that the application pool is the core of the entire IIS 6.
Unlike IIS 5, which uses only a single application pool, IIS 6 working in worker process isolation mode can create multiple application pools, which are completely isolated from each other, and no application pool will be affected by the time the service is stopped.
before using the application pool, you should determine the number of application pools you need . There may be a lot of friends who think that since the different application pools are completely isolated, I just need to create an application pool for each Web site. This approach is available when there are fewer Web sites on the IIS server, but if there are many Web sites on the IIS server, this approach does not apply because different application pools create their own worker processes when they are accessed. When a large number of worker processes work concurrently, it consumes a lot of system resources and CPU utilization, but reduces server performance. You should divide the Web sites that are on the IIS server against the importance, isolation, security, and stability of the Web site, and then determine the number of application pools that are required depending on the situation. For those very important web sites, Web sites that need to be isolated separately, Web sites running code stability and insecure security are configured to use separate application pools, and other normal Web sites are configured to use a common application pool.
By default, when you install IIS, a Default Web site is created and an application pool named DefaultAppPool is used, and the application pool under the default configuration is already working well. It is recommended that you configure the application pool only when you specifically need it.
Configure Application Pool Properties
To expand the application Pool folder in the IIS management Console, and then right-click the corresponding application pool, click Properties , and you can configure the following in the properties of the application pool:
Recovery
In the Recycle tab, you can set up how the work process is recycled:
Recycle worker process (minutes): Recycle worker process after how many minutes the worker process is running, enabled by default, and set to 1740 minutes (29 hours);
Recycle worker process (number of requests): Terminates the worker process after the worker process has processed the number of HTTP requests, which is disabled by default, and the default value is 35000if enabled;
Recycle worker processes in the following time : Recycle worker processes at specified times, disable by default, and if enabled, click Add button to add recycle time, use 24-hour system to define the time of recovery;
Recycle worker process when too much memory is consumed:
Maximum virtual memory (Mega): Reclaims worker processes when the virtual memory used by the worker process reaches the set value, which is disabled by default, and is recommended to be set to no more than 70% of the total virtual memory;
maximum memory (trillion): Reclaims worker processes when the physical memory used by the worker process reaches the set value, which is disabled by default, and if enabled, the default value is M; The recommended setting is 60% of the total physical memory;
It is also important to note that the application pool has the following two kinds of worker process recycling methods, but neither of these methods will cause disruption to the Web service:
By default, the application pool uses overlapping recycling methods. In this way, when the application pool closes a worker process, a worker process is created before the old worker process is closed until the new worker process is successfully created;
The application pool can also close the old worker process before creating a new worker process.
If the Web application does not support multiple instance runs, you must configure the application pool to prohibit overlapping recycling methods. This configuration cannot be modified in the IIS management Console and can only be done by modifying the DisallowOverlappingRotation metabase property of the corresponding application pool in MetaBase.xml.
Performance
In the Performance tab You can set how the worker process works:
close worker process after idle time (minutes): Shut down this worker process when the worker process is idle for a few minutes, which reduces the consumption of system resources and CPU performance by the idle worker process, which is enabled by default and is set to 20 minutes;
Core request queue is limited to (number of requests) : When HTTP.sys receives an HTTP request sent by a client, if the worker process of the corresponding application pool that handles the request is still busy, HTTP.sys will save the received request in the corresponding application pool's request queue until the worker process is idle. This option is used to set the number of requests that can be accommodated by the request queue for this application pool, by default, the request queue for each application pool is limited to reserving 1000 requests, and if a 503 error is returned to the client if it is exceeded, you can modify it as appropriate to the maximum set to 65535. However, if the setting is too large, it consumes a lot of system resources, and setting too small can cause frequent 503 errors during client access.
Enable CPU monitoring : Monitors the CPU usage of this application pool, is not enabled by default, and if an application pool consumes too much CPU utilization, you can restrict this application pool by configuring this option;
Maximum CPU Utilization (percentage): The maximum CPU utilization that can be used by the application pool set, and the default value of 100 when CPU monitoring is enabled;
Refresh CPU usage (minutes): The interval between refreshing CPU usage, and the default value of 5 when CPU monitoring is enabled;
What to do when CPU usage exceeds maximum usage : When CPU usage for this application pool exceeds the maximum CPU usage set, the default is none when CPU monitoring is enabled. IIS simply logs in the event log without other action, and if you choose to shut down, IIS closes all worker processes in the application pool;
Web garden : In a Web garden You can configure the maximum number of worker processes used by this application pool, the default is 1, the maximum can be set to 4000000, and the configuration using multiple worker processes can increase the performance of the application pool processing requests. However, before you set up to use more than one worker process, consider the following two points:
Each worker process consumes system resources and CPU usage, and too much work processes can lead to a sharp depletion of system resources and CPU utilization;
Each worker process has its own state data, and if the Web application relies on the worker process to save state data, it may not support the use of multiple worker processes.
Operation Status
In the Health tab you can configure the application pool to monitor the health of the worker process,
Ping enabled: By default, the application pool is configured to ping the worker process every 30 seconds, and when the worker process does not respond, it is considered to be a failure and is configured to close the worker process by default. You can modify the interval of the ping, but too long ping interval may cause the interruption of the Web service, and too short ping interval will consume more system resources and CPU utilization, so it is recommended that you keep the default configuration;
enable fast fail protection : if there is a problem with the Web application code writing, it may cause the worker process to continue to experience problems. By default, the application pool is configured to enable fast fail protection, which disables this application pool when the number of failures that occur within the configured time period (the default is 5 minutes) exceeds the configured value (default is 5).
start time limit : IIS waits for the start of a worker process that belongs to this application pool, and IIS records in the event log when the worker process is enabled beyond this setting value;
Shutdown time limit : When IIS detects a worker process failure, this option specifies the time limit for IIS to wait for the worker process to shut down automatically, and if the worker process has not closed after this time limit, IIS forces the worker process to shut down.
Identity
In the Identification tab, you can configure the user account in which the worker process runs. In IIS 5 or when IIS 6 runs in IIS 5 isolation mode, the worker process runs on the Local system account, and the work process of IIS 6 running in worker process isolation mode runs under the Network Service account. This reduces the likelihood of the system being attacked.
You can configure the worker process to run under a predefined Local system , Local Service , or Network Service account, or you can configure it to use a custom user account. It is recommended that you use the default network Service account; However, if you want to use a custom user account for higher security, it is recommended that you simply add this custom user to the IIS_WPG user group, so IIS_WPG The user group contains the minimum permissions to start and run a worker process.
Creating an application pool
To create a new application pool, right-click the application Pool folder in the IIS management Console, point to New , and select an application pool ;
Then, in the Add New Application Pool dialog box, enter the application pool name in the application pool ID column, and then choose to use the default settings or inherit the existing application pool settings, and then click OK ;
assigning Web sites to application pools
In the IIS management Console, expand the Web site folder, right-click the corresponding Web site, and then select Properties , on the Pop-up Site Properties dialog box, click the Home Directory tab, and then in the application pool Column Select a different application pool, by default all Web sites use a default application name, if you want to use a different application name for this site, you can modify it in the application name column, for example, I modify it to Winsvr, this is mainly easy to view, and then click OK ,
At this point, the corresponding application pool shows the application for the Web site, as shown in the following illustration: