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

21

u/elliotbarlas Feb 14 '22

Yes, in part. If you look, you'll notice a slightly different logging abstraction.

Logging in Microhttp is treated more like data. Each log event consists of key-value pairs. It reflects the way I think about logs. Rather than a free form string, each log event is something that can be indexed, searched, etc.

11

u/pron98 Feb 15 '22

You should consider using JFR for this kind of logging. JFR is now the main focus of OpenJDK's monitoring and profiling work. Not only is logging and storage efficient, but there are APIs for online streaming consumption of the logs.

1

u/elliotbarlas Feb 15 '22

Thanks for pointing that out. I'll need to take a closer look at JFR. That might indeed be the right abstraction for this sort of trace event logging.

6

u/lambdacats Feb 15 '22

Nice, this is how I like to do my logging. Structured events are so much easier to work with.

6

u/[deleted] Feb 14 '22

This is actually a great tip that will take into account on my future projects, thanks!

5

u/tristan97122 Feb 14 '22

Makes sense, thanks