-
The other major thing you'll run into is performance. WEBrick's HTTP parsing code may look hairy but it is fast. Mongrel was the first Ruby HTTP server to implement it's HTTP parser in C using Ragel, which Thin, Unicorn, and Puma all copied; although there's a bug in the original Mongrel HTTP parser where it does not combine the values duplicate HTTP headers (yes, HTTP Header names can actually be repeated).
-
Scout Monitoring
Performance metrics and, now, Logs Management Monitoring with Scout Monitoring. Get early access to Scout Monitoring's NEW Ruby logging feature [beta] by signing up now. Start for free and enable logs to get better insights into your Rails apps.
-
The other major thing you'll run into is performance. WEBrick's HTTP parsing code may look hairy but it is fast. Mongrel was the first Ruby HTTP server to implement it's HTTP parser in C using Ragel, which Thin, Unicorn, and Puma all copied; although there's a bug in the original Mongrel HTTP parser where it does not combine the values duplicate HTTP headers (yes, HTTP Header names can actually be repeated).
-
WEBrick. Written entirely in Ruby, this is where you should start your examination, but not where it should end. WEBrick is easy to understand, because it is all Ruby, but it is not suitable for hosting websites. It is not robust or performant enough.
-
For example, I enjoy sim racing, and some of my games provide a network API for things like telemetry data. So I wrote a simple telemetry logger that I use to gather data, which I then mess around with using R Studio. Ruby worked exceptionally well for this because of a cool little library called BinData.
-
You don’t need to implement a server from scratch. Here’s an exercise I wrote about wiring the HTML generating bits of Ruby code together you might find interesting https://github.com/schneems/ruby_view_server
-
Yes, I actually have. Implementing a basic HTTP parser isn't that difficult, once you implement the correct parsing rules from RFC 9110. If you want to fully support the HTTP protocol, you also have to implement things such as Chunked Transfer Encoding or Gzip Deflate.
-
The other major thing you'll run into is performance. WEBrick's HTTP parsing code may look hairy but it is fast. Mongrel was the first Ruby HTTP server to implement it's HTTP parser in C using Ragel, which Thin, Unicorn, and Puma all copied; although there's a bug in the original Mongrel HTTP parser where it does not combine the values duplicate HTTP headers (yes, HTTP Header names can actually be repeated).
-
CodeRabbit
CodeRabbit: AI Code Reviews for Developers. Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
-
tracks
A bare-bones Ruby HTTP server that talks Rack and uses a thread per connection model of concurrency. (by matsadler)
My server is on GitHub here: https://github.com/matsadler/tracks
-
And the HTTP parser I wrote for it: https://github.com/matsadler/http_tools
-
The spec for Ruby's Rack is another good reference for how a Ruby webserver is expected to work.
-
Maybe check out EventMachine. You can roll your own using sockets if you don't want to use a library.