1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
server { listen 80; server_name laravel.fengfeng.com; index index.php; root /home/wwwroot/laravel/public; if (!-e $request_filename) { rewrite ^(.*)$ /index.php last;break; } location ~ [^/]\.php(/|$) { try_files $uri =404; fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_index index.php; include fastcgi.conf; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } } |
1 2 3 4 5 6 7 8 9 10 11 |
server { listen 80; server_name swoole.fengfeng.com; location / { proxy_pass http://127.0.0.1:9501; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
ab -n 100 -c 100 http://swoole.fengfeng.com/ #请求后返回laravel默认的欢迎页面 #nginx反向代理->swoole_http_server每秒请求数明显比原生nginx->php-fpm高 #但是swoole_http_server有一定几率会报如下错误 [2016-08-24 17:54:25 *22191.0] ERROR swFactoryProcess_finish (ERROR 1004): send 902 byte failed, because session#1010 is closed. Server Software: nginx Server Hostname: swoole.fengfeng.com Server Port: 80 Document Path: / Document Length: 1023 bytes Concurrency Level: 100 Time taken for tests: 4.458 seconds Complete requests: 100 Failed requests: 0 Write errors: 0 Total transferred: 191736 bytes HTML transferred: 102300 bytes Requests per second: 22.43 [#/sec] (mean) Time per request: 4458.223 [ms] (mean) Time per request: 44.582 [ms] (mean, across all concurrent requests) Transfer rate: 42.00 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 7 1.0 7 9 Processing: 10 2256 1224.0 2186 4442 Waiting: 3 2256 1224.2 2186 4442 Total: 10 2263 1224.3 2192 4448 Percentage of the requests served within a certain time (ms) 50% 2192 66% 2261 75% 2301 80% 2322 90% 4410 95% 4431 98% 4444 99% 4448 100% 4448 (longest request) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
ab -n 100 -c 100 http://laravel.fengfeng.com/ Server Software: nginx Server Hostname: laravel.fengfeng.com Server Port: 80 Document Path: / Document Length: 1023 bytes Concurrency Level: 100 Time taken for tests: 34.714 seconds Complete requests: 100 Failed requests: 0 Write errors: 0 Total transferred: 201864 bytes HTML transferred: 102300 bytes Requests per second: 2.88 [#/sec] (mean) Time per request: 34713.635 [ms] (mean) Time per request: 347.136 [ms] (mean, across all concurrent requests) Transfer rate: 5.68 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 3 0.3 3 3 Processing: 440 19471 9261.3 23374 34271 Waiting: 439 19471 9261.4 23374 34271 Total: 441 19473 9261.3 23377 34274 Percentage of the requests served within a certain time (ms) 50% 23377 66% 24695 75% 27787 80% 29166 90% 31187 95% 31235 98% 31273 99% 34274 100% 34274 (longest request) |