FTP on IIS6 has Cache

Source: Internet
Author: User
Tags ftp client metabase
ArticleDirectory
    • Cache Management settings
    • Request and connection management settings
    • IIS Registry Settings
    • IIS metabase
    • IIS workflow options (IIS Admin UI, application pool attributes)
    • Security Socket Layer Adjustment Parameters
    • ISAPI
    • Managed code Adjustment Parameters
    • NTFS file system settings
When IIS6's built-in FTP is used, it is found that there will be a cache when the file is modified directly on the FTP client, the solution is to create a disablememorycache under HKLM \ System \ CurrentControlSet \ Services \ inetinfo \ Parameters \ To disable IIS cache.

·Disablememorycache(REG_DWORD ). If it is set to 1 (the default value is 0), the user-mode IIS cache is disabled. When the cache hit rate is very small, the cache can be completely disabled to avoidCodePath-related overhead.

References:

IIS 6.0 applies the new process model. Kernel-mode HTTP listenerProgram(HTTP. sys) receives and sends HTTP requests (or even uses its response cache to satisfy the requests ). The working process registers the URL sub-space. http. sys sends the request to the corresponding process (if the application pool is used, the request is sent to the process set ).

Figure 4 shows the differences between IIS 5.0 and IIS 6.0 process models. IIS 5.0 uses WinSock to accept connections on port 80. RequestInetinfoThe process is responsible for receiving, or executing the request within the process, or handing itDLLHOSTProcesses are processed outside the process (for the purpose of isolation ). The response isInetinfoThe process is sent back.

Figure 4 process models of IIS 5.0 and IIS 6.0

The IIS 6.0 process depends on the kernel-mode web driver HTTP. sys. In the new model, HTTP. sys manages connections and Processes requests. Requests may be satisfied through the HTTP. sys cache, or they may be handed over to a working process for further processing (see figure 5 ). You can configure multiple working processes to isolate them with low overhead.

HTTP. sys includes a response cache. When the request matches an entry in the response cache, HTTP. sys directly sends the cache response from the kernel mode. Figure 5 shows how requests are processed through HTTP. sys (Requests may also be forwarded to a worker process for processing ).

Figure 5 request processing in IIS 6.0

Because the Web Server includes both kernel-mode components and user-mode components, both components must be adjusted at the same time to achieve optimal performance. Therefore, to adjust IIS 6.0 for a specific load, You need to configure the following content:

· HTTP. sys (kernel-mode driver) and related kernel-mode cache.

· Working process and user mode IIS, including application pool configuration.

In addition, we will discuss other parameters that affect performance later.

Kernel Mode Adjustment

Performance-related HTTP. sys settings can be divided into two types: Cache Management, connection and request management. All Registry settings are saved in the following entries: HKEY_LOCAL_MACHINE "system" CurrentControlSet "services" HTTP "Parameters

If the HTTP service is running, you must stop the service and restart the computer to make the settings take effect.

Cache Management settings

One of the advantages of HTTP. sys is the kernel mode cache. If the response is in the kernel cache, it may be able to fully satisfy an HTTP request in the kernel mode, which can obviously greatly reduce the overhead of CPU processing requests. However, the IIS 6.0 kernel-mode cache is a physical memory-based Cache. Each entry occupies a certain amount of memory space.

