[Pin to top] multi-Working Process settings and session sharing in the IIS application pool

Source: Internet
Author: User

When tuning IIS, I would like to share with you a great setup step. Thank you for sharing it with me.

 

IISApplicationProgramMulti-Worker Process settings andSessionShare

1 Overview

MicrosoftIISAsWindowsPlatformASP. NETDefault website publishingWebThe server provides high flexibility and scalability in terms of performance. By setting the number of worker processes in the application pool, the server can support tens to tens of thousands of concurrent accesses. This document provides operation instructions for the corresponding setup process and describes the precautions during the setup process.

2. Application pool multi-Worker Process settings

Based on past experiencePC-SERVERHost (XeonE5645 @ 2.4 GHz,6Core12Thread,32GMemory), a single worker process in each application pool can withstand approximately30-50Concurrency.IISUnable to respond, or the response time is obviously longer. The maximum number of working processes in the application pool can be reasonably set to significantly improveIISThe ability to cope with high concurrency reduces website response time.

2.1 setup steps

1. Find the application pool corresponding to the website to be set, as shown in Figure 1:

 

Figure 1 locate the application pool

2. Right-click the selected application pool and choose advanced settings, as shown in figure 2:

 

Figure 2 Advanced Settings

3. In the advanced settings window that appears, locate the maximum number of working processes and set it to a reasonable value, as shown in Figure 3:

 

Figure 3 set the maximum number of worker Processes

4. Click OK to save the settings.

2.2 precautions

1. Set the maximum number of worker Processes

When determining the maximum number of worker processes in each application pool, the most important reference data includes the maximum number of concurrent users of the website andWebThe number of available memory of the server. The maximum number of concurrent users must be observed for a period of time to record the maximum number of concurrent users when the system is busy.30To determine the maximum number of worker processes in the application pool. Note that each worker process occupies approximately200 mWhen setting the maximum number of worker processes, the maximum number of worker processes and200 mThe product must not exceed the maximum number of available memory. Generally, we recommend that you add5The maximum number of worker processes is adjusted. After the adjustment, observe the website for a period of time. If the requirements still cannot be met, continue to increase.5Number of worker processes.

2. SessionSharing Problems

If the website is not usedSessionThis issue will not occur. IfSessionTo store values and data, you must considerSessionShare to preventSessionLoss issues. For solutions to this problem, seeSessionSharing settings.

3. Reasonable Resource Recovery Mechanism

Most application systems have high work time usage and low non-work time usage. In this case, operating system resources should be reasonably released when the system is not busy. Therefore, the [Restriction timeout] and [recycle interval] attributes of the application pool should be reasonably set.

3 ASP. NET Of Session Sharing settings

ASP. NETProvides the following typesSessionStorage mechanism, suchTable 1:

Table 1 sessionSave Method

Method Name

Storage Method

Performance

Off

Set to not useSessionFunction

None

Inproc

SetSessionStored in the process, that isASPThe storage method in. This is the default value.

Highest

StateServer

SetSessionStored in independent status services. NormallyAspnet_state.exeProcess

Performance Loss10-15%

Sqlserver

SetSessionStored inSQL Server.

Performance Loss10-20%

Custom

Custom Storage Solution

Determined by the implementation method

in Asp . Web. config in the configuration file, session . If no session inproc Save, that is, session it is saved by the working process that provides services.

To improveIISWith support for high concurrency, you can increase the number of worker processes in the application pool,IISBased on built-in SchedulingAlgorithmThe user requests are dynamically allocated among multiple worker processes. If a server cluster and Server Load balancer are set up, the user requests are dynamically allocated among multiple worker processes on multiple machines. In the above case, ifSessionThe storage method is stillInproc, The user request may appear when switching between multiple working processes.SessionThe request fails or fails.

To solve the above problem, you need Session To share, that is In table 1, StateServer "," Sqlserver "Or" Custom . In these methods, Sqlserver Independent installation is required. Sqlserver Database," Custom You need to implement the corresponding Session The storage and retrieval processes are relatively complex to deploy. Compared with the preceding two methods, StateServer "This method is the best in terms of functionality and implementation. Therefore, we will focus on this Session Sharing Mechanism.

3.1 setup steps

1. OKStateServerServer. If only oneWebServer, you can specify the current serverStateServerServer. If multiple server clusters exist, you can specify a server in the cluster that meets the requirements of lighter serversStateServerServer.

2. Modify the Registry to allow remote accessStateServerService. You can directly import the following script.

 

The default port is42424, Which can be modified as needed.42424For example.

3. Open [management tools]-[SERVICE], find"ASP. NET State Service, right-click, and select Properties, as shown in Figure 4:

 

Figure 4 ASP. NET State Service

In the displayed Properties window, change "start mode" to "automatic", and click "start" to start the service, as shown in Figure 5:

 

Figure 5 start a service

4. OpenWeb. configConfiguration file, search for"<Sessionstate> "configuration node. If no configuration node exists, create a" <sessionstate> "configuration node under the" <system. Web> "node and modify the node attribute:
<Sessionstatus mode = "StateServer" stateconnectionstring = "TCPIP = 127.0.0.1: 42424"/>
The host after "TCPIP = *"IPThe address and port can be modified according to the actual situation. After modification, save the configuration file.

3.2 precautions

1. SessionThe custom object saved in must be marked as serializable[Serializable] ". If it is not displayed as serialized, an error is reported when accessing the page.

2. StateServerThe server must beWindows ServerOperating System, suchWindowsServer 2003 orWindowsServers 2008.

 

 

 

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.