Maximum number of iis connections and queue length, number of iis and queue length
Recently, performance problems have occurred on the servers of the company's project. When the customer asks the question about the maximum number of connections, the question about the excessive iis load is very cute. Then, he checked the relevant information:
First, let's take a look at the two numbers in IIS: Maximum number of concurrent connections and queue length. Let's talk about where the two numbers are.
Maximum number of concurrent connections: select a website in IIS, right-click the website name, right-click the website name, and choose Manage Website> advanced settings ]. The following dialog box is displayed:
Queue Length: Select application pool in IIS, right-click the application pool in the application pool list, and choose advanced settings from the context menu ]. Open the following dialog box:
On the surface, these two numbers affect the concurrent processing capability of our website. But how does it affect the concurrent processing capability of a website? To fully understand the concurrent processing capability of IIS, in addition to the two numbers, there is actually a very critical number: the maximum number of concurrent working threads in IIS.
1. Maximum number of concurrent working threads in IIS
For a long time, I always thought that the [maximum number of concurrent connections] of IIS would affect the maximum number of concurrent working threads of IIS. I thought to set [maximum number of concurrent connections] to 10 thousand. When 10 thousand requests arrive at the same time, IIS will enable 10 thousand threads for processing. If 20 thousand requests arrive at the same time, since the maximum number of concurrent connections is only 10 thousand, the remaining 10 thousand requests will be placed in the queue. One of the current 10 thousand threads completes the request and then retrieves a request from the queue. However, this understanding is completely wrong. I believe many of my friends have the same understanding as I have.
Now, let's first understand what is [maximum number of concurrent working threads in IIS ]. There is no interface for setting this number in IIS. I didn't know it before. This number is related to the operating system. The value of IIS In My win7 system is 10, and the value of IIS Express in VS2012 is 80. I have not tested the specific value of the windows Server version, but I guess there are limits.
What does this number mean? Return to the example above. When 10 thousand requests enter IIS at the same time, because IIS In win7 only has 10 working threads, at this time, only 10 of the 10 thousand requests will be processed immediately, and the remaining 9990 requests will be queued. That is to say, IIS can schedule up to 10 threads to simultaneously process requests (for IIS of win7 version, some may be 20 ).
Therefore, if you use your win7 system to test the performance of IIS, you may find that no matter how you set [maximum number of concurrent connections], your IIS processing capabilities are limited.
2. Maximum number of concurrent connections
The maximum number of concurrent working threads in IIS mentioned above seems to be the concurrent processing capability of IIS. If so, what is the significance of [maximum number of concurrent connections?
In the above example, if 10 thousand requests come at the same time, and the maximum number of concurrent working threads in IIS in our win7 system is only 10, then set [maximum number of concurrent connections] to 100, what will happen? The answer is: only 100 requests will receive a normal response, and the remaining 9900 requests will directly return the 503 (Service unavailable) error. In this case, only 90 requests are waiting in the queue.
Next, change the test parameter. If you set [maximum number of concurrent connections] to 5000, what will happen? You may already know the answer, that is, 5000 requests directly returned 503 at the beginning, and the remaining 5000 requests slowly returned normally.
Here you can see that [maximum number of concurrent connections] affects the number of queues in our test example. In this case, it seems that [queue length] does not know what it means?
3. Queue Length
In the preceding example, if 10 thousand requests arrive at the same time, set [maximum number of concurrent connections] to 100. At this time, we know that IIS will first arrange the 10 threads to process 10 requests, and the remaining 90 requests need to be queued. In this case, if we set [queue length] to 50, what will happen? The answer is: 40 requests will directly return the 503 service unavailable error (because the queue has only 50 requests, the remaining 40 will not be able to queue ), in the end, only 60 requests are processed correctly.
Do you understand this?
Conclusion
When many requests come at the same time, IIS will determine whether there are redundant requests based on [maximum number of concurrent connections]. If there are redundant requests, the system will directly return 503, then, based on the [queue length], determine whether redundant requests cannot be lined up. If there are no queues, 503 is returned. Therefore, the formula for setting the maximum number of concurrent connections and queue length can be calculated as follows:
Maximum number of concurrent connections = Queue Length + maximum number of concurrent working threads in IIS
Finally, let's talk about the impact of the default value of IIS on the concurrent processing capability of our website. The default [maximum number of concurrent connections] for IIS is 4294967295 (more than 4.2 billion), and the default [queue length] is 1000. For IIS of windows server, the maximum number of concurrent working threads may be several hundred (which may be unlimited). According to this default value, the number of requests simultaneously processed by IIS is more than 1000. More than 1000 of this number is the real concurrency processing capability of IIS, which has nothing to do with our code. Which indicators are used to judge the processing capability of our website? The most important indicator may be the number of requests processed per second (which can be viewed in the Performance Analyzer). This number is also called the throughput rate. If the processing speed of each request is very fast, the website throughput will be large, and the throughput will be large, so the number of concurrent online users will be large. If you want to perform a second kill, it depends on how much throughput your second kill-related URL supports. Having understood such a multi-index, it does not involve the computing power of the CPU. How does the computing power of the CPU affect the processing power of the website? If the CPU is very powerful and the processing time of each request can be reduced, the throughput will inevitably increase. There are still a lot of requests. if you spend a lot of time transmitting data over the network or to the database, the CPU is idle. If you can increase the CPU utilization, it may also improve the processing capability of the website and make full use of the server resources. If you do not want to change the code and want to increase the CPU usage, you can set the maximum number of working processes (1 by default) in the IIS application pool ), it can be set to 10. If the current CPU usage is only a few percent, you must note that each worker process is an independent application and Global static variables are not shared.
How do I set the maximum number of IIS connections?
We know that IIS allows up to 10 clients to connect to Windows 2000 Professional edition or Windows XP Professional Edition operating system. This connection restriction does not exist in Windows 2000 Server Edition or Windows 2003 Server Edition operating system.
Microsoft provides MetaEdit, a tool for managing IIS. MetaEdit works on Windows NT4.0 and Windows 2000. I found that MetaEdit works normally on Windows XP. In addition, metaEdit can only manage IIS of version II4.0, IIS5.0, or later.
The following uses this tool to break through the connection restrictions of the IIS client of Windows XP Professional Edition:
First, you need to download MetaEdit from the following address. The latest version is 2.2.
Download.microsoft.com/..22.exe
Then, execute mtaedt22.exe and follow the wizard prompts to complete MetaEdit installation.
After MetaEdit is installed, click MetaEdit 2.2 Under the Administrative Tools Program Group in the Start menu to run MetaEdit. Expand the tree to LM \ W3SVC on the left side of the window and click directly on the W3SVC folder, select the MaxConnections item in the list on the right. Double-click the item, and the default value is 10 in the last Data text box. This is the maximum number of client connections set by default in IIS for Windows XP Professional Edition, now you can change this default value. I will change it to 10000. Note: The maximum number of IIS client connections on Win2000 is 2000000000.
The above method is obtained from the Internet, and my own problem is solved based on the above method.
Maximum number of iis connections 10
Break through the ten-person restriction on IIS In the XP System
Microsoft provides MetaEdit, a tool for managing IIS. MetaEdit works on Windows NT4.0 and Windows 2000, and works normally on Windows XP,
In addition, MetaEdit can only manage IIS versions II4.0, IIS5.0, or later.
The following uses this tool to break through the connection restrictions of the IIS client of Windows XP Professional Edition:
First, you need to download MetaEdit from the following address. The latest version is 2.2.
Download.microsoft.com/..22.exe
Then, execute mtaedt22.exe and follow the wizard prompts to complete MetaEdit installation.
Finally, set the client connection limit parameter in MetaEdit.
After MetaEdit is installed, click MetaEdit 2.2 Under the Administrative Tools Program Group in the Start Menu. A window is displayed:
Expand the tree to LM \ W3SVC on the left side of the window, click the W3SVC folder, and select the MaxConnections item in the list on the right. After double-clicking, a dialog box is displayed:
In the last Data text box, the default value is 10, which is Windows XP Professional IIS.
The maximum number of client connections set by default. Now you can change this default value. I will change it to 1000,
Note: The maximum number of IIS client connections on Win2000 is 2000000000 <! -- Message body \ '"-->