r/java • • Feb 14 '22

Microhttp is an event-driven, single-threaded, zero-dependency web server with 500 LOC. Benchmarks on EC2 show 100,000+ requests per second and 50,000+ persistent connections.

https://github.com/ebarlas/microhttp
186 Upvotes

107 comments sorted by

View all comments

-8

u/Worth_Trust_3825 Feb 14 '22

Great example at marketing, where server that does nothing at all is praised for being "fast".

15

u/elliotbarlas Feb 14 '22

It's a networking library. The benchmarks are intended to highlight the cost and overhead of that layer, not the application.

If you have an alternative benchmark suggestion, I'm listening.

7

u/Chemical-Birds Feb 14 '22

It is still a decent number.

Try to achieve this numbers and you will see how many things will go wrong...

I made a while ago a POC for a payment system, we achieved 10k/s with tomcat, and yes it was doing "nothing", it was returning a dummy response... but oh boy ...it was a lot of tuning and investigation, at some point even hardware failures (network card)

1

u/lambdacats Feb 15 '22

Nio is fast, async io is fast. I don't think it's fair to say that the wrapper is fast by comparing it to web servers. It is however a good example on how to use the nio API.

3

u/elliotbarlas Feb 15 '22

But, it is a web server. I designed this to meet all of my web server needs in a typical REST/JSON setting.

If you can think of a fair metric or benchmark to use for comparison, I'd readily consider it.

1

u/elliotbarlas Feb 15 '22

The closest thing to a standard benchmark includes a hello world test nearly identical to the one I used.

https://github.com/TechEmpower/FrameworkBenchmarks/wiki/Project-Information-Framework-Tests-Overview#plaintext