mod_rails aka mod_rack aka mod_ruby

Manlio Perillo manlio_perillo at libero.it
Fri Jun 6 14:29:36 MSD 2008


Grzegorz Nosek ha scritto:
> On czw, cze 05, 2008 at 10:34:01 +0200, Manlio Perillo wrote:
>>> AIUI, mod_wsgi isn't a universal module but is mostly useful for
>>> embedding rather simple Python code into nginx.
>> Right, but of course we must agree on what "simple" means.
> 
> Yeah, maybe 'simple' was the wrong word, it probably should be
> 'low-level' or 'specialised'.
> 

Right.
In fact I'm writing a WSGI framework aimed at be "low-level":
http://hg.mperillo.ath.cx/wsgix/

>>> I remember asking Manlio some time ago about it and he said (more or
>>> less) that embedding e.g. Django via mod_wsgi would be pretty insane,
>>> so I think it would hold twice as true for e.g. Rails.
>> Yes, usually it is insane, for several reasons.
>> Django (like Ruby on Rails, and other very high level framework) have 
>> the "problem" on hide low level details.
>>
>> This is fine, but this also means that you can write code that it is 
>> easy to write but completely inefficient.
> 
> True, and while it's a moderate problem when the app server is
> standalone, it can become a major bottleneck when embedded into the web
> server.
> 

Right.
Note, however, that if an application is slow on I/O (as an example an 
HTTP request), then this can be "optimized" using coroutines (greenlets).

>>> Of course, I'd like to be proven wrong and hopefully Manlio will step in
>>> to correct me. :)
>> Unfortunately this question does not have an easy answer.
>> You should really make good tests.
>>
>> Fortunately know we have many good implementations of WSGI so that we 
>> can test an application in several environments:
>> Apache mod_wsgi, Nginx mod_wsgi, and so.
> 
> Yes, but this means that you cannot drop any random application into
> nginx. And safely running web apps over which I have little control is
> essential for me.
> 
> Basically, it's the whole point of my argument against mod_ruby for
> nginx -- it'll never be as flexible as a standalone server.
> 

I agree.
However I think that it can be an interesting experiment.
Moreover rack is very simple to implement, more simple than WSGI.

As far as I know, there is also a ruby module for Apache, this may be 
the best solution.


Another solution is to use a child process for each request.
Something like CGI, but without having to `exec`: you can just execute 
the Python/Ruby script using the embedded interpreter.

I'm writing a CGI module for Nginx with such feature enabled for Python.

> OTOH, one thing I'd love to see would be something like a full-blown Lua
> interpreter as a configuration parser.
> 

Me, too.
I don't know if Igor is still interested.
Unfortunately I don't have the time.

> Best regards,
>  Grzegorz Nosek
> 
> 

Regards  Manlio





More information about the nginx mailing list