Live data from Hacker News

Puma vs Phusion Passenger

github.com

31–40 of 47 posts

Re: Puma vs Phusion Passenger

#31

Earlier quoted context omitted.

Web stuff tends to be embarrassingly parallel: http://en.wikipedia.org/wiki/Embarrassingly_parallel . Which means that it's extremely easy to make a framework that's reentrant: http://en.wikipedia.org/wiki/Reentrancy_(computing) . Reentrancy gives you thread-safety by default. Yeah, Ruby core data structures are not thread-safe. But that doesn't matter. You're not supposed to a lot of any data structures between requ…

> Maybe I'm just too familiar with Ruby and multithreading, but I don't understand why people have trouble with multithreaded Ruby. [...] In my opinion, the situation is not much different in Python, Java or C++. I think the problem is a mix of language features and culture. Ruby does not have a history good thread-safe practices, and the language has some extremely convenient features which are death for thread-safe…

>> the language has some extremely convenient features which are death for thread-safety (eg. class instance variables)

Weeell, but this (class-level state) is true of virtually all non-functional environments though, right? -- including the otherwise excellent concurrency support within the JVM.

If someone's using class/global state in a contentious, multi-threaded environment, they...probably should not be developing on that particular problem.

As you pointed out, the fact of class-level state isn't so much an argument against Ruby per se. To me it's more of an argument in favor of stateless/functional programming where data contention is high -- which is somewhat besides the point in this conversation because we're talking about (mostly) "embarrassingly parallel" concerns where data tends to be siloed and contention is low.

>> if I knew I needed heavy multi-threading for memory efficiency and CPU utilization I might disqualify Ruby on cultural reasons alone

But...aren't these exactly the kind of problems that REE/Passenger, Unicorn and Puma (not to mention EventMachine and Rack) have been digging into for years now?

As much of a bad rap as Ruby tends to get when it comes to threading, the GIL and so forth, I think what gets lost in that conversation is the fact that many flavors of Ruby application server configurations are serving thousands and thousands of concurrent requests in production every second and doing a pretty good job of it. In certain contexts, Ruby handles concurrency and parallelism admirably well.

"Culture" is a relative question -- are we talking about the guys at Phusion, or Engine Yard, or Heroku, or someone like Evan Phoenix, or Yehuda? Is that Ruby culture? There's some heavy threading brain-power in that group, and they've left a pretty big footprint on the Ruby/Rails community.

Or are we talking about (no offense) journeyman web coders who generally don't have to solve threading/high-contention, CPU-intensive problems all the time? I'm honestly not sure that at this point the Ruby community is any worse off than other communities in that regard.

In 2013, the Ruby/Threading issue is starting to feel (to me) a bit like the "Java is slow" notion did in the early 2000s. Might be time to look at what Ruby is actually doing in production and rethink that idea.

Re: Puma vs Phusion Passenger

#32

Earlier quoted context omitted.

I think Github will automatically set redirects for you if you move a repository around.

Really? A few months ago when I tried to move a repo Github showed a big warning, explicitly telling me that they do not setup redirects. Maybe that has changed now.

Redirects are new, so probably.

Re: Puma vs Phusion Passenger

#33
For developers running a small vps or any kind of server in which memory is a scarce resource, I highly recommend puma.

I needed about 5-6 passenger processes in my app to service requests in a timely fashion moving to puma essentially cut down the processes I needed to run to 1 ... saving me about 300MB of RAM, but not only did it save me memory, performance was better than with Passenger.

Granted, I miss the ease of just typing

touch tmp/restart

to reboot my app, and I had to set up Apache (then later Nginx) proxying to get it going but it was well worth it.

PS: here is my writeup on how you can get puma up and running with your Apache/Passenger setup in less than an hour to try it out http://www.concept47.com/austin_web_developer_blog/rails/how...

Re: Puma vs Phusion Passenger

#34
post #27

Some great points about the tooling, especially the control server. For 2.3, the control server is going to get some much needed needed love that should hopefully address major issues. A couple of notes: Puma has a dynamic pool but it's common to see people configure the pool as 16:16 in production, meaning it's staticly configured to 16 threads. Some people have asked about using Puma to manage multiple apps recentl…

Hey Evan,

I keep reading how Puma is meant for be run multi-threaded on JRuby or Rubinius.