Cache entries can only be used to provide benefits. However, an entry occupies physical memory at any time, whether or not it is used. Therefore, you need to evaluate the benefits of caching a project (the request can be satisfied directly from the cache) and its overhead throughout the life cycle (the physical memory needs to be occupied, consider the availability of resources (CPU, physical memory) and workload. HTTP. sys tries to only save useful (frequently accessed) projects in the cache. However, if HTTP is adjusted for a specific workload. sys cache, the performance of the Web server can be improved to a certain extent.

The following are some useful cache settings for HTTP. sys Kernel Mode:

·Urienablecache. Default Value: 1. If it is set to a non-zero value, Kernel Mode Response and segment cache can be enabled. For most workloads, the cache should be enabled. If you want ultra-low response and low cache utilization, disable caching.

·Urimaxcachemegabytecount.Default Value: 0. If it is set to a non-zero value, you can specify the maximum amount of memory that can be used by the kernel cache. The default value is 0, which allows the system to automatically adjust the amount of memory that can be used by the cache. Note: You can only set the maximum amount of memory that can be used, and the system may not allow the cache to grow to the specified size.

·Urimaxuribytes.Default Value: 262144 bytes (256 KB ). This parameter sets the maximum length of each entry in the kernel cache. Responses or segments larger than this length are not cached. If you have enough funds, you can increase the value of this parameter. If the funds are limited and large entries squeeze out smaller entries, you can set this parameter to a smaller value.

·Uriscavengerperiod.Default Value: 120 seconds. A scavenger program regularly scans the HTTP. sys cache. Entries that have not been accessed during the two scans will be deleted. You can set the scan cycle to a high value to reduce the number of scans. However, if old entries with low access frequency are still stored in the cache, the memory occupied by the cache will continue to increase. If you set this period too low, the scan frequency will be too frequent and may cause excessive cache cleaning and disturbance.

Request and connection management settings

In addition, HTTP. sys manages inbound HTTP/HTTPS connections and is the first layer on which requests are processed. It uses an internal data structure to save connection and request information. Although such a data structure can be created (or released) as needed, if you save some data structures in the look-aside table for backup, you can achieve higher CPU efficiency. Saving such reserves helps HTTP. sys to use fewer CPU resources to handle load fluctuations. Note: Load fluctuations may not be caused by external load fluctuations. Some internal optimization measures designed to improve batch processing or interrupt mediation may also lead to load fluctuations and fluctuations.

Reserve helps reduce CPU usage and shorten the delay time. It also increases the processing capability of the web server, but also increases the memory usage. When adjusting HTTP. sys requests and Connection Management Behaviors, you must remember the following factors: available server resources, performance goals, and workload characteristics. You can use the following request and connection management settings:

·Maxconnections. This setting controls the number of concurrent connections allowed by HTTP. sys. Each connection consumes a non-Paging pool (a valuable and limited resource ). The default value is quite conservative to limit the number of non-Paging pools used by connections. For dedicated web servers with sufficient memory, you can set this value to a higher value if a large number of concurrent connections are expected. The larger the value is, the more non-Paging pools are occupied. Therefore, be careful to use a correct value that suits the system configuration.

·IdleconnectionshighmarkIdleconnectionslowmarkAnd idlelisttrimmerperiod.These values are used to control the processing of non-parallel connection structures: the number of available connections that must be provided at a certain time (used to handle connection load fluctuations), the upper and lower limits of the release list, and the frequency of cut and supplement of the connection structure.

·RequestbufferlookasidedepthAnd internalrequestlookasidedepth These values control the processing of data structures related to buffer management and the amount of reserves that should be completed to cope with load fluctuations.

Set IIS registry in user mode

The following registry settings can be found under the following entries:

HKLM "system" CurrentControlSet "services" inetinfo "Parameters"

·Maxcachedfilesize(REG_DWORD), in bytes. Determines the size of the files that can be cached (256 kb by default ). The actual value depends on the maximum number and size of files in the data table and the number of available Ram. Caching large files that are frequently accessed can reduce CPU usage, disk access, and latency.

·Memcachesize(REG_DWORD), in MB. Restrict IIS user-mode cache to the specified size (by default, the cache size is adjusted by IIS based on the number of available memory ). Depending on the size of the "popular" file set (Set of frequently accessed files), the number of Ram resources, or the IIS process address space (normally under 2 GB ), select the value of this parameter.

·Disablememorycache(REG_DWORD ). If it is set to 1 (the default value is 0), the user-mode IIS cache is disabled. When the cache hit rate is very small, the cache can be completely disabled to avoid overhead related to the cache code path.

·Maxpoolthreads(REG_DWORD ). Set the maximum number of threads in the pool that can be created by each processor (the default value is 4, and the range is not limited .) Every pool thread observes network requests and processes them. The maxpoolthreads count does not include the threads currently processing ISAPI applications. If the average CPU usage is not in the optimal state, you should increase the value of this parameter because all existing threads are busy and there are no available threads used to process new requests.

·Poolthreadlimit(REG_DWORD ). Set the maximum number of pool threads that can be created by the system (the default value is 4 times the number of processors, and the range is not limited ). Poolthreadlimit must be greater than or equal to maxpoolthreads. Under normal circumstances, the number of poolthreadlimit = maxpoolthreads processors. It is not enough to set only one of the parameters. If the maxpoolthreads and poolthreadlimit parameters are specified at the same time, stricter restrictions can be imposed.

·Objectcachettl(REG_DWORD), in seconds. Controls the duration of an object that has not been accessed in the IIS user mode cache (the default value is 30 seconds, for example, 0xffffffff, the object cache scavenger thread is disabled ). If the system has enough memory and the submitted content does not change frequently, you can increase the value of this parameter. If the system memory is insufficient and the user mode cache size is increasing, this parameter should be lowered. See activityperiod in this section.

·Activityperiod(REG_DWORD), in seconds. Files can be cached only when they are repeatedly hit within the active period (10 seconds by default, and this option is disabled if it is set to 0. This parameter reduces the cache overhead caused by files that are not frequently accessed by the cache. If the cache content does not change much and there is not enough available memory, you can increase the activity duration. Or, if a large number of request loads exist in the cache, the activity duration can be reduced.

·Datasetcachesize(REG_DWORD) The default value is 50. Set the maximum number of virtual directory entries in the database dataset cache. If the number of installed virtual directories exceeds the default value, you can increase the value of this parameter. When submitting static content, a low-capacity dataset cache increases the latency (lower throughput and lower CPU usage ).

IIS metabase

The following settings can be found in w3svc.

·Aspmaxdisktemplatecachefiles. Enable disk caching for ASP script templates. Compiling an ASP template is a task that consumes a lot of CPU resources. The memory size limits the number of templates that can be cached in the memory. Retrieving the compiled template from the template cache on the disk requires less overhead than the template not in the compiled ASP memory cache. See the aspscriptenginecachemax section below.

·Aspdisktemplatecachedirectory. If possible, you can set it to a disk that is not frequently used (for example, a disk that is not shared with the operating system, paging files, IIS logs, or other frequently accessed content ). The default directory is "% WINDIR %" System32 "inetsrv" template disk cache "ASP compiled templates ".

·Aspscriptenginecachemax. Set it to the maximum number of script engines allowed by the memory capacity (125 by default ).

·Aspscriptfilecachesize. Set the maximum number of ASP templates allowed for memory capacity (250 by default ). See the aspmaxdisktemplatecachefiles section in the previous article.

·Aspexecuteinmta. If you want to detect errors or faults when delivering some ASP content, set this parameter to 1 (Enabled ). For example, if you want to host multiple sites and each site runs under its own working process, you can enable this parameter. Errors can be seen in the COM + section of the Event Viewer. This setting enables the multi-threaded unit model in ASP (the default value is 0, indicating that the unit model is disabled ).

·Aspprocessorthreadmax. If the current setting (the default value is 25) is insufficient to meet the load requirements (which may lead to errors in some requests), you can increase the value of this parameter.

·Centralbinaryloggingenabled. Set this parameter to true to enable centralized binary logging. Binary IIS logging reduces CPU usage, disk space usage, and disk I/O operations. Centralized binary logs can be directed to a binary file regardless of the number of hosted sites. A post-processing tool is required to analyze logs in binary format.

IIS workflow options (IIS Admin UI, application pool attributes)

In the absence of administrator intervention, service restart, or computer restart, the IIS workflow recycling option on the IIS management interface provides an effective solution for an emergency fault or event. Such a situation includes memory leakage, which may increase the memory burden, or cause the worker process to enter the unresponsive or idle state. Under normal circumstances, you may not need to enable the recycle option, so you can disable it (or configure the system to perform the recycle operation at a very low frequency ). In the following section, the name of the italic is the per-app-pool variable. When using scripts to set these variables, you can use the path "/lm/w3svc/apppools/NN indicates the application pool index.

There are three options, as shown in the following table:

·Reclaim options.You canReclaim"Tab.

·Performance options.You canPerformance"Tab.

·Job process health monitoring options.You canHealthy"Tab.

Table 8. recycling options

Parameters

Description

Periodicrestartrequests, DWORD, Which is disabled by default. The default value is 35000.

Regular recovery by Time

Periodicrestartrequests, DWORD, Which is disabled by default. The default value is 35000.

Regular recovery based on the number of requests (accumulative)

Periodicrestartschedule, Multisz, disabled by default, empty string value by default

Reclaim at the specified time

· Periodicrestartmemory, DWORD, default value: 512 MB

· Periodicrestartprivatememory, DWORD, default value: 192 MB

If one of the following conditions is met, memory-based reclaim (disabled by default) will allow the recycle Worker Process:

· Maximum capacity of virtual memory

· Maximum memory used

If you are facing increasing pressure on memory capacity, you can use one or all of the parameters to frequently recycle working processes based on strict memory capacity standards to relieve memory pressure.

Table 9.Performance options

Parameters

Description

Idletimeout, DWORD, in minutes, the default value is 20

When the idle time of a process exceeds the specified time, close the working process. This can save a limited amount of memory resources, but if the CPU load is heavy and new working processes need to be started frequently, we do not recommend this approach, because the process creation will bring a certain amount of overhead.

Apppoolqueuelength, DWORD, default value: 2000

Limit the length of the kernel Request queue for each application pool (app-pool. The request consumes a paging pool. When there is a large demand for the paging pool, the value of this parameter should be lowered. If the length exceeds the specified length, the server rejects the request and generates a non-custom error number 503.

Cpuaccounting, Boolean, disabled by default (0), enabled as 1

Monitor CPU usage. You can set the maximum CPU usage (cpulimit, DWORD, default value: 0) and monitoring refresh cycle (cpuresetinterval, DWORD, default value: 0, in minutes ). If the CPU usage limit is reached, or no operation is performed (but an event is written in the event log), or the worker process (cpuaction, DWORD, default value: 0, indicates "no action is taken"; the maximum value is 1, indicating "Closing the Working Process ").

MaxprocessesBy default, one worker process is used to process all requests.

You can control the total number of worker processes in the operated web garden mode. In Web garden mode, several worker processes are responsible for processing the request load under a single application pool. No working processes were pre-assigned to the web site through different application pools. In some cases, a worker process cannot meet the processing needs of the load (this can be seen through poor CPU usage and long response time ), increasing the number of worker processes helps improve the system throughput and CPU usage. When hosting multiple sites, you can consider using the Web garden mode. In addition, when one of the processes suddenly crashes, using multiple working processes also provides more reliability, and almost no service interruption occurs. Compared with the pre-allocated application pool, the Web garden mode is easier to set and control.

Table10.Health options

Parameters

Description

Pingingenabled, Boolean. The default value is 1.

Pinginterval, DWORD, default value: 30 seconds

Ping the Working Process (pingingenabled) at a fixed interval (pinginterval ). If there is no response, it is deemed that the working process has an error. IIS will try to terminate the process and generate a new process.

Rapidfailprotection, Boolean, default

Rapidfailprotectionmaxcrashes, DWORD, 5 faults by default

Rapidfailprotectioninterval, DWORD, 5 minutes by default

Set the maximum number of failures allowed to be generated (rapidfailprotectioninterval) within a given period of time (rapidfailprotectionmaxcrashes), and control the rapid generation of failures (rapidfailprotection ). If a failure rate is specified, the application pool is disabled and related information is written to the event log.

Startuptimelimit, DWORD, 90 seconds by default

Control the start time of a working process. If the start time exceeds this time, it is deemed that a fault has occurred.

Shutdowntimelimit, DWORD, 90 seconds by default

If the shutdown time of the working process is exceeded, the process is considered to be in the non-responding State.

Security Socket Layer Adjustment Parameters

The use of Secure Sockets Layer (SSL) will increase the CPU burden. The most resource-consuming part of SSL is the overhead required to establish a session (including a full handshake), the overhead of reconnection and the overhead of encryption/decryption. To achieve better SSL performance, perform the following operations:

· Enable the "keep active" feature of SSL sessions. This eliminates the overhead required to establish a session.

· If possible, re-use sessions (especially for traffic that does not "keep active ).

· Note: the longer the key, the higher the security, but the more CPU time required.

· Note: not all page components require encryption. However, a mix of plain text HTTP and HTTPS may cause a warning to pop up in the client browser, notifying that not all page content is protected.

ISAPI

There are no specific adjustment parameters for isapis. If you write a private ISAPI extension, ensure that the Code is efficient in execution and resource usage. See other problems that affect IIS performance later.

Managed code Adjustment Parameters

· Make sure that all scripts have been compiled in advance. You can call a. Net script in each directory to complete this task. After compilation, You need to reset IIS. After modifying machine. config, Web. config, or any. aspx script, you must re-compile the script.

· If you do not need session status information, make sure that this project is disabled on each page.

· When you run multiple hosts containing ASP. NET scripts in the isolation mode (one application pool for each site), you should monitor the memory usage. Configure sufficient memory for the IIS server based on the number of application pools that are expected to run concurrently. Consider using multiple application domains (app-domains) where multiple isolation processes exist ).

Other problems affecting IIS Performance

·Install a filter without cache awareness.Installing a filter without the HTTP cache awareness will cause IIS to disable all the caches, resulting in a sharp decline in performance. The old ISAPI filter (the filter compiled before IIS 6.0) may have this problem. You can use the HTTP cache filter to mark the configuration database as a cache-aware filter.

·CGIRequest.For performance considerations, we do not recommend using CGI applications to process requests. Frequent Creation or Deletion of CGI processes results in a large amount of system overhead. A better alternative is to use the ISAPI program and ASP (or ASP. NET) scripts. These methods can be isolated.

NTFS file system settings

Under HKLM "system" CurrentControlSet "control" filesystem ",Ntfsdisablelastaccessupdate(REG_DWORD) 1.

By disabling the update of the date and time stamps of the last accessed file or directory, this switch parameter for the entire system reduces disk I/O load and reduces latency. This key does not exist by default, so you need to add it. If the operation contains a large dataset (or a large number of hosts) with thousands of directories, the effect of disabling update is very obvious. If you only need to retain the information web for Web management, we recommend that you use IIS logs instead.

Warning:Some applications (such as Incremental Backup tools) need to use the update information. Without this information, they will not work properly.

Http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/a0483502-c6da-486a-917a-586c463b7ed6.mspx? MFR = true

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.