Is puma the ONLY multi-threaded rails 4 http server?
Asked Answered
V

2

22

I've gotten our stack converted to Rails 4 (yea!)

and I'm looking to take advantage of the thread-safe code.

Puma works in getting up, stopping it appears to be a different problem :(

Is Puma the only multi-threaded rails?

Thin -> EventMachine
Unicorn -> Forking
Puma -> multi-threaded

Mongrel -> don't care
Webbrick -> don't care
Vespertine answered 27/7, 2013 at 20:56 Comment(2)
Wouldn't this fall under the heading of "software tools commonly used by programmers" and thus not be "off-topic"?Gillenwater
I checked the about page - stackoverflow.com/about possilby a bit in the grey area, but I think it qualifies.Vespertine
B
32

No. In alphabetical order:

  • Iodine a HTTP / Websocket Server & EventMachine alternative (kqueue/epoll based)
  • Net::HTTP::Server, despite the lack of advertising, supports multithreading
  • Phusion Passenger has supported multithreading since v4 beta
  • Rainbows! supports multiple concurrency models, including multithreading
  • Reel is a Celluloid-backed "evented" server, which "also works great for multithreaded applications and provides traditional multithreaded blocking I/O support too"
  • Thin has a threaded mode, which can be enabled by passing --threaded or by setting threaded: true in the appropriate configuration file (e.g. bundle exec thin start --threaded)
  • WEBrick is on its own multithreaded, so it's not fair to eliminate it as an option; if you're using the Rails-embedded version, you'll need to monkey-patch Rails::Server to enable multi-threading
  • Zbatery is based on Rainbows! and supports all concurrency models that Rainbows! supports

Note that currently MRI Ruby runs only one thread runs at a time due to its global interpreter lock (GIL). You'll only be truly able to exploit multithreading by using a different Ruby runtime such as JRuby or Rubinius, which provide access to native threads. If you decide to go with JRuby, there are several JVM-dependent servers worth exploring.

Born answered 26/8, 2013 at 7:32 Comment(4)
Thank you! This helped out a great dealVespertine
Another one for the list: iodine also supports both multi-threading and multi-processes.Strepitous
It's definitely multithreaded. See links above or the source code: github.com/nahi/webrick/blob/master/lib/webrick/server.rbBorn
OMG, I just learned today that WEBrick is multi-threaded! And it doesn't even seem to perform bad.Humiliate
B
1

Trinidad is nice. A very powerful server for jRuby development:

http://blog.jruby.org/2012/04/two-apps-one-trinidad/

http://railscasts.com/episodes/377-trinidad?view=comments

Here are some good benchmarks (the Trini server beats puma):

http://carlhoerberg.github.io/blog/2012/03/31/jruby-application-server-benchmarks/

A nice Trinidad Server setup tutorial:

http://blog.jruby.org/2012/04/two-apps-one-trinidad/

Bolanos answered 11/2, 2014 at 16:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.