libevent running on port 2001
libev running on port 2002
libuv running on port 2003
libhv running on port 2004
asio running on port 2005
poco running on port 2006
==============2001=====================================
[127.0.0.1:2001] 4 threads 1000 connections run 10s
total readcount=1616761 readbytes=1655563264
throughput = 157 MB/s
==============2002=====================================
[127.0.0.1:2002] 4 threads 1000 connections run 10s
total readcount=2153171 readbytes=2204847104
throughput = 210 MB/s
==============2003=====================================
[127.0.0.1:2003] 4 threads 1000 connections run 10s
total readcount=1599727 readbytes=1638120448
throughput = 156 MB/s
==============2004=====================================
[127.0.0.1:2004] 4 threads 1000 connections run 10s
total readcount=2202271 readbytes=2255125504
throughput = 215 MB/s
==============2005=====================================
[127.0.0.1:2005] 4 threads 1000 connections run 10s
total readcount=1354230 readbytes=1386731520
throughput = 132 MB/s
==============2006=====================================
[127.0.0.1:2006] 4 threads 1000 connections run 10s
total readcount=1699652 readbytes=1740443648
throughput = 165 MB/s
------------------------------------------------------------
[ 3] local 127.0.0.1 port 52560 connected with 127.0.0.1 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 20.8 GBytes 17.9 Gbits/sec
------------------------------------------------------------
[ 3] local 127.0.0.1 port 48142 connected with 127.0.0.1 port 1212
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 11.9 GBytes 10.2 Gbits/sec
English | 中文
libhv
Like
libevent, libev, and libuv
,libhv
provides event-loop with non-blocking IO and timer, but simpler api and richer protocols.✨ Features
⌛️ Build
see BUILD.md
Makefile:
or cmake:
or bazel:
or vcpkg:
or xmake:
⚡️ Getting Started
run
./getting_started.sh
:TCP
tcp server
c version: examples/tcp_echo_server.c
c++ version: evpp/TcpServer_test.cpp
tcp client
c version: examples/tcp_client_test.c
c++ version: evpp/TcpClient_test.cpp
HTTP
http server
see examples/http_server_test.cpp
golang gin style
http client
see examples/http_client_test.cpp
python requests style
WebSocket
WebSocket server
see examples/websocket_server_test.cpp
WebSocket client
see examples/websocket_client_test.cpp
🍭 More examples
c version
c++ version
simulate well-known command line tools
🥇 Benchmark
pingpong echo-servers
throughput:
iperf tcp_proxy_server
Bandwidth:
webbench
libhv(port:8080) vs nginx(port:80)
Above test results can be found on Github Actions.