talira

A Ruby/Rack web server built for parallelism

open sourceBSD-3-Clauseself-hostablefree

Puma is a multi-threaded, multi-process HTTP 1.1 server for Ruby and Rack apps and the default server for Rails. Each request runs in its own thread, and cluster mode pre-forks worker processes that share memory through copy-on-write, so one machine serves many requests with little memory. It has SSL, zero-downtime rolling restarts and a request buffer built in, so it can run without a reverse proxy. Its HTTP parser comes from Mongrel. On MRI the GVL runs one thread of Ruby at a time, but threads still overlap their waits on IO; on JRuby and TruffleRuby they run in parallel.

Ways to install

Package managers

Problems it solves

  • which web server should run my Rails app in production
  • serve more requests per server without adding memory
  • restart the app server without dropping requests during a deploy
  • my Ruby app spends most of its time waiting on external APIs and can't keep up
  • tune threads and worker processes for a Rails app on a small VM
  • serve HTTPS straight from the Ruby app server
  • a Rack server that works on MRI and JRuby

Features

  • multi-threaded request handling
  • cluster mode with pre-forked workers
  • copy-on-write memory sharing
  • SSL
  • zero-downtime rolling restarts
  • request buffering
  • Mongrel-derived HTTP parser
  • MRI, JRuby and TruffleRuby
  • default server in Rails' generated Gemfile

Capabilities

Has a command line toolplan not known
Takes pluginsplan not known

Alternatives

The same job

These do what Puma does.

  1. unicorn Rack HTTP server for fast clients and Unix
  2. Gunicorn Python WSGI HTTP server for UNIX

Compare Puma with the top 3