新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Nginx限制并發(fā)連接數(shù)
Nginx (engine x) 是一個(gè)高性能的HTTP和反向代理web服務(wù)器,同時(shí)也提供了IMAP/POP3/SMTP服務(wù)。

模塊說明
模塊:nginx_http_limit_conn_module
模塊作用:限制每個(gè)key值的連接數(shù),特別是單個(gè)IP連接數(shù)。
不是所有的連接數(shù)都會被計(jì)算,一個(gè)符合要求的連接是整個(gè)請求已經(jīng)被讀取的連接。
Nginx并發(fā)連接數(shù)參數(shù)說明
limit_conn_zone參數(shù):
語法:limit_conn_zone key zone=name:size;
上下文:http
用于設(shè)置共享內(nèi)存區(qū)域,key可以是字符串,nginx自有變量或前兩個(gè)組合,如、server_name。name為內(nèi)存區(qū)域的名稱,size為內(nèi)存區(qū)域的大小。
limit_conn參數(shù):
語法:limit_conn zone number;
上下文:http、server、location
在客戶端使用Apache的ab測試工具進(jìn)行測試
linux下安裝ab測試工具
[root@localhost ~]# yum -y install httpd-tools
[root@localhost ~]# ab -V
使用ab 進(jìn)行測試
ab -c 10 -n 100 http://10.0.0.106/index.html
##語法:-c并發(fā)數(shù),-n請求數(shù),nginx服務(wù)器IP
[root@localhost ~]# ab -c 10 -n 100 http://10.0.0.106/index.html
This is ApacheBench, Version 2.3 $Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 10.0.0.106 (be patient).....done
Server Software: nginx
Server Hostname: 10.0.0.106
Server Port: 80
Document Path: /index.html
Document Length: 162 bytes
。。。。省略若干
Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 1
80% 1
90% 2
95% 3
98% 3
99% 3
100% 3 (longest request)
如何控制Nginx并發(fā)連接數(shù)如何控制Nginx并發(fā)連接數(shù)
分享題目:Nginx限制并發(fā)連接數(shù)
文章出自:http://www.dlmjj.cn/article/djijogh.html


咨詢
建站咨詢
