http4k: Http4k-netty performs really badly on all benchmarks (with lots of errors)
I’ve checked the techempower benchmarks and it seems that http4k-netty
performs really badly and has a lot of errors in the benchmarks. Is this an inherent problem with Netty or is the benchmark bad?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 17 (8 by maintainers)
Here you go: https://storage.googleapis.com/strohel-pub/bench-http4k-server-engines-excerpt/bench-results.html
Cool, tried it now and I can confirm that the TCP connection is now persistent (netty even adds
connection: keep-alive
header) andwrk
is not fooled anymore. Let me run more representative and lengthier benchmarks and report the results.the easiest thing is to just copy the entire netty.kt file from the branch into your project and use that version inside the call to asServer()
I was able to reproduce http4k-netty benchmark problems on a different http4k microservice and my own benchmarking testbed that also uses
wrk
(HTTP load generator).When looking at the traffic using Wireshark, I can see that server responses on netty have
Connection: close
header and noContent-length
header (which is a probable cause of theConnection: close
). All other tested server engines behave differently and more efficiently: they do serveContent-length
header and keep the TCP connection open for next requests.In addition to hurting performance, this seems to fool wrk’s hand-written HTTP parser into reporting read errors for every request (even though the HTTP response seems correct to both me and Wireshark):
Perhaps there is something in the Http4k <-> Netty integration that prevents content-length from being correctly passed?
(Netty itself seems to be well capable of persistent connections when used by Ktor) CC @goodhoko.
Hah, that’s funny. I know Gyula personally. I think I’ll just talk to him. 👍 I guess you are right. The article I linked was about Netty (which is problematic apparently 😃 ).