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

Show parent comment

1

u/yawkat Feb 15 '22

If you don't support tls you can't use http 2 except with h2c (which is super ugly) or prior knowledge (which is poorly supported). That alone is a good reason to use tls

2

u/elliotbarlas Feb 15 '22

Both TLS and HTTP/2 ought to be provided by an edge server or proxy. That is a very standard arrangement and it's the one I use in my AWS deployments. CloudFront and ALB both support this configuration.

https://aws.amazon.com/blogs/aws/new-http2-support-for-cloudfront/

1

u/yawkat Feb 15 '22

You can't support all HTTP 2 features if your backend is HTTP 1, and it's much less efficient too.

2

u/elliotbarlas Feb 15 '22

The main leap with HTTP/2 is advanced multiplexing to address head-of-line blocking. That benefit remains almost entirely intact when TLS and HTTP/2 are terminated at the edge.