Newb here: have you written your own web server? Seeking advice

This page summarizes the projects mentioned and recommended in the original post on /r/ruby

Our great sponsors
  • SonarQube - Static code analysis for 29 languages.
  • InfluxDB - Collect and Analyze Billions of Data Points in Real Time
  • Mergify - Updating dependencies is time-consuming.
  • mongrel

    Mongrel on git

    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).

  • Puma

    A Ruby/Rack web server built for parallelism

    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).

  • SonarQube

    Static code analysis for 29 languages.. Your projects are multi-language. So is SonarQube analysis. Find Bugs, Vulnerabilities, Security Hotspots, and Code Smells so you can release quality code every time. Get started analyzing your projects today for free.

  • webrick

    HTTP server toolkit

    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.

  • bindata

    BinData - Reading and Writing Binary Data in Ruby

    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.

  • ruby_view_server

    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

  • net-http-server

    A pure Ruby HTTP 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.

  • Thin

    A very fast & simple Ruby web server

    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).

  • InfluxDB

    Collect and Analyze Billions of Data Points in Real Time. Manage all types of time series data in a single, purpose-built database. Run at any scale in any environment in the cloud, on-premises, or at the edge.

  • 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

  • http_tools

    Pure Ruby HTTP parser and friends

    And the HTTP parser I wrote for it: https://github.com/matsadler/http_tools

  • Rack

    A modular Ruby web server interface.

    The spec for Ruby's Rack is another good reference for how a Ruby webserver is expected to work.

  • EventMachine

    EventMachine: fast, simple event-processing library for Ruby programs

    Maybe check out EventMachine. You can roll your own using sockets if you don't want to use a library.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts