測試一下nginx+php-fpm和swoole http服務器性能對比

服務器vm虛擬機 1核1G

?環(huán)境 :nginx/1.13.8 ?+ ? ?php7.2.1 + mysql 5.7.2

環(huán)境 :swoole?2.0.12


這是nginx的默認html頁?3900?

ab -c 150 -n 100000 http://192.168.11.109/

This is ApacheBench, Version 2.3 <$Revision: 1748469 $>

Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/

Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.11.109 (be patient)

Server Software:? ? ? ? nginx/1.13.8

Server Hostname:? ? ? ? 192.168.11.109

Server Port:? ? ? ? ? ? 80

Document Path:? ? ? ? ? /

Document Length:? ? ? ? 612 bytes

Concurrency Level:? ? ? 150

Time taken for tests:? 25.640 seconds

Complete requests:? ? ? 100000

Failed requests:? ? ? ? 0

Total transferred:? ? ? 84500000 bytes

HTML transferred:? ? ? 61200000 bytes

Requests per second:? ? 3900.15 [#/sec] (mean)

Time per request:? ? ? 38.460 [ms] (mean)

Time per request:? ? ? 0.256 [ms] (mean, across all concurrent requests)

Transfer rate:? ? ? ? ? 3218.38 [Kbytes/sec] received

Connection Times (ms)

? ? ? ? ? ? ? min? mean[+/-sd] median? max

Connect:? ? ? ? 0? ? 4? 66.9? ? ? 0? ? 3069

Processing:? ? 5? 33? 50.4? ? 32? ? 7675

Waiting:? ? ? ? 5? 33? 50.4? ? 32? ? 7674

Total:? ? ? ? 12? 37? 88.0? ? 32? ? 7678

Percentage of the requests served within a certain time (ms)

? 50%? ? 32

? 66%? ? 32

? 75%? ? 33

? 80%? ? 33

? 90%? ? 34

? 95%? ? 36

? 98%? ? 44

? 99%? ? 50

?100%? 7678 (longest request)


php-fpm 原生?

?ab -c 150 -n 100000 http://192.168.11.109/hello.php

This is ApacheBench, Version 2.3 <$Revision: 1748469 $>

Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/

Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.11.109 (be patient)

Completed 10000 requests

Completed 20000 requests

Completed 30000 requests

Completed 40000 requests

Completed 50000 requests

Completed 60000 requests

Completed 70000 requests

Completed 80000 requests

Completed 90000 requests

Completed 100000 requests

Finished 100000 requests

Server Software:? ? ? ? nginx/1.13.8

Server Hostname:? ? ? ? 192.168.11.109

Server Port:? ? ? ? ? ? 80

Document Path:? ? ? ? ? /hello.php

Document Length:? ? ? ? 11 bytes

Concurrency Level:? ? ? 150

Time taken for tests:? 45.074 seconds

Complete requests:? ? ? 100000

Failed requests:? ? ? ? 0

Total transferred:? ? ? 17300000 bytes

HTML transferred:? ? ? 1100000 bytes

Requests per second:? ? 2218.58 [#/sec] (mean)

Time per request:? ? ? 67.611 [ms] (mean)

Time per request:? ? ? 0.451 [ms] (mean, across all concurrent requests)

Transfer rate:? ? ? ? ? 374.82 [Kbytes/sec] received

Connection Times (ms)

? ? ? ? ? ? ? min? mean[+/-sd] median? max

Connect:? ? ? ? 0? ? 0? 0.3? ? ? 0? ? ? 10

Processing:? ? 34? 66? 94.8? ? 59? ? 3082

Waiting:? ? ? 34? 66? 94.8? ? 59? ? 3082

Total:? ? ? ? 36? 66? 94.8? ? 60? ? 3082

Percentage of the requests served within a certain time (ms)

? 50%? ? 60

? 66%? ? 62

? 75%? ? 64

? 80%? ? 66

? 90%? ? 70

? 95%? ? 74

? 98%? ? 86

? 99%? ? 254

?100%? 3082 (longest request)


swoole 同步http輸出Hello word!

ab -c 150 -n 100000 http://192.168.11.109:9501/

This is ApacheBench, Version 2.3 <$Revision: 1748469 $>

Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/

Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.11.109 (be patient)

Completed 10000 requests

Completed 20000 requests

Completed 30000 requests

Completed 40000 requests

Completed 50000 requests

Completed 60000 requests

Completed 70000 requests

Completed 80000 requests

Completed 90000 requests

Completed 100000 requests

Finished 100000 requests

Server Software:? ? ? ? swoole-http-server

Server Hostname:? ? ? ? 192.168.11.109

Server Port:? ? ? ? ? ? 9501

Document Path:? ? ? ? ? /

Document Length:? ? ? ? 11 bytes

Concurrency Level:? ? ? 150

Time taken for tests:? 23.467 seconds

Complete requests:? ? ? 100000

Failed requests:? ? ? ? 0

Total transferred:? ? ? 15900000 bytes

HTML transferred:? ? ? 1100000 bytes

Requests per second:? ? 4261.30 [#/sec] (mean)

Time per request:? ? ? 35.201 [ms] (mean)

Time per request:? ? ? 0.235 [ms] (mean, across all concurrent requests)

Transfer rate:? ? ? ? ? 661.67 [Kbytes/sec] received

Connection Times (ms)

? ? ? ? ? ? ? min? mean[+/-sd] median? max

Connect:? ? ? ? 0? ? 1? 3.7? ? ? 0? ? 135

Processing:? ? 5? 35? 16.6? ? 32? ? 204

Waiting:? ? ? ? 4? 34? 16.6? ? 32? ? 204

Total:? ? ? ? ? 7? 35? 17.6? ? 32? ? 216

Percentage of the requests served within a certain time (ms)

? 50%? ? 32

? 66%? ? 35

? 75%? ? 40

? 80%? ? 41

? 90%? ? 44

? 95%? ? 46

? 98%? ? 50

? 99%? ? 121

?100%? ? 216 (longest request)

liuxuns-MacBook-Pro:~ liuxun$ ab -c 150 -n 100000 http://192.168.11.109:9501/

This is ApacheBench, Version 2.3 <$Revision: 1748469 $>

Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/

Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.11.109 (be patient)

Completed 10000 requests

Completed 20000 requests

Completed 30000 requests

Completed 40000 requests

Completed 50000 requests

Completed 60000 requests

Completed 70000 requests

Completed 80000 requests

Completed 90000 requests

Completed 100000 requests

Finished 100000 requests

Server Software:? ? ? ? swoole-http-server

Server Hostname:? ? ? ? 192.168.11.109

Server Port:? ? ? ? ? ? 9501

Document Path:? ? ? ? ? /

Document Length:? ? ? ? 11 bytes

Concurrency Level:? ? ? 150

Time taken for tests:? 23.927 seconds

Complete requests:? ? ? 100000

Failed requests:? ? ? ? 0

Total transferred:? ? ? 15900000 bytes

HTML transferred:? ? ? 1100000 bytes

Requests per second:? ? 4179.29 [#/sec] (mean)

Time per request:? ? ? 35.891 [ms] (mean)

Time per request:? ? ? 0.239 [ms] (mean, across all concurrent requests)

Transfer rate:? ? ? ? ? 648.93 [Kbytes/sec] received

Connection Times (ms)

? ? ? ? ? ? ? min? mean[+/-sd] median? max

Connect:? ? ? ? 0? ? 0? 3.5? ? ? 0? ? 107

Processing:? ? 4? 35? 19.5? ? 31? ? 207

Waiting:? ? ? ? 4? 35? 19.5? ? 31? ? 207

Total:? ? ? ? ? 6? 36? 20.5? ? 31? ? 218

Percentage of the requests served within a certain time (ms)

? 50%? ? 31

? 66%? ? 36

? 75%? ? 43

? 80%? ? 44

? 90%? ? 48

? 95%? ? 50

? 98%? ? 60

? 99%? ? 184

?100%? ? 218 (longest request)


因為swoole 是常駐內(nèi)存處理簡單的php 和nginx處理靜態(tài)html差不多?

但swoole cpu站用60%左右 ?nginx cpu占用80%左右。

下步測試一下 幾個php框架在nginx+php-fpm下的性能

最后編輯于
?著作權歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末妖异,一起剝皮案震驚了整個濱河市惋戏,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌他膳,老刑警劉巖,帶你破解...
    沈念sama閱讀 216,402評論 6 499
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件舔亭,死亡現(xiàn)場離奇詭異钦铺,居然都是意外死亡矛洞,警方通過查閱死者的電腦和手機沼本,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,377評論 3 392
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來辫红,“玉大人厉熟,你說我怎么就攤上這事揍瑟【钇” “怎么了底循?”我有些...
    開封第一講書人閱讀 162,483評論 0 353
  • 文/不壞的土叔 我叫張陵阁苞,是天一觀的道長那槽。 經(jīng)常有香客問我骚灸,道長甚牲,這世上最難降的妖魔是什么丈钙? 我笑而不...
    開封第一講書人閱讀 58,165評論 1 292
  • 正文 為了忘掉前任院尔,我火速辦了婚禮,結果婚禮上纵顾,老公的妹妹穿的比我還像新娘施逾。我一直安慰自己汉额,他們只是感情好蠕搜,可當我...
    茶點故事閱讀 67,176評論 6 388
  • 文/花漫 我一把揭開白布轨蛤。 她就那樣靜靜地躺著祥山,像睡著了一般缝呕。 火紅的嫁衣襯著肌膚如雪岳颇。 梳的紋絲不亂的頭發(fā)上颅湘,一...
    開封第一講書人閱讀 51,146評論 1 297
  • 那天瞻鹏,我揣著相機與錄音新博,去河邊找鬼赫悄。 笑死埂淮,一個胖子當著我的面吹牛倔撞,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播冕房,決...
    沈念sama閱讀 40,032評論 3 417
  • 文/蒼蘭香墨 我猛地睜開眼给僵,長吁一口氣:“原來是場噩夢啊……” “哼想际!你這毒婦竟也來了胡本?” 一聲冷哼從身側響起侧甫,我...
    開封第一講書人閱讀 38,896評論 0 274
  • 序言:老撾萬榮一對情侶失蹤咒锻,失蹤者是張志新(化名)和其女友劉穎惑艇,沒想到半個月后滨巴,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體恭取,經(jīng)...
    沈念sama閱讀 45,311評論 1 310
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,536評論 2 332
  • 正文 我和宋清朗相戀三年攒发,在試婚紗的時候發(fā)現(xiàn)自己被綠了烟阐。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 39,696評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖檀葛,靈堂內(nèi)的尸體忽然破棺而出空扎,到底是詐尸還是另有隱情,我是刑警寧澤盘寡,帶...
    沈念sama閱讀 35,413評論 5 343
  • 正文 年R本政府宣布,位于F島的核電站砌溺,受9級特大地震影響规伐,放射性物質(zhì)發(fā)生泄漏猖闪。R本人自食惡果不足惜岔留,卻給世界環(huán)境...
    茶點故事閱讀 41,008評論 3 325
  • 文/蒙蒙 一献联、第九天 我趴在偏房一處隱蔽的房頂上張望里逆。 院中可真熱鬧原押,春花似錦诸衔、人聲如沸笨农。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,659評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽伴箩。三九已至嗤谚,卻和暖如春怔蚌,著一層夾襖步出監(jiān)牢的瞬間桦踊,已是汗流浹背籍胯。 一陣腳步聲響...
    開封第一講書人閱讀 32,815評論 1 269
  • 我被黑心中介騙來泰國打工炼蛤, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留理朋,地道東北人嗽上。 一個月前我還...
    沈念sama閱讀 47,698評論 2 368
  • 正文 我出身青樓兽愤,卻偏偏與公主長得像浅萧,于是被迫代替她去往敵國和親惯殊。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 44,592評論 2 353

推薦閱讀更多精彩內(nèi)容