一個優化的HTTP服務器/庫實現:H2O

jopen 10年前發布 | 26K 次閱讀 H2O Web服務器

H2O 是一個優化過的 HTTP 服務器實現,可用于一個標準的獨立服務器或者是一個 HTTP 服務器開發包。

支持的協議有:

  • HTTP/1.0 (http and https)

  • HTTP/1.1 (http and https)

  • Websocket (RFC6455, both ws and wss)

  • HTTP/2.0 (draft 14, via Upgrade, NPN, ALPN)

依賴包:

  • OpenSSL (mandatory)
  • libyaml (optional; required when building the server)
  • libuv 1.0.0 (optional; required when using h2o as a library)
  • wslay (optional; required if you need support for websocket)

實際測試發現 H2O 的性能是 Nginx 的兩倍左右 (ab -c 500 -n 100000 -k)。

一個優化的HTTP服務器/庫實現:H2O

構建和運行服務器

運行下面的命令來編譯和運行的H2O服務器. The last command will read the configuration from examples/h2o.conf and start listening on port 8080. Try accessing http://127.0.0.1:8080/.

$ git submodule update --init --recursive
$ cmake .
$ make h2o
$ ./h2o -c examples/h2o.conf

構建該庫

$ git submodule update --init --recursive
$ cmake .
$ make libh2o

The library is designed to work together with the upcoming libuv version 1.0.0. Examples can be found within the examples/ directory.



 

項目主頁:http://www.baiduhome.net/lib/view/home/1411176460609

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!