IIS maximum number of connections and queue lengths

Source: Internet
Author: User


Recently, the server of the company project has a performance problem, about IIS load is too large, when the customer asked the maximum number of connections related issues caused a very cute feeling, looked up the relevant information:



First let's take a look at these 2 numbers in IIS: Maximum number of concurrent connections, queue length. Let's start by saying where these 2 numbers look.






Maximum concurrent connections: In IIS, select a Web site, right-click the site name, and in the context menu, locate and tap advanced settings, manage Web sites. Open a dialog box such as:









Queue Length: In IIS, select Application pool, in the list of application pools, right-click the "Advanced Settings" in the right-click menu. Open the following dialog box:









These two numbers appear to affect the concurrency of our site, but how does it affect the concurrency of a website? To fully understand the concurrency capabilities of IIS, there is actually a very critical number in addition to these 2 numbers: the maximum number of concurrent worker threads in IIS.





1. IIS maximum number of concurrent worker threads


For a long time before, I always thought that the maximum number of concurrent connections for IIS is the maximum concurrent worker threads that affect IIS. I think the maximum concurrent connections is set to 10,000, and when 10,000 requests come in at the same time, IIS turns on 10,000 threads for processing, and if there are 20,000 requests at the same time, because the maximum number of concurrent connections is only 10,000, the remaining 10,000 requests are placed in the queue. After one of the previous 10,000 threads has completed the request, a request is taken from the queue. However, this understanding is completely wrong, I believe many friends and I have the same understanding.






Now, let's start by understanding what is the "maximum number of concurrent worker threads for IIS". This number is not set in IIS, and I never knew it before. This number is related to the operating system, and the value of my win7 system for IIS is 10,vs2012 the value of the IIS Express is 80. The exact value of the Windows Server version of the system is not tested, but I guess there should be a limit.






What exactly does this number mean? Back to the example above, when 10,000 requests entered IIS at the same time, because the Win7 system IIS has only 10 worker threads, then only 10 requests in 10,000 requests will be processed at the first time, the remaining 9,990 requests should be queued. That is, IIS can schedule up to 10 threads to process requests simultaneously (Win7 version of IIS, some 20).






So, if you test the performance of IIS with your own win7 system, you may find that no matter how you set the maximum number of concurrent connections, your IIS processing power is limited.





2. Maximum number of concurrent connections


The maximum number of concurrent worker threads in IIS, which appears to be the concurrency of IIS, and if so, what is the meaning of "maximum concurrent connections"?






Or the above example, if 10,000 requests come at the same time, and the maximum number of IIS concurrent worker threads for our win7 system is only 10, what is the effect of setting the maximum concurrent connections to 100? The answer is: only 100 requests will receive a normal response, and the remaining 9,900 requests directly return 503 (Service Unavailable) error. At this point, there are actually only 90 requests queued for entry.






Again, if you set the maximum concurrent connections to 5000, what effect would you have if you changed the test parameters? You may already know the answer, that is, there are 5,000 requests in the beginning to return 503 directly, the remaining 5,000 requests slowly return normally.






Here you see, "Maximum number of concurrent connections" in our test example, the number of queues is affected. In that case, the "queue Length" doesn't seem to know what it means anymore?





3. Queue Length


In the above example, if 10,000 requests come at the same time, the maximum concurrent connections is set to 100. At this point, we know that IIS will first schedule the 10 threads to handle 10 requests, and the remaining 90 requests will need to be queued. What happens if we set the queue length to 50? The answer is that 40 requests will return a 503 Service Unavailable error (because the queue has only 50 lengths, the remaining 40 cannot be queued), and eventually only 60 requests will be processed correctly.






Read this, do you understand?





Conclusion


When many requests come at the same time, IIS will determine whether there are extra requests based on the "Maximum number of concurrent connections", the extra request returns 503 directly, and then according to the "Queue Length" to determine if there are any extra requests that cannot be queued, and return 503 directly to the team. So, how to set "Maximum concurrent connections" and "queue Length" is actually a formula that can be calculated:




Maximum concurrent connections = Queue Length + IIS maximum number of concurrent worker threads






Finally, the impact of IIS defaults on the concurrency of our website. The default maximum number of concurrent connections for IIS is 4294967295 (more than 4.2 billion), and the queue length default is 1000. For Windows Server versions of IIS, the maximum number of concurrent worker threads may be hundreds of (guess, there may be no limit), and by this default, IIS will handle more than 1000 requests at the same time. More than 1000 this number is the real concurrency capability of IIS, and this ability is not related to our code. So what are the criteria for judging the processing power of our website? Perhaps the most important indicator is the "processing requests per second" bar (which can be viewed in the Performance Analyzer), which is also called the throughput rate. If each request is processed very quickly, then the site throughput rate is large, and the throughput rate is large and the number of people online. If you want to do a second kill, it depends on your second kill the relevant URL to support how much throughput. Knowing so many metrics, there is no CPU computing power involved. How does the CPU's computing power affect the processing power of the website? Still so many requests, if the CPU is strong enough to reduce the processing time of each request, it is bound to increase throughput rate. There are many requests, if spend on the network transmission or to the database transfer time is more, this part of the waiting time CPU is idle, if can improve CPU utilization, also may improve the processing ability of the website, the most fully utilize the resources of the server. If you do not want to change the code and want to improve CPU utilization, you can set the maximum number of worker processes in the IIS application pool (the default is 1) and can be set to 10 if the current CPU utilization is only a few percent, adjust this value to pay special attention to each worker process is a standalone application, Global static variables are not shared.






Transferred from: http://www.th7.cn/web/html-css/201410/64084.shtml



IIS maximum number of connections and queue lengths


Alibaba Cloud Hot Products

Elastic Compute Service (ECS) Dedicated Host (DDH) ApsaraDB RDS for MySQL (RDS) ApsaraDB for PolarDB(PolarDB) AnalyticDB for PostgreSQL (ADB for PG)
AnalyticDB for MySQL(ADB for MySQL) Data Transmission Service (DTS) Server Load Balancer (SLB) Global Accelerator (GA) Cloud Enterprise Network (CEN)
Object Storage Service (OSS) Content Delivery Network (CDN) Short Message Service (SMS) Container Service for Kubernetes (ACK) Data Lake Analytics (DLA)

ApsaraDB for Redis (Redis)

ApsaraDB for MongoDB (MongoDB) NAT Gateway VPN Gateway Cloud Firewall
Anti-DDoS Web Application Firewall (WAF) Log Service DataWorks MaxCompute
Elastic MapReduce (EMR) Elasticsearch

Alibaba Cloud Free Trail

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.