In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to set nginx current limit". In daily operation, I believe many people have doubts about how to set nginx current limit. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubt of "how to set nginx current limit"! Next, please follow the editor to study!
1. Current-limiting nginx setting
Nginx current limiting use module upstream
Placed in http module # current limit concurrency
Upstream node {server 127.0.0.1:8080 max_conns=1;}
# if the request exceeds, 502 status code will be returned
Placed in the server module
# Test address. The py path of the access server will be forwarded to port 8080 of this machine.
Location / py {proxy_pass http://node/;}
# error redirect to degraded interface
Error_page 502 503 https://fund/b.html;
Note: if one is missing, the request will be forwarded to the / py path of 8080.
Proxy_pass http://node
Prepare the test environment
Open port 8080 and use web.py to open a simple port
Install web.py
Pip install web.py==0.40-dev1
Write website script webtest.py
Import weburls = ('/', 'index') class index: def GET (self): return "Hello, world!" if _ _ name__ = = "_ _ main__": app = web.application (urls, globals () app.run ()
Run script startup port python webtest.py 0.0.0.0 8080 launch port 8080 to allow any IP access
Third, test the current limit configuration
Testing with jmeter
1. Set the current limit to the number of concurrent connections 1
Request
Result
Concurrent requests 5, sent 100 times, a total of 500 requests, successful 367, failed 133
Concurrent request 10. 1000 requests were sent, with 566 successes and 434 failures
Concurrent request 20. A total of 2000 requests were sent, with success 848 and failure 1152
At this point, the study on "how to set nginx current limit" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.