hb:一個簡單的 http/web bench 工具

來源:互聯網
上載者:User

標籤:http   io   ar   os   使用   sp   for   檔案   資料   

兩周沒寫東西了,主要是在學習一點C,參考 webbench 寫了個工具。剛剛寫完,也不知道好不好用,同學們有興趣也幫我測一測,提點意見。

項目位於 https://github.com/heiing/hb

複製下來後,使用 make 編譯即可。

./hb [OPTIONS] URLOPTIONS:  -h | --help                  Print this information and exit.  -v | --version               Display program version and exit.  -c | --clients <n>           Run <n> clients, default one.  -t | --time <second>         Run <second> seconds, default 30.   -m | --method <n>            Use HTTP method, default GET:                                  GET,POST,PUT,DELETE,HEAD,TRACE,PATCH                                  PROPFIND,COPY,MOVE  -p | --protocol <n>          Use HTTP protocol, default 2:\n"                                            0 - HTTP/0.9                                 1 - HTTP/1.0                                 2 - HTTP/1.1  -f | --file <path>           Use file for POST/PUT method.   -P | --proxy <server:port>   Use proxy for request.

樣本:

./hb -m POST -f postdata.txt http://example.com/foo


可以通過 -f 參數指定請求的資料,資料檔案為 http 協議格式,使用一個空行分隔 head 和 body。不需要頭部時,以一個空行開始。例如:
name=hb&version=0.0.1


包含頭部的樣本:
User-Agent: my agent 1.0Content-Type: application/x-www-form-urlencodedCookie: PHPSESSID=1234567890123456name=hb&version=0.0.1


當程式運行結束後,按響應碼統計請求數。


hb:一個簡單的 http/web bench 工具

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.