[Reprint] site deployment, IIS configuration optimization guide

Site deployment, IIS configuration optimization guide

HTTPS: // www.cnblogs.com/heyuquan/p/deploy-iis-set-performance-guide.html 

quite worthy, after all, before a lot of places do not pay attention to learning.

 

table of Contents

First, set the application pool defaults

Second, the General Settings

Third, optimize the recovery strategy

Fourth, the performance

Five, IIS is initialized (preloaded), solve (after recycling) first visit to Slow

Sixth, concurrency

7, security

 

Usually publish the site to run properly on IIS, rarely to consider various parameters provided by IIS, how to configure the site is the most suitable for the current required for the operation? This article explains how to set up the basic settings should be optimized, recovery mechanisms, performance, concurrency, security, and IIS.

 

First to "IIS application pool" parameters optimized screenshots:

Some numerical limitations FIG parameters may use some tools (such as: windows performance monitoring) operation site observed indicators set, will be introduced later to specific

 

 

 

 

Let's explain these parameters are why this set (Note: The arguments in the article, is not set up in accordance with the application pool from top down, but in accordance with the optimized arrangement of function points)

 

First,   set the application pool defaults

The default template parameters were set as follows, rear set, the new application pool to use the default parameter template.

 

 

Second, the General Settings

IIS version View

In iis manager -> Help -> About Internet Information Services, as shown below, the version is IIS10.

 

General> Start Application 32

Default value: False

Optimization settings: on-demand setting. If it is confirmed sites rely on some of the components 32, which must be set to true.

Recommendation: Create an application pool for the site 32bit applications alone

reference:

iis run 32-bit programs on 64-bit systems website

General> Managed pipeline mode

The new application pool IIS7 integrated mode and classic mode

Classic mode: in order to preserve and IIS6 same approach, previously developed code can be easily ported to IIS7.

Integrated mode: the core ASP.NET request pipeline conduit in combination with IIS together, this model in conjunction with the operating system more closely, can provide better performance, and configuration management can be modular, and the increased use of managed code module extended flexibility in IIS.

Optimization settings: to the Integrated (integration mode)

reference:

    Understanding of the IIS7 classic mode and integration mode

 

Third, optimize the recovery strategy

 

Recovery> fixed time interval (minutes)

A period exceeding the period of time, the application pool recovered. Value is 0, the application does not pool at regular intervals recovery

Default: 1740 minutes, 29 hours

Optimization settings: to 0. Because they can not prevent recovery occurs during peak hours. And set "Recycling> specific time"

Recycling> specific time

Application pool recovering a particular set of local time (24 hour)

Optimization settings: Fixed recovered at low peak. eg: set at 04:00, 15:30, etc.

Alternatively, you can use the windows scheduled tasks to achieve six nights a week timed recycling iis site

Process Model> idle timeout (minutes)

The maximum time period, setting the working process is allowed to remain idle time interval over which time it will automatically shut down.

Optimization settings: to 0, to avoid memory recovery information is frequently emptied. And set "Recycling> specific time"

Process Model> idle timeout operation

The default is "Terminate" (The other option is "Suspend").

Terminate means that once the timeout to terminate the service, and to reclaim the memory buffer work processes;

Suspend the hovering wait, it will not recover the buffer memory.

 

In addition:

CPU occupancy overrun security program settings

CPU limit is not used to control the CPU utilization for each process, but a process safety program work occurs overrun CPU processing, to avoid the work process CPU for too long.

reference:

    iis7.0 cpu limit

iis cpu limits of operation:

  1. Limit: 10000 (1000 * calculated in percentage, 10% represents 10,000)
  2. Limiting operation: 1, noaction No Action 2, KillW3wp removal process and re-open a new process within the time limit
  3. Limit interval (minutes): the time limit setting, and within a long time to restart the detection of

Memory Limit collection mechanism

Setting "Recycling> Virtual Memory Limits" and "Recycling> dedicated memory limit" is disabled by default in accordance with the actual operation, generally do not set specifically for this purpose.

On | Off time limit

The actual operation is set, the default 90 seconds. As shown above, I have provided for 120 seconds

Process model> off time limit (in seconds): Specifies the work process, to complete the processing request and turn-off time period. If the worker process exceeds the closing time limit, it will be terminated.

Process Model> Start time limit (s): assign to a work process, and start time initialization. If the worker process initialization time limit exceeded start-up time, they will be terminated.

