歡迎您光臨本站 註冊首頁

關於 Nginx 併發連接數

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

關於 Nginx 併發連接數

最近在學習使用 nginx , 做一些簡單的壓力測試時,發現併發連接數最大隻能上到 100 多

測試剛開始時的狀態 ,netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S}'
CLOSE_WAIT 2
ESTABLISHED 133
SYN_RECV 39然後  SYN_RECV   狀態的連接 一直上升netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S}'
CLOSE_WAIT 2
ESTABLISHED 133
SYN_RECV 124就一直持續到 測試完了。  

以下是我的配置
worker_processes  10;
worker_rlimit_nofile 51200;
daemon on;
master_process  off;
error_log  /home/test/apps/nginx/logs/nginx-error.log debug;
pid /tmp/nginx_demo.pid;
events {
    worker_connections  51200;
}
http {
    include       /home/test/apps/nginx/conf/mime.types;
    sendfile        on;
    keepalive_timeout  65;
    tcp_nodelay        on;
    server {
        listen   8100;
        server_name  localhost;
        access_log  /home/test/apps/nginx/logs/access.log;
        error_log   /home/test/apps/nginx/logs/error.log debug;
        location /lottery_image {
            lig "Hi,this is a demo module";
        }
    }
}
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~        這個配置參考了網上的教程。

請問有哪裡設置得不對嗎?  煩請指教。
《解決方案》

沒看出配置有問題。

你的機器啥配置啊
《解決方案》

兩顆  model name        : Intel(R) Xeon(R) CPU           E5504  @ 2.00GHz

32G 內存
《解決方案》

your problem is not concerned with your hardware of computer.try to do the following.

first check whether there is tcp limit  on your system.

second check your access warn or error log of nginx.
《解決方案》

今天 照著   這篇  << nginx 優化(突破十萬併發) >>
http://www.zhlinux.com/190/

做了不少參數 修改,  可以最後 連接 數  還是上不去,netstat -n |awk '/^tcp/ {++S[$NF] } END {for(a in S) print a, S}'
TIME_WAIT 2
CLOSE_WAIT 2
ESTABLISHED 133
SYN_RECV 5
另外,   這個 nginx 我是用來 測試 我寫的 nginx module 的性能的,  並沒有直接 連資料庫, 也沒有 跑 php

[火星人 ] 關於 Nginx 併發連接數已經有387次圍觀

http://coctec.com/docs/service/show-post-17678.html