<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                **一.Nginx進程與線程模式:** 1.進程線程模式:主進程->多Worker工作進程(Cpu核數)->單線程(默認) 2.內存消耗極低 **二.Linux下高并發打開文件數:** 1.查看 ~~~ ulimit -n 1024 ~~~ 2.設置 ~~~ vi /etc/security/limits.conf * soft nofile 65535 * hard nofile 65535 ~~~ 3.重啟生效 ~~~ init 6 ~~~ **三.Nginx配置參考:** 1.worker\_processes 2; nginx運行工作進程個數,一般設置cpu的核心, ~~~ 如:worker_processes 2。 cat /proc/cpuinfo |grep processor命令可查看核數 ~~~ 2.worker\_cpu\_affinity 0001 0010; 運行CPU親和力,與worker\_processes對應,如:`worker_cpu_affinity 0001 0010`。 3.worker\_rlimit\_nofile 65535; Nginx最多可以打開文件數,與ulimit -n保持一致,如:`worker_rlimit_nofile 65535`。 4.events 事件處理模型。 5.use epoll; epoll是linux2.6內核的一個新的系統調用,epoll在設計之初,就是為了替代select, poll線性復雜度的模型,nginx采用邊沿觸發。 6.worker\_connections 65535; 是單個worker進程允許客戶端最大連接數,這個數值一般根據服務器性能和內存來制定,實際最大值就是worker進程數乘以work\_connections,實際我們填入一個65535,足夠了。 7.keepalived\_timeout 60; 客戶端連接保持會話超時時間,超過這個時間,服務器斷開這個鏈接。 8.keepalive\_requests 10240; 參數限制了一個HTTP長連接最多可以處理完成的最大請求數, 默認是100。當連接處理完成的請求數達到最大請求數后,將關閉連接。 **四.Stub\_status測試** 1.開啟Stub\_status模塊: ~~~ /usr/local/nginx/sbin/nginx -V ~~~ 有`--with-http_stub_status_module`說明已經開啟該模塊 2.Stub\_status模塊使用: ~~~ location /status { stub_status; } ~~~ 3.結果分析: 1).Active connections: 2 ~~~ The current number of active client connections including Waiting connections. ~~~ 當前活躍連接數。 2)server accepts handled requests 131 131 397 ~~~ accepts(The total number of accepted client connections) ~~~ 接受的客戶端連接的總數。 ~~~ handled(The total number of handled connections) ~~~ 處理的連接總數。 ~~~ requests(The total number of client requests) ~~~ 客戶端請求的總數。 4.Reading: 0 Writing: 1 Waiting: 1 ~~~ Reading:The current number of connections where nginx is reading the request header. ~~~ nginx正在讀取請求頭的當前連接數。 ~~~ Writing:The current number of connections where nginx is writing the response back to the client. ~~~ nginx將響應寫回客戶端的當前連接數。 ~~~ Waiting:The current number of idle client connections waiting for a request. ~~~ 等待請求的當前空閑客戶端連接數。 4.ab壓力測試 ~~~ #cmder,ab在win下上限是20000 ab -n10 -c10 http://bbs.linux.com/index.html ab -n1000 -c1000 http://bbs.linux.com/index.html ab -n10000 -c10000 http://bbs.linux.com/index.html ~~~ ###
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看