Would it be non-sense to run it in "cluster" mode (multi-process) under MRI 2.0? Similar to how we'd run Unicorn, for example. Any benefits doing that versus just running Unicorn?

EDIT: we have plenty of ram so that's not really a concern

Re: Puma vs Phusion Passenger

#35

For developers running a small vps or any kind of server in which memory is a scarce resource, I highly recommend puma. I needed about 5-6 passenger processes in my app to service requests in a timely fashion moving to puma essentially cut down the processes I needed to run to 1 ... saving me about 300MB of RAM, but not only did it save me memory, performance was better than with Passenger. Granted, I miss the ease o…

You can restart puma pretty easy too with sudo kill -SIGUSR2 `cat tmp/puma/pid`

Re: Puma vs Phusion Passenger

#36

A new section has just been added which compares memory usage.

I've been using passenger for quite some time and really appreciate its focus on operational tools.

Thanks for the detailed comparison. Good to know how it stacks up against the other options out there.

Re: Puma vs Phusion Passenger

#37

For developers running a small vps or any kind of server in which memory is a scarce resource, I highly recommend puma. I needed about 5-6 passenger processes in my app to service requests in a timely fashion moving to puma essentially cut down the processes I needed to run to 1 ... saving me about 300MB of RAM, but not only did it save me memory, performance was better than with Passenger. Granted, I miss the ease o…

If memory is your main concern, then Phusion Passenger Enterprise uses even less memory than Puma. :) We have a discount for cash-strapped startups, students and educational institutions.

Re: Puma vs Phusion Passenger

#38

I posted a showdown of various open source servers that can be run on heroku a few days ago, including puma, which some people interested in this may be interested in: https://github.com/jrochkind/fake_work_app/blob/master/READM... For some reason it didn't get much HN traction. But either it inspired these recent HN posts involving puma, or it's just a coincidence -- either way I'm glad to see puma getting more atte…

Great analysis - I've been struggling with finding the right server to use for concurrency as I have very long-running requests to a third party API, and this looks like the right choice for us.

Re: Puma vs Phusion Passenger

#39
post #34
post #27

Some great points about the tooling, especially the control server. For 2.3, the control server is going to get some much needed needed love that should hopefully address major issues. A couple of notes: Puma has a dynamic pool but it's common to see people configure the pool as 16:16 in production, meaning it's staticly configured to 16 threads. Some people have asked about using Puma to manage multiple apps recentl…

Hey Evan, I keep reading how Puma is meant for be run multi-threaded on JRuby or Rubinius. Would it be non-sense to run it in "cluster" mode (multi-process) under MRI 2.0? Similar to how we'd run Unicorn, for example. Any benefits doing that versus just running Unicorn? EDIT: we have plenty of ram so that's not really a concern

Yeah, you can certainly run puma in the same operational mode as unicorn with clustering. But what I'd suggest is that you do instead is creating 1.5 as many workers has you have cores in your machine and perhaps 8 threads per worker. With that configuration, you'll get much more even performance than unicorn because you won't get as much cpu thrashing from context switches between processes and the threads will allow a high number of concurrent requests to all make progress concurrently.

Re: Puma vs Phusion Passenger

#40
post #39
post #34

Earlier quoted context omitted.

Hey Evan, I keep reading how Puma is meant for be run multi-threaded on JRuby or Rubinius. Would it be non-sense to run it in "cluster" mode (multi-process) under MRI 2.0? Similar to how we'd run Unicorn, for example. Any benefits doing that versus just running Unicorn? EDIT: we have plenty of ram so that's not really a concern

Yeah, you can certainly run puma in the same operational mode as unicorn with clustering. But what I'd suggest is that you do instead is creating 1.5 as many workers has you have cores in your machine and perhaps 8 threads per worker. With that configuration, you'll get much more even performance than unicorn because you won't get as much cpu thrashing from context switches between processes and the threads will allo…

Hi Evan, thanks for your great work on Puma. Back in the days Mongrel was already multithreaded but it never reached its full potential because multithreading in the Rails world was so messed up back then. I'm glad to see that you've developed it into such a good state. When I checked your code, it was simple, clean and easy to read. Wonderful technology.

Unicorn currently does have better fault-tolerance tools than Puma though, e.g. the 1-minute timeout on that Unicorn has by default. Unicorn also currently has more documentation than Puma. So there is a tradeoff in the choice, and there's still plenty that all the app servers can learn from each other.

Post reply on HN