Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

An example Analysis of the connection number limit of nginx Speed limit

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article is to share with you the content of an example analysis of the connection number limit of nginx speed limit. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Scene:

Company A has 100 people, and Company A has only one public network IP. Suppose Company A may have 100 people downloading your website files at the same time.

However, your connection limit is configured as follows:

Limit_conn_zone $binary_remote_addr zone=perip:1m;server {- limit_conn perip 1; limit_rate 1024k; -}

The number of single connections is allowed, and the maximum bandwidth of a single connection is 1m.

In this way, 99 people will have a request status of 503, and others will have to wait manually if they want to download (nginx will not inform users that A has finished downloading, it is your B user's turn to download). This results in a very poor user experience. But the advantage is also obvious, the bandwidth will come down soon.

Someone may be about to ask, do you want to cause trouble by limiting the number of connections to a very low number of connections? NO, absolutely not. What is the situation of the first 100 people downloading the site's resources at the same time? No statistics have been made, but it is highly unlikely. And the front-end page and download resources do not share the same domain name, so it will not affect the front-end page access.

So who is using the number of connections a lot? There are two categories:

Download the tool class (Thunderbolt).

All kinds of collection procedures.

Perform multiple download tasks at the same time.

Xiaoming was watching TV happily, glanced at the frequency screen on the left, grabbed the grass, and the bandwidth was full again. Come on, speed limit.

Limit_conn_zone $binary_remote_addr zone=perip:1m;server {- limit_rate 1024k; -}

Xiao Ming did the above speed limit, OK, I will tell you who is limited, of course, is the browser download users, 360 browser downloaders may not be able to limit, OK, let's calculate the speed.

Browser: 2014K

Downloader: 1024 * 15 (maximum connections) * VIP

Collector: 1024 * number of connections

So we come to the following conclusion:

Limited bandwidth, the same IP downloads at the same time is very small, or predictable business, try to limit the number of connections a little bit.

On the contrary, don't limit it. Reduce the bandwidth of a single connection! You know, who doesn't use the browser to download it with its own downloader?

Note: this paper only discusses the speed limit of nginx speed limit module under different services.

Colored eggs: occasionally found that the number of connections will be limited to 1 Thunderbolt can not be downloaded at high speed.

Thank you for reading! On the "nginx speed limit connection limit example analysis" this article shares here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report