Feed Sign in with OpenID OpenID

Simon Willison’s Weblog

Phusion Passenger for nginx. Passenger (aka mod_rails / mod_rack) enables easy deployment of Rails and Ruby apps under Apache... and the latest version adds support for nginx as well. It works as an HTTP proxy and process manager, spawning worker processes and forwarding HTTP requests to them via a request queue. It can also handle Python WSGI applications—anyone tried it out for that yet?

Tagged , , , , , ,

19 comments

  1. I am now running my own wiki (http://wiki.alcidesfonseca.com) in passenger via Apache. It works pretty great and better than via fcgi (less random 500 erros). I'm now using passenger as the default deployment method.

    Depending on whether I am hosting other sites in the same machine I'll go for apache or nginx, but I gotta test the latter first.

    Alcides Fonseca - 20th April 2009 10:48 - #

  2. Alcides,
    Did you try mod_wsgi? You only compare to fcgi?

    Jeremy Dunck - 20th April 2009 12:18 - #

  3. It didn't take very much source code inspection to see that passenger derives from mod_wsgi. What I would be asking myself is which benefits passenger brings on top of mod_wsgi except hype? (Not being critical of passenger here, but mod_wsgi hasn't been properly recognized if you ask me)

    Johan Bergström - 20th April 2009 13:17 - #

  4. Does this mean that we can (at least sometime in the near future) eliminate the need for Apache when dealing with Django deployments?

    Henrik Lied - 20th April 2009 20:41 - #

  5. Henrik: potentially yes, which is why I think this is such an interesting development.

    I really like the Passenger model, where the web server manages a number of external processes for you and queues up requests to be passed on to them. The thing that always puts me off FastCGI is the need to manage external processes myself. That's the main reason I deploy all of my stuff under mod_wsgi.

    Simon Willison - 20th April 2009 20:55 - #

  6. Simon: I couldn't agree more. A Passenger-way of doing things in Django would be extremely beneficial.
    I'm mainly on mod_wsgi myself, but a couple of my older (…and ironically, the ones under most load) still reside on mod_python, which is really a pain in the ass.

    Henrik Lied - 20th April 2009 21:13 - #

  7. Henrik, is there something hard about switching from mod_python to mod_wsgi? Or is it just that they are under load?

    Jeremy Dunck - 20th April 2009 21:47 - #

  8. Simon: Why create a queue inside an already queueing web server?

    Queueing is generally what web servers do best - and that's basically what I referred to in my above comment. Use nginx with mod_wsgi for serving python and put up an additional nginx in front, keeping track of static stuff and whatnot.

    Johan Bergström - 20th April 2009 22:34 - #

  9. The huge benefit to passenger for us has been the copy-on-write friendly forking, and the *completely* trivial setup. It's basically unzip-and-go which is a huge improvement over the previous mongrel malarky

    It takes almost no time to spin up a new process (fork from a pre-warmed spawner process), and because a big chunk of that memory isn't dirtied, you can run more ruby processes in the same amount of ram.

    Whether this applies to python, I have no idea.

    It's also been rock solid for things like dynamically spawning processes within an upper and lower bound. Everything else fucked that up somehow.

    Again, whether that helps you guys, I dunno :).

    Michael Koziarski - 21st April 2009 03:57 - #

  10. As for why create a queue inside an already-queueing webserver, it lets you run N web server processes and M dynamic-language-app processes. If N==M for you, then you don't care, but where you want N > M, you need another queue.

    Michael Koziarski - 21st April 2009 05:50 - #

  11. Michael: That's not entirely the case when it comes to mod_wsgi for nginx. It attaches a python interpreter to each worker, resulting in each process ending up in an architecture very similar to passengers (?). I agree that it's not very advantageous to serve static media in cases you describe: when workers are busy handling python requests. This is why I've been advocating putting an additional web server in front of this one.

    I'm not saying passenger isn't hott hott sauce – I just cant justify letting passenger handling queues when nginx most likely does this better. mod_wsgi has python specific options I haven't seen in passenger either.

    Johan Bergström - 21st April 2009 09:02 - #

  12. Two sets of nginx processes seems a little enterprise, but I can see why you'd want it in that situation.

    From my perspective the nice thing about passenger is that it decoupled the web server from the ruby processes (unlike mod_perl or whatever) and it managed the processes without completely shitting itself (unlike fastcgi) and with some memory smarts (unlike mongrel+monit etc). Given that the python support probably doesn't get as much attention as the ruby stuff, some trepidation is probably advised.

    But fundamentally, if deployment ain't broke don't try to fix it. Constant deployment experimentation will eventually leave you with no clients and no uptime :)

    Michael Koziarski - 21st April 2009 10:05 - #

  13. When you are talking about mod_wsgi, can you please be exact and say Apache/mod_wsgi or nginx/mod_wsgi. Some of you seem to be talking about one and some the other, but hard to tell, and it is confusing.

    Anyway, is first I have heard that Phusion Passenger derives from mod_wsgi. Even if the nginx guy caused lots of confusion by using the same name, he did ask as a courtesy if it was okay to make use of the Apache/mod_wsgi code.

    Graham Dumpleton - 22nd April 2009 22:27 - #

  14. Graham: I've always meant Apache/mod_wsgi (I'd almost forgotten there was an nginx port) - I'll be more specific in future.

    Simon Willison - 23rd April 2009 11:23 - #

  15. Simon, wasn't you I was confused about, I know you use Apache. It was some of the commenters which weren't being clear. But then, scanning them again, I can't seem to find the ones which I thought were confusing. I have had a few stressful days and my brain mustn't be working properly. :-)

    BTW, thanks for linking to my blog posts at times. I get more traffic because of your linking to it than from any other way. You must have a high profile on blog aggregators.

    Graham Dumpleton - 23rd April 2009 11:50 - #

  16. I can confirm that Phusion Passenger for Apache handles Python WSGI applications... and on a Dreamhost shared server, no less.

    J. Childress - 9th May 2009 21:39 - #

  17. It looks like Dreamhost (my cheap-o hosting) just added "official" support for Django via Passenger, so I look forward to trying this out!

    Shawn Wheatley - 13th November 2009 17:58 - #

  18. @Johan Bergström: those are bold claims that you are making. Phusion Passenger is in no way derived from mod_wsgi and I have absolutely no idea how you ever came up with that idea.

    Hongi Lai - 22nd November 2009 01:55 - #

  19. I too am using Django via Passenger on Dreamhost and it is much better than using their fcgi approach.

    The only thing I can't figure out is how to get virtualenv to work with it.

    Christopher Flynn - 14th January 2010 22:13 - #

Comments are closed.
A django site