c410-f3r / wtx

A collection of different transport implementations and related tools focused primarily on web technologies.
https://c410-f3r.github.io/wtx
Apache License 2.0
146 stars 5 forks source link

[HTTP/2] Investigate requests latency #234

Open c410-f3r opened 1 week ago

c410-f3r commented 1 week ago

https://github.com/LesnyRumcajs/grpc_bench showed that wtx generally performs well but some requests, specially in the 99% area, end up having higher latencies.

I have a hunch that a such thing happens because Http2::accept needs to wait for a stream buffer provided by the user instead of creating one as soon a header frame is received. Or maybe not, there needs to be more investigation/profiling.

c410-f3r commented 1 day ago
.scripts/h2load.sh
                     min         max         mean         sd        +/- sd
time for request:       34us     42.75ms      2.50ms      3.43ms    99.23%
time for connect:      999us      3.28ms      2.14ms       578us    63.00%
time to 1st byte:     2.90ms     45.52ms      5.37ms      5.82ms    98.00%
req/s           :    2947.06     2998.03     2967.79       12.52    74.00%

Obviously, h2load shows the same diagnostic.

cargo build --bin h2load --features="wtx/http2" --profile profiling
samply record ./target/profiling/h2load
h2load -c100 -m10 -n10000 --no-tls-proto=h2c http://localhost:9000

Capture d’écran du 2024-10-09 08-32-59

This samply image makes me wonder about lock contention.