wrk - 一個HTTP基準(zhǔn)測試工具

wrk是一款現(xiàn)代HTTP基準(zhǔn)測試工具,能夠在單個多核CPU上運(yùn)行時產(chǎn)生顯著負(fù)載。它將多線程設(shè)計與可擴(kuò)展事件通知系統(tǒng)(如epoll和kqueue)結(jié)合在一起。

基本用法

使用12個線程運(yùn)行30秒的基準(zhǔn)測試,并保持400個HTTP連接處于打開狀態(tài)

wrk -t12 -c400 -d30s http://127.0.0.1:8080/index.html

輸出

Running 30s test @ http://127.0.0.1:8080/index.html
  12 threads and 400 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   635.91us    0.89ms  12.92ms   93.69%
    Req/Sec    56.20k     8.07k   62.00k    86.54%
  22464657 requests in 30.00s, 17.76GB read
Requests/sec: 748868.53
Transfer/sec:    606.33MB

測試Swoole對laravel5.5的加速個例

brew install wrk   // 沒有命令需安裝
wrk -t4 -c100  http://live.com   or   http://127.0.0.1:9501/

帶有FPM的Nginx

Running 10s test @ http://live.com
  4 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     1.14s   191.03ms   1.40s    90.31%
    Req/Sec    22.65     10.65    50.00     65.31%
  815 requests in 10.07s, 223.65KB read
Requests/sec:     80.93
Transfer/sec:     22.21KB

Swoole HTTP服務(wù)器

Running 10s test @ http://127.0.0.1:9501
  4 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    11.58ms    4.74ms  68.73ms   81.63%
    Req/Sec     2.19k   357.43     2.90k    69.50%
  87879 requests in 10.08s, 15.67MB read
Requests/sec:   8717.00
Transfer/sec:      1.55MB
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容