IIS6.0 Application pool Recycle settings Analysis _win server

Source: Internet
Author: User
Tags set time time limit server memory
The questions are as follows:
1. Display on Web page

The Web application you are attempting to access on this Web server is currently unavailable. Please click the "Refresh" button in the Web browser to retry your request.
Administrator considerations:
An error message detailing the cause of this particular request failure can be found in the WEB server's system event log. Please check this log entry to find out why this error occurred.

2.windows Event Viewer-Application log

The state server has closed a expired TCP/IP connection. The IP address of the client is 127.0.0.1. The expired Read operation began at 05/21/2007 20:12:04.

The solution is simple enough to recycle the IIS application pool that corresponds to the program.

But why does this happen? And why is it better to recycle? What did the recycling do?
The reason for the appearance
A search on the internet, found that the main is a few questions, of course, there are other reasons

1). Issues with the framework, such as versions 1.0 and 2.0
2) Aspnet_wp.exe problem
3) security Update (KB886903)


Unfortunately, the problems of our server are not caused by the above points, after my analysis that is written very bad very bad program consumes a lot of resources eventually led to a memory leak, resulting in the process of IIS off. Unfortunately, I can not change the procedures, are written by others, and will not change. But I can not every time this problem to log on to the remote server to recycle it, so only let him automatically recycled.

Automatic recycling There are several ways, do not know that a more suitable, and the process of recycling will be saved in the memory of the session empty, resulting in the user needs to re-enter the problem, so the less automatic recycling the better, To make sure that no one of them uses the bad program to make the other users want to log in again.

If the use of State server or to save the session to the database to go to the program automatically recycled after the automatic recycling will not have any impact, the request will not be interrupted or the same continue to run, just changed the work process to continue to work for the client, the client is not feel, It was a blunder not to save the session to the database for convenience!

1. According to the running time
System default is 1740 minutes, that is, 29 hours, this is not very good control, suggest not, that is, remove the hook.

2. Number of requests
This depends on the specific situation. If there are only 10 requests, but there are 5 of those who are requesting a page that compares resources (perhaps the annual report of statistics, and so on), this time will appear when the process is off, if the request has 1000 but one also did not run a comparison of resources of the page, this time the process is certainly very normal, Therefore, depending on the number of requests, it does not meet the actual needs.

3. Planned Time
This is actually very good, but when the specific time to recycle good? Usually we are set up before work and after work recovery, this time recycling is necessary, but for the emergence of the possibility of a high memory footprint is not very applicable.

4. Memory (virtual memory or used memory)
The process that is causing the memory problem is very appropriate, but it is a very important question to set the value of how large it is, and I am determined by the actual occupancy of the process each time a problem occurs. Our server memory is 2G, usually some other services will take up more than 600 m, I found that every process is to 1G when the time off, so set the maximum use of memory for 1000M when automatic recycling, settings have been no problem. To view the footprint of a process use Windows Task Manager directly, the value can not be too small, otherwise if the traffic is very large over this value will automatically recycle, this is not necessary. Be sure to look at the actual occupancy of the process before making a decision.
In the IIS configuration file if the IIsApplicationPools node's LogEventOnRecycle attribute is configured, each time the log file of the IIS logs the relevant information according to the value of the LogEventOnRecycle attribute. Also a set of automatic recycling is an important reference, but because this log file can only look a few hours before the record, the current record will be a few hours before writing in, so it looks inconvenient, depressed!


Now for the time being the maximum memory automatically recall the previous problem is resolved, temporarily also found what new problems, also do not know how to set up other places, is there a better way? I hope the people who have come to this article can make some valuable suggestions, and we will share our experience together.

The IIS configuration file is under the WINDOWS installation directory (C:/windows/system32/inetsrv/metabase.xml), and you need to stop the IIS service by directly modifying the configuration file, and remember to back up before modifying.

Part of the configuration information, write a fun

Copy Code code as follows:

<iisapplicationpool Location = "/lm/w3svc/apppools/defaultapppool"
Apppoolautostart= "TRUE"
Periodicrestartmemory= "2000"//MAX virtual memory mb
periodicrestartprivatememory= "1000"//MAX memory MB
periodicrestartrequests= "1000"///number of requests
periodicrestartschedule= "07:50//Automatic recycling time
12:00
20:00 "
>
</IIsApplicationPool>


here's how to extract the Help from IIS.

How worker Process Recycling works
Depending on how the application pool is recycled, the World Wide Web Publishing Service (WWW service) can use two methods to reclaim an assigned worker process:

• By default, the WWW service establishes "overlapping recycle", which continues to run the worker process to terminate until a new worker process is started.
• Alternatively, the WWW service can terminate a worker process, and then start a new worker process (if the workload allows this to be done).

Note When the WWW service reclaims a worker process, it does not disconnect existing TCP/IP connections. The HTTP protocol stack (http.sys) establishes and maintains a TCP/IP connection.

In an overlapping recycle scenario, the process to be recycled continues to process the request, while the WWW service creates an alternate worker process. Start a new worker process before you stop the old worker process, and then direct the request to the new process. This design prevents service disruption because the old process still communicates with HTTP.sys to process requests before shutting down. Because the shutdown timeout value that can overlap off or start can be configured, the process can be terminated while the worker process is still processing the request (if it does not finish processing the request within the time limit).

When you configure an application pool to recycle worker processes based on elapsed time, you can recycle all worker processes during the set run time, but you cannot recycle all of them at the same time. You can recycle applications at different times of the set time to reduce the number of interrupts that clients request services.

Similarly, when you configure an application pool to recycle applications based on the number of processing requests, you can recycle each time to share the overhead associated with worker process recycling.

When to use worker process recycling
The following general guidelines should be considered when deciding whether to start a worker process recycle. The best solution is to fix the application that is causing the failure. However, recoding is not always used, especially when other application code that is running cannot be modified.

Consider using recycling in the following situations:

    • You cannot repair a failed application on a WEB server that you host.
    • Encountered an uncertain or intermittent failure.
    • You suspect that the application is leaking memory for performance monitoring reasons.
    • A temporary reset solution was previously implemented, for example, the IISReset command-line utility is scheduled to execute.

You may not need to use recycling at all in the following situations:

    • Your host Web site contains only static content and does not contain a custom Internet server API (ISAPI) application.
    • The application you host is already fully tested, and there is no memory or resource allocation problem.

To effectively use recycling, carefully review the criteria that the collection is based on (as shown in the following table).

the
the conditions on which to recycle description use time
ISAPI request to recycle worker processes based on requests from ISAPI in the application pool. The ISAPI extension can declare itself as health-poor. The
run time reclaims worker processes based on the time (in minutes) specified by the user. a failed application has run too long. The number of
requests reclaims a worker process when a Hypertext Transfer Protocol (HTTP) request exceeds a specific threshold. The application fails depending on the number of requests received by the application. The
scheduled time is recycled at a specified time within 24 hours. The condition is similar to the condition of the run time.
virtual memory (reserved memory plus used memory) reclaims the worker process virtual memory when it reaches a specific threshold value. The memory stack is too fragmented (this is caused by the application retaining multiple memory). The symptom is a continuous increase in virtual memory.
used memory reclaims a worker process when the memory used by the W3wp.exe process reaches a specific threshold value. A memory leak occurs in some applications in .
as needed to start recycling when an IIS administrator can control the collection of the entire application pool using the Microsoft? Management Console (MMC) or script. There is an application pool that causes a failure when the other site starts and runs. Consider recycling the application without resetting the entire WWW service.

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.