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

-9

u/thisisjustascreename Feb 14 '22

Neat toy, but it doesn't even support TLS.

8

u/crummy Feb 14 '22

do people actually do TLS in their Java webservers? i.e. they aren't behind nginx, caddy etc?

5

u/elliotbarlas Feb 14 '22

Not in my experience. A perfect example of a reasonable feature in a comprehensive, general purpose web server that just isn't used in practice.

7

u/stringbet Feb 14 '22

Eh.. there are reasons to do it. When you're handling 1m requests/s, putting the SSL on your LB is a significant CPU burden which makes scaling harder. Pushing SSL back to your server pool allows the LB to operate in Layer 4 and thus it can handle a lot more traffic.

5

u/elliotbarlas Feb 14 '22

I've never heard that argument before. Load balancers are horizontally scalable, so while it does place a greater burden on the LB, I don't think that's actually problematic.

Also, HTTP aware layer 7 load balancers are indispensable.

6

u/stringbet Feb 14 '22

Definitely not disputing the value of Layer 7 load balancing. My point is that an LB is a larger unit of scaling than backend servers. If I can handle 10% more traffic by adding a cheap backend server, great.. but at some point, I have to add another (expensive) LB. The longer I can delay that, the better. I'm speaking from personal experience here, so this is not a theoretical situation.

2

u/elliotbarlas Feb 14 '22

Thanks for clarifying, that makes sense. I'll keep that in mind.

Do you deploy that setup in the cloud? The certificate management capabilities and integrations in AWS are another reason that terminating TLS on the LB or CDN is a natural choice.

3

u/stringbet Feb 14 '22

Nope, this is an on-prem environment. Believe me, there have been significant cost comparisons done with the cloud and for our workload, this is the better deal. Horizontally scaling load balancers isn't a technical challenge, just a capex decision.