<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>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # PHP7+Swoole/Nginx/Golang性能對比 [TOC] ## QPS對比 使用apache bench工具對Nginx靜態頁、Golang Http程序、PHP7+Swoole Http程序進行壓力測試。在同一臺機器上,進行并發100共100萬次Http請求的基準測試中,QPS對比如下: | 軟件 | QPS | 軟件版本 | | --- | --- | --- | | Nginx | 164489.92 | nginx/1.4.6 (Ubuntu) | | Golang | 166838.68 | go version go1.5.2 linux/amd64 | | PHP7+Swoole | 287104.12 | swoole-1.7.22-alpha | | Nginx-1.9.9 | 245058.70 | nginx/1.9.9 | > 注:Nginx-1.9.9的測試中,已關閉access\_log,啟用open\_file\_cache緩存靜態文件到內存 * [更詳細的測試細節](http://php.swoole.com/wiki/PHP7%2BSwoole%E6%AF%94Nginx/Golang%E6%80%A7%E8%83%BD%E9%AB%9875%25) * [歷史測試數據:Nginx/Golang/Swoole/Node.js的性能對比](Nginx-Golang-Swoole-Node.js的性能對比.md) ## 測試環境 * CPU:Intel? Core? i5-4590 CPU @ 3.30GHz × 4 * 內存:16G * 磁盤:128G SSD * 操作系統:Ubuntu14.04 (Linux 3.16.0-55-generic) ## 壓測工具 ab -c 100 -n 1000000 -k http://127.0.0.1:8080/ ##### VHOST配置 ~~~ server { listen 80 default_server; root /data/webroot; index index.html; } ~~~ ##### 測試頁面 ~~~ <h1>Hello World!</h1> ~~~ ##### 進程數量 Nginx開啟了4個Worker進程 ~~~ htf@htf-All-Series:~/soft/php-7.0.0$ ps aux|grep nginx root 1221 0.0 0.0 86300 3304 ? Ss 12月07 0:00 nginx: master process /usr/sbin/nginx www-data 1222 0.0 0.0 87316 5440 ? S 12月07 0:44 nginx: worker process www-data 1223 0.0 0.0 87184 5388 ? S 12月07 0:36 nginx: worker process www-data 1224 0.0 0.0 87000 5520 ? S 12月07 0:40 nginx: worker process www-data 1225 0.0 0.0 87524 5516 ? S 12月07 0:45 nginx: worker process ~~~ ## Golang ##### 測試代碼 ~~~ package main import ( "log" "net/http" "runtime" ) func main() { runtime.GOMAXPROCS(runtime.NumCPU() - 1) http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { w.Header().Add("Last-Modified", "Thu, 18 Jun 2015 10:24:27 GMT") w.Header().Add("Accept-Ranges", "bytes") w.Header().Add("E-Tag", "55829c5b-17") w.Header().Add("Server", "golang-http-server") w.Write([]byte("<h1>\nHello world!\n</h1>\n")) }) log.Printf("Go http Server listen on :8080") log.Fatal(http.ListenAndServe(":8080", nil)) } ~~~ ## PHP7+Swoole PHP7已啟用`OpCache`加速器。 ##### PHP版本 ~~~ htf@htf-All-Series:~/soft/php-7.0.0$ php -v PHP 7.0.0 (cli) (built: Dec 10 2015 14:36:26) ( NTS ) Copyright (c) 1997-2015 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies ~~~ ##### 測試代碼 ~~~ $http = new swoole_http_server("127.0.0.1", 9501, SWOOLE_BASE); $http->set([ 'worker_num' => 4, ]); $http->on('request', function ($request, swoole_http_response $response) { $response->header('Last-Modified', 'Thu, 18 Jun 2015 10:24:27 GMT'); $response->header('E-Tag', '55829c5b-17'); $response->header('Accept-Ranges', 'bytes'); $response->end("<h1>\nHello Swoole.\n</h1>"); }); $http->start(); ~~~
                  <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>

                              哎呀哎呀视频在线观看