首頁 >後端開發 >php教程 >nginx 測驗

nginx 測驗

WBOY
WBOY原創
2016-07-29 09:15:581351瀏覽

重點

disable access log

output from 220MBps to 350MBps

with tcp_nodelay and tcp_nopush

output from 350MB 375750_pache

output from 375 MBps to 880MBps

這裡寫連結內容

24C 輕鬆打到22W

<code><span># 配置</span><span>#user  nobody;</span>
worker_processes  <span>24</span>;

<span>#error_log  logs/<span>error</span>.log;</span><span>#error_log  logs/<span>error</span>.log  notice;</span><span>#error_log  logs/<span>error</span>.log  info;</span><span>#pid        logs/nginx.pid;</span>events {
    worker_connections  <span>65536</span>;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    <span>#log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '</span><span>#                  '$status $body_bytes_sent "$http_referer" '</span><span>#                  '"$http_user_agent" "$http_x_forwarded_for"';</span><span>#access_log  logs/access.log  main;</span>    sendfile        on;
    <span>#tcp_nopush     on;</span><span>#keepalive_timeout  0;</span>
    keepalive_timeout  <span>65</span>;

    <span>#gzip  on;</span>    server {
        listen       <span>80</span>;
        server_name  localhost;

        <span>#charset koi8-r;</span><span>#access_log  logs/host.access.log  main;</span>        location / {
            root   html;
            index  index.html index.htm;
        }

        <span>#error_page  404              /404.html;</span><span># redirect server <span>error</span> pages to the static page /50x.html</span><span>#</span>
        error_page   <span>500</span><span>502</span><span>503</span><span>504</span>  /<span>50</span>x.html;
        location = /<span>50</span>x.html {
            root   html;
        }

        <span># proxy the PHP scripts to Apache listening on 127.0.0.1:80</span><span>#</span><span>#location ~ \.php$ {</span><span>#    proxy_pass   http://127.0.0.1;</span><span>#}</span><span># pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000</span><span>#</span><span>#location ~ \.php$ {</span><span>#    root           html;</span><span>#    fastcgi_pass   127.0.0.1:9000;</span><span>#    fastcgi_index  index.php;</span><span>#    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;</span><span>#    include        fastcgi_params;</span><span>#}</span><span># deny access to .htaccess files, <span>if</span> Apache's document root</span><span># concurs with nginx's one</span><span>#</span><span>#location ~ /\.ht {</span><span>#    deny  all;</span><span>#}</span>
    }


    <span># another virtual host using mix of IP-, name-, and port-based configuration</span><span>#</span><span>#server {</span><span>#    listen       8000;</span><span>#    listen       somename:8080;</span><span>#    server_name  somename  alias  another.alias;</span><span>#    location / {</span><span>#        root   html;</span><span>#        index  index.html index.htm;</span><span>#    }</span><span>#}</span><span># HTTPS server</span><span>#</span><span>#server {</span><span>#    listen       443 ssl;</span><span>#    server_name  localhost;</span><span>#    ssl_certificate      cert.pem;</span><span>#    ssl_certificate_key  cert.key;</span><span>#    ssl_session_cache    shared:SSL:1m;</span><span>#    ssl_session_timeout  5m;</span><span>#    ssl_ciphers  HIGH:!aNULL:!MD5;</span><span>#    ssl_prefer_server_ciphers  on;</span><span>#    location / {</span><span>#        root   html;</span><span>#        index  index.html index.htm;</span><span>#    }</span><span>#}</span>}
</code>
<code><span># wrk -t 24 -c 100 -d 30s http://10.149.14.66/</span>
Running <span>30</span>s test @ <span>http</span>://<span>10.149</span><span>.14</span><span>.66</span>/
  <span>24</span> threads <span>and</span><span>100</span> connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     <span>1.51</span>ms    <span>6.52</span>ms <span>160.43</span>ms   <span>97.95</span>%
    Req/Sec     <span>9.24</span>k     <span>1.09</span>k   <span>13.17</span>k    <span>78.55</span>%
  <span>6632125</span> requests <span>in</span><span>30.10</span>s, <span>5.24</span>GB <span>read</span>
Requests/<span>sec</span>: <span>220336.89</span>
Transfer/<span>sec</span>:    <span>178.39</span>MB</code>

版權聲明:本文為博主原創文章,未經博主允許不得轉載。

以上就介紹了nginx 測試,包含了方面的內容,希望對PHP教學有興趣的朋友有幫助。

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn