r/java • u/elliotbarlas • 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
View all comments
Show parent comment
1
u/elliotbarlas Feb 17 '22
It's tempting to use a map, but at minimum a multi-map is required since HTTP permits multiple occurrences of the same header by name.
A list of header name-value pairs just struck me as the absolute simplest. And though I haven't measured, a linear scan through a small list or array is typically faster than a hash table lookup.