Recovery> Disable overlap recovered

The default value is false. Recycling application pool using overlapping manner. In this way, when the application pool to close a work process, will create a working process until the new worker process successfully created after the shutdown of the old work processes; 

Set to true, then turn off the old worker process, and then create a new work process. If the Web application does not support multiple instances running, you must configure the application pool recycling prohibit the use of overlapping manner.

Recycling> Recycling generate event entries

IIS Event Viewer

Method 1: Click "Start → Run", type eventvwr, click "OK", you can open Event Viewer.

Method Two: Click "Start" - "Settings" - "Control Panel" - "Administrative Tools" - "Event Viewer", open the Event Viewer window.

Method three: In the dialog box manually type "Run" "% SystemRoot% / system32 / eventvwr.msc / s" Open Event Viewer window.

 

 

Fourth, the performance

 

Close IIS logs

Once on the record, IIS will unavoidably faithfully records all web access records. The contents of these log files is very heterogeneous, such as access time, client IP, which is accessed from the links, Cookies, etc. It also includes Method (method), UserAgent (user agent) and so on. These records not only take up a lot of disk space is also greatly affect the performance of the web server. Evaluation was done, stop recording access can be increased by 5% to 8% of web performance.

Enable Content Expiration (client-side caching)

For static files enable content expiration can improve access performance.

  1. First, the directory should be divided reasonably website, pictures, CSS, JavaScript are in a separate directory
  2. Then select the cache directory in IIS> HTTP response header> set common header> Settings "web content expiration" policy

As Figure webDemo site, so that the user's browser compares the current date and the deadline to decide whether to display the cached page or request an updated page from the server, because the images, CSS, JS usually less change, so basically from the local cache read, thus speeding up the display speed.

reference:

    IIS7 disable individual client cache static files

Server Authentication Cache

IIS automatic mechanism, will during his visit css, js and other static files, the browser returns to the Last-Modified and Etag mark

reference:

    The browser cache Last-Modified

    Cache server authentication Last-Modified and Etag

Enable Gzip compression

IIS compression algorithm using Gzip

HTTP gzip is a compression algorithm, HTTP compression is a method of transmitting compressed text content between Web servers and browsers. HTTP compression using a common compression algorithms such as gzip compression such as HTML, JavaScript or CSS file. The greatest benefit is that compression reduces the amount of data transmitted over the network, thereby increasing the access speed of the client browser. Of course, but also increase the burden a little bit server. Gzip is a relatively common form of HTTP compression algorithm.

 

Five, IIS is initialized (preloaded), solve (after recycling) first visit to Slow

Reference: https://www.cnblogs.com/teamblog/p/6195078.html

 

After setting, when it will automatically initialized?

(Such as initialization execution Global.Application_Start initialization function)

1) will - launch the application pool, application pool recycling, cmd-> iisreset (w3wp of PID becomes)

2) does not - Site restart (IIS site right> Manage site> Restart), the site started

3) not - due to the application pool recycling web.config changes

IIS10 version is tested on the above behavior. Also use is the same behavior on someone IIS8.5, refer to the article .

 

Step one, install IIS application initialization function

 

Step two, is provided on the startup mode IIS application pool

General> startup mode

Default value: OnDemand (demand mode of operation), while the value of AlwaysRuning (always running mode)

Optimization settings: change AlwaysRunning (always running)

Step three, set up the site preload

Right Site> Site Management> Advanced Settings in the IIS, the pre-load enabled [] set to true.

 

Step four, configure the site web.config, add the site after the restart pre-load the requested page

 

 

 

eg: Address: http: //webdemo.com/home/about

 

After this operation save, IIS will modify the web.config add the following

01
02
03
04
05
06
< system.webServer >
     ……
     < applicationInitialization  doAppInitAfterRestart="true">
         < add  initializationPage="home/about" hostName="" />
     </ applicationInitialization >
</ system.webServer >

If only the initialization (such as initialization function is executed only Global.Application_Start), does not require additional resources to access specific initialization API, there is no need <add initializationPage = "**" /> subnode

 

Sixth, concurrency

General> queue length

HTTP.sys the maximum number of requests for the application pool queue. The default value 1000, maximum 65535.

If the setting is too large will consume large amounts of system resources, and the setting is too small will lead to frequent "503 Service Unavailable" response when client access.

