views:

446

answers:

4

Historically I have used Thin as an application server (for Ramaze apps, but it could easily be for Rails), which receives requests from an Nginx web server.

Does anyone have experiences between using Thin/Mongrel/anything else to server Ruby applications to a web server? I am keen to keep things lean and fast.

+5  A: 

I find Passenger to be incredibly easy to set up. It works in combination with Apache or Nginx, and it should be able to serve any Rack-based application or framework.

According to its authors and many other users out there, it's supposed to be very lean on memory when used in combination with Ruby Enterprise Edition, at least for hosting multiple Rails applications.

Personally, I find that the biggest advantages are:

  • It's really dead easy to set up, and works in a mod_php-esque way.
  • It drops privileges and runs my Rails app as a regular user.

The latter is pretty cool, and I didn't even notice it right away. I simply set up a user account specifically for the application, unpacked the application in the home directory, and then went through the Passenger setup steps. It was only after I looked through the process list that I noticed it had also dropped privileges to the user.

Shtééf
+2  A: 

Lighttpd w/ Fast-CGI has treated me well (and is almost as lean as it gets). mod_ruby, not so much. Mongrel is cool for development but I refuse to use it in production.

With a large enough cluster, the impact of the web server is minimal.

Pestilence
+1  A: 

Mongrel is a very stable and trusted webserver. A lot of other servers use mongrel code in one way or the other. I have found it's performance to degrade linearly with amount of load and not exponentially as it happens with Passenger

piyush
+1  A: 

I'm a big fan of Thin. It's fast (faster than passenger), doesn't use much memory (less than passenger), and isn't too hard to set up and maintain.

igul222
I recently switched from Thin to Passenger, and found memory usage to be reduced by a respectable amount. I haven't benchmarked it, but it seems to be running just as fast as before the switch. Passenger is about as mind-numbingly simple to set up as Thin, so it's a tie there.
kyl
Really? Are you using Ruby Enterprise Edition?
igul222
Nope, but I am on 1.9, if that makes a difference (and nginx). According to `passengar-memory-stats`, the "Total private dirty RSS" hovers around ~35mb for a single process, while it was up to ~50mb while just running Thin.
kyl