nginx test

WBOY
WBOYOriginal
2016-07-29 09:15:581350browse

Key points

disable access log

output from 220MBps to 350MBps

with tcp_nodelay and tcp_nopush

output from 350MBps to 375 MBps

after open open_file_cache max

out put from 375 MBps to 880MBps

Write link content here

24C Easily hit 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>

Copyright Statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.

The above introduces the nginx test, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn