[Tests Build Status]

Speed & Concurrency

Current Release: 6.4.0

Unlike other Ruby Webservers, Puma was built for speed and parallelism. Puma is a small library that provides a very fast and concurrent HTTP 1.1 server for Ruby web applications. It is designed for running Rack apps only.

What makes Puma so fast is the careful use of a Ragel extension to provide fast, accurate HTTP 1.1 protocol parsing. This makes the server scream without too many portability issues.

Quickstart with Bundler

If you are using Bundler, just add Puma to your project's Gemfile:

gem "puma"

Once you've installed your bundle, start Puma by running:

bundle exec puma

Quickstart without Bundler

If you are not using Bundler, you can install Puma directly from the command line:

gem install puma

Once installed, start Puma by running:

puma

Puma Vs. Other Webservers

Memory Usage Comparison (Showing memory usage over time - less is better)

  • Puma - 78 Mb

  • Rainbows! (1x16) - 120 Mb

  • Unicorn - 1076 Mb

  • Rainbows! (16x32) - 1138 Mb

Speed Comparison (Requests per second plotted against the number of concurrent requests - more is better)

1 2 3 4 5 10 20 30 40 50
Puma (16:16) 3264 6575 8969 9923 9925 9693 9482 9306 9341 9219
Puma (16:16, KA) 4589 8849 12245 14601 15909 14419 12939 12564 12701 12538
Rainbows! (1x16) 673 1161 1486 1730 1949 1814 778 782 727 710
Rainbows! (1x16, KA) 775 1336 1715 2006 2271 2085 732 1092 634 315
Unicorn 557 1054 1535 2032 2450 3958 5329 9330 8938 5235
Unicorn (KA) 554 1031 1517 1967 2457 3938 5292 9727 8985 9298
Rainbows! (16x32) 583 1150 1675 2173 2667 3152 3345 3384 3324 3417
Rainbows! (16x32, KA) 760 1479 2200 2853 3464 5413 7320 7350 7273 6419

Notes:

  • The KA entries are the benchmark run with the client doing keepalive requests.

Puma History

Puma comes from a long line of ruby webservers derived from Zed Shaw's seminal work on Mongrel. The primary element that remains is Mongrel's great HTTP parser written in ragel and executed in either C or Java, depending on the ruby implementation.

Evan Phoenix looked at Mongrel and saw a chance to take the idea and move it forward to incorporate two elements absent from the original work. Firstly, the Ruby world has moved almost entirely to using Rack as the primary interface for web apps. Mongrel was written in a pre-Rack world, so the first thing Puma did was cut out all the unnecessary abstractions and support the Rack interface directly. Second, Puma is designed to be used on a Ruby implementation which provides true parallelism, such as Rubinius and JRuby. Tuning for the capability and patterns that these implementations provide meant rethinking how requests entered the system and were handled. Incorporating these ideas, Puma was born from Mongrel and began moving forward.

Today, Puma runs on all Ruby implementations, but will always run best on any implementation that provides true parallelism. It looks to provide a simple and high performance request/response pipeline to Rack apps, allowing it to be used by nearly all ruby web applications.

Created By

Puma was created by Evan Phoenix in late 2011 as a derivative of Mongrel. Now, most of the original Mongrel code has been rewritten except for the parser. The git history for the project provides a timeline of the evolution of the project.