Benchmark of tiny-http and may-minihttp #256
kolbma
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've compared tiny-http with may_minihttp, which is one of the fastest benchmark competitor TechEmpower Benchmark.
This is not doable with the tiny-http from official master branch. If you hit the thread/file limit of your system the Server would simply exit, because of the return of
None
byServer::incoming_requests()
.I've used my advanced branch with some changes hopefully going in version 0.13: https://github.com/kolbma/tiny-http/tree/dev-20240117
For may is to tell, that the server and benchmark isn't using much std lib implementations.
My tiny checks also HTTP headers and body if the request makes sense and doesn't trust it. While may is the most basic, just the protocol works if the client is doing correct requests.
Next there is an optimized garbage collector, optimized collections, a probably faster_ json serializer_ than the famous serde, async and a lot more why it is there on the top of benchmarks.
My purpose wasn't to compete with it, but to compare the difference if you would use tiny the usual productive way.
The result in percent is based on the assumption that may would be 100%.
Starting with plaintext benchmark
may:
tiny:
1024 connections hit my local system limits. But nevertheless equal socket errors and tiny reaches 65%.
may:
tiny:
Result: 65.6%
may:
tiny:
Result: 79.4%
The 100 connections are the half of the connection limit of my tiny (default 200).
And you see an approach ;-)
Now the json benchmark
may:
tiny:
Result: 66%
may:
tiny:
Result: 64.6%
may:
tiny:
Result: 76.7%
As last run I've tried 6 connections with 6 threads, something my Laptop should drive parallel without many thread mixing...
may:
tiny:
Result: 74.7% (for plaintext 74%, too)
Conclusion
Before bench-marking I had no idea how tiny-http might compare to other widely use HTTP servers.
Now I know, it is ok.
Of course the results are not perfect, but with 60 seconds runs it should be ok to do the benchmark on a laptop with applications in the background.
If you have a look at the official results, you'll see, that with results between about 65% and nearly 80% it is in the area of hyper, ntex, actix, asp-core and in front of some very famous frameworks.
And remarkable without any special benchmark optimization.
In the json results the named competitors are a step further in front. Mostly they don't use serde I think.
For you guys interested in trying the benchmarks, may-minihttp has the examples/techempower_no_db.rs and I'll push the lastest version to my techempower-bench branch.
Beta Was this translation helpful? Give feedback.
All reactions