Optimization settings: You can first read 5000 (set to the expected number of concurrent users up to 1.5 times the official reference

Performance Monitoring using windows (Performance Monitoring: cmd-> perfmon.msc), add "HTTP Service Request Queues / CurrentQueueSize" indicator, the number of observed an application pool current request queue.

Enable Web garden (Web Garden), the process model> Maximum number of worker processes

In the garden you can configure the Web application pool used by the maximum number of work processes, the default is 1 and the maximum can be set 4000000; configured to use multiple worker processes can improve the performance of the application pool to process the request of the application, but set before you can use multiple worker processes, consider the following points: 

1, each worker process consumes system resources and CPU utilization; too much work process will lead to a sharp depletion of system resources and CPU utilization; 

2, each worker process has its own state data, if the Web application depends on the worker process to save state data, it may not support the use of multiple worker processes. 

This setting, increasing the number of treatment processes, the equivalent of a cluster to avoid a large number of requests in a queue state

reference:

IIS concurrent optimization

This paper introduces: Using windows performance monitoring: cmd-> perfmon.msc. IIS application monitoring operation, then iis parameter settings as needed
Web Service / Current Connections monitor an application pool to indicate the number of current connections to the application pool.
ASP.NET Apps v4.0.30319 / Requests Executing monitor the number of requests for all ASP.Net 4.0 being processed.
ASP.NET v4.0.30319 / Requests Current similar to the above is used to monitor the number of requests being processed Asp.Net 4.0.
HTTP Service Request Queues / CurrentQueueSize an application used to monitor the number of requests in the queue the current pool.

Adjust the number of concurrent requests

The default number of concurrent requests to support: 5000

This exceeded the number of concurrent, an exception will be reported

HTTP Error 503.2 - Service Unavailable

The serverRuntime@appConcurrentRequestLimit setting is being exceeded.

reference:

    How concurrent request IIS settings?

Sites maximum number of concurrent connections

Right Site> Advanced Settings> Restrictions> The maximum number of concurrent connections

 

Number of threads site: minWorkerThreads, maxWorkerThreads, maxIoThreads

(Sense Xieyuan You  @ runliuv  new posture provided)

maxWorkerThreads default 20, maxIoThreads default 20, minWorkerThreads default 1, minIoThreads default 1 (eg: 8 core, the default is respectively 160, 160, 8, 8)

1, the configuration file: C: \ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \ Config \ machine.config

2、修改参数: <processModel autoConfig="false" maxWorkerThreads="100" maxIoThreads="100" minWorkerThreads="50" minIoThreads="50" />

其中:minWorkerThreads = maxWorkerThreads / 2   ;   minIoThreads = maxIoThreads / 2 

How specific parameter value, but also for each site to adjust the pressure test

reference:

        Garden blog "Black 30 seconds" event

                Investigation "Black 30 seconds" question - why requests are queued

                [Solve] a new analysis of the "black 30 seconds" issue from the perspective of ASP.NET thread

IIS7.5 Optimization - increase the number of threads to accommodate high concurrency

processModel Element (ASP.NET Settings Schema)

ASP.NET Performance Improving     (Microsoft document gives the recommended values, as shown below)

 

 

7, security

Specify the application pool (worker process isolation mode) for different work processes

There are many Web sites on a single server. How can I do between the various sites independent of each other, not because of some Web site fails to affect the other sites do -? Specified for different work processes in an application pool is a good solution.

Process model> tag, use virtual account ApplicationPoolIdentity

ApplicationPoolIdentity - By default, select the "application pool identity" account. Dynamically created "application pool identity" when you start the application pool account, therefore, this account for your application is the most secure. (In this way, each has its own application pool account, avoiding the Trojans uploaded to the site where the next pool, the pool will have another folder has operating authority)

reference:

   IIS7.5 in mysterious ApplicationPoolIdentity

Enable rapid-fail protection

 

If the Web application code written in question, it may cause a problem persists worker process. By default, the application pool configured to enable the rapid-fail protection, when the number of failed worker process occurs in (the default is five minutes) in the configured period of time than the configured value (the default is five times), then disable the application pool .

 

===========================================================

  over, thank access, you harvest that article, I would like him to help recommend. Welcome to provide better data and information.

 

 

Guess you like

Origin www.cnblogs.com/jinanxiaolaohu/p/10944548.html