Just a simple server-client socket performance test, to be used in a "bug report" for libkrun.
server.cxx: a simple echo serverclient.cxx: a simple benchmark client that connects to the server and sends packets, but will disconnect after sending a certain amount of packets and reconnect again, to simulate short-lived connections.
# build client on host
make client -j4
# build in a container
podman build . -t servertest
mkdir socket
podman run -it --rm -p 1111:1111 servertest 0.0.0.0:1111
# in another terminal
./client 127.0.0.1:1111
# ctrl+c to stop
Without TSI:
=== BENCHMARK RESULTS ===
Threads : 16
Time (Total) : 0.67 s
Connections : 1891
Conn. Rate : 2813 conn/s
--------------------------------
Sent Pkts : 103586
Recv Pkts : 103586
Loss Pkts : 0
Loss Rate : 0.000000 %
Matched : 103586
Success Rate : 100 %
--------------------------------
Tx QPS : 154142
Throughput : 75.26 MB/s
================================
podman --runtime=krun run -it --rm --network=host servertest 0.0.0.0:1111
# in another terminal
./client 127.0.0.1:1111
And press ctrl+c to stop, you will get:
=== BENCHMARK RESULTS ===
Threads : 16
Time (Total) : 5.01 s
Connections : 16
Conn. Rate : 3 conn/s
--------------------------------
Sent Pkts : 1037
Recv Pkts : 102
Loss Pkts : 935
Loss Rate : 90.163934 %
Matched : 102
Success Rate : 100 %
--------------------------------
Tx QPS : 206
Throughput : 0.10 MB/s
================================