talira

unicorn

Rack HTTP server for fast clients and Unix

open sourceGPL-2.0-or-later OR Rubyself-hostablefree

unicorn is a preforking HTTP server for Rack (Ruby) applications, designed for fast clients on low-latency connections and for Unix kernels' features. It spawns and manages any number of worker processes, reaps and restarts workers that die from broken code, and leaves load balancing to the kernel, so requests never pile up behind a busy worker; each worker serves one client at a time in its own address space, so the app needn't be thread-safe. It reopens log files on USR1 for logrotate, and slow clients must be served through a fully buffering reverse proxy such as nginx. Its README warns that its tolerance of bad code has done the Ruby ecosystem damage. It began as a fork of Mongrel and is developed over a public mailing list rather than GitHub.

Problems it solves

  • run a Rack or Rails app with multiple worker processes
  • restart Ruby web workers automatically when they crash
  • serve a Rails app that isn't thread-safe
  • a preforking app server for Ruby behind nginx

Features

  • preforking worker processes
  • restarts dead workers
  • kernel load balancing
  • no thread-safety needed
  • log reopening on USR1

Limitations

  • Serves only fast clients: slow clients must go through a reverse proxy that fully buffers requests and responses, such as nginx1
  • No release since 6.1.0 (December 2021); the newest patch on its mailing list is from April 2025, and users were still asking for a new release in 202623

Capabilities

Has a command line toolplan not known

Alternatives

The same job

These do what unicorn does.

  1. Puma A Ruby/Rack web server built for parallelism

Compare unicorn with the top 3