Home > Web Front-end > HTML Tutorial > iis maximum number of connections and queue length_html/css_WEB-ITnose

iis maximum number of connections and queue length_html/css_WEB-ITnose

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-24 11:55:13
Original
1517 people have browsed it

Recently, the server of the company's project has had performance problems. Regarding the excessive load on iis, when the customer asked about the maximum number of connections, it made me feel very cute, so I checked the relevant information:

First, let us take a look at these two numbers in IIS: the maximum number of concurrent connections and the queue length. Let’s first talk about where to look at these two numbers.

Maximum number of concurrent connections: Select a website in IIS, right-click the website name, find and click [Manage Website]->[Advanced Settings] in the right-click menu. Open the dialog box as shown below:

Queue length: Select [Application Pool] in IIS, in the application pool list, right-click the one you want to view, Select [Advanced Settings] in the right-click menu. Open the following dialog box:

On the surface, these two numbers affect the concurrent processing capabilities of our site, but how do they specifically affect the concurrent processing of a website? What about ability? To fully understand the concurrent processing capabilities of IIS, in addition to these two numbers, there is actually a very critical number: the maximum number of concurrent worker threads in IIS.

1. The maximum number of concurrent working threads of IIS

For a long time in the past, I always thought that the [maximum number of concurrent connections] of IIS affected the maximum number of concurrent work of IIS Number of threads. I thought that if the [Maximum number of concurrent connections] is set to 10,000, then when 10,000 requests come at the same time, IIS will open 10,000 threads for processing. If 20,000 requests come at the same time, since the maximum number of concurrent connections is only 1 10,000, then the remaining 10,000 requests will be placed in the queue. After one of the previous 10,000 threads completes the request, another request will be taken from the queue. However, this understanding is completely wrong. I believe many friends have the same understanding as me.

Now, let us first understand what [IIS maximum number of concurrent worker threads] is. There is no interface to set this number in IIS. I didn't even know this number existed 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 that comes with VS2012 is 80. The specific value of the Windows server version of the system has not been tested, but I guess there should be limits.

What does this number mean? Going back to the example given above, when 10,000 requests enter IIS at the same time, since the IIS of the win7 system only has 10 working threads, only 10 of the 10,000 requests will be processed at the first time, leaving 9990 Each request needs to be queued. In other words, IIS can arrange up to 10 threads to process requests at the same time (win7 version of IIS, some may be 20).

So, if you use your win7 system to test the performance of IIS, you may find that no matter how you set the [Maximum Number of Concurrent Connections], your IIS processing capability is very low. limited.

2. Maximum number of concurrent connections

The maximum number of concurrent working threads of IIS mentioned above seems to be the concurrent processing capability of IIS. If so, then [Maximum What is the significance of [Number of concurrent connections]?

Still with the above example, if 10,000 requests arrive at the same time, and the maximum number of concurrent working threads of IIS in our win7 system is only 10, then if you change the [Maximum number of concurrent connections] What effect will it have if it is set to 100? The answer is: Only 100 requests will receive normal responses, and the remaining 9,900 requests will directly return 503 (service unavailable) errors. At this time, there are actually only 90 requests waiting in the queue.

Change the test parameters again. If the [Maximum number of concurrent connections] is set to 5000, what will be the effect? You may already know the answer, that is, 5000 requests will directly return 503 at the beginning, and the remaining 5000 requests will slowly return normally.

As you can see here, [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 above example, if 10,000 requests arrive at the same time, [Maximum number of concurrent connections] is set to 100. At this time we know that IIS will first arrange those 10 threads to process 10 requests, and the remaining 90 requests need to be queued. At this time, if we set [queue length] to 50, what will happen? The answer is that 40 requests will directly return a 503 service unavailable error (because the queue is only 50 long, and the remaining 40 cannot be queued), and in the end only 60 requests will be processed correctly.

After reading this, do you understand?

Conclusion

When many requests arrive at the same time, IIS will judge whether there are redundant requests based on the [maximum number of concurrent connections], and redundant requests will directly return 503 , and then use [Queue Length] to determine whether there are extra requests that cannot be queued. If they cannot be queued, 503 will be returned directly. Therefore, how to set the [Maximum Number of Concurrent Connections] and [Queue Length] can actually be calculated by formulas:

Maximum number of concurrent connections = Queue length Maximum number of concurrent worker threads in IIS

Finally, let’s talk about the impact of IIS’s default value on the concurrent processing capabilities of our website. The default [Maximum number of concurrent connections] of IIS is 4294967295 (more than 4.2 billion), and the default value of [Queue length] is 1000. For the windows server version of IIS, the maximum number of concurrent working threads may be several hundred (guess, there may be no limit). According to this default value, the number of requests that IIS can handle at the same time is only more than 1,000. The number of more than 1,000 is the real concurrent processing capability of IIS, and this capability has nothing to do with our code. So what indicators are used to judge the processing capabilities of our website? Perhaps the most important indicator is [number of requests processed per second] (you can view it in the performance analyzer). This number is also called throughput rate. If the processing speed of each request is very fast, then the website throughput rate will be high, and the high throughput rate will support a large number of people online at the same time. If you want to do a flash sale, it depends on how much throughput your flash sale-related URL supports. After understanding so many indicators, the computing power of the CPU has not yet been touched upon. How does the computing power of the CPU affect the processing power of the website? There are still so many requests. If the CPU is very powerful and can reduce the processing time of each request, it will inevitably increase the throughput rate. There are still a lot of requests. If a lot of time is spent on network transmission or transmission to the database, the CPU will be idle during this part of the waiting time. If the CPU utilization can be improved, the processing capacity of the website may also be improved and the server can be fully utilized. resources. If you don’t want to change the code but want to improve CPU utilization, you can set the maximum number of worker processes in the IIS application pool (the default value is 1), which can be set to 10. If the current CPU utilization is only a few percent, adjust this value It is important to note that each worker process is an independent application and global static variables are not shared.

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template