一个优化的HTTP服务器/库实现:H2O

jopen 10年前

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.open-open.com/lib/view/home/1411176460609