lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


It is also trivial to setup Lua with mod_fcgid, this is the Apache configuration snippet:

<IfModule mod_fcgid.c>
  Options +ExecCGI
  AddHandler fcgid-script .lua
  AddHandler fcgid-script .ws
  FCGIWrapper "/path/to/wsapi.fcgi" .lua
  FCGIWrapper "/path/to/wsapi.fcgi" .ws
  DirectoryIndex index.lua
</IfModule>

And you don't need spawn-fcgi in this case, as mod_fcgid does its own process management. I haven't compared how it fares against nginx+spawn-fcgi, though. 

--
Fabio Mascarenhas


On Wed, Oct 28, 2009 at 11:18 AM, Bertrand Mansion <lua@mamasam.net> wrote:
On Wed, Oct 28, 2009 at 1:20 PM, Patrick
<spell_gooder_now@spellingbeewinnars.org> wrote:
> I hope that I am not lowering the signal to noise ratio on this list. As I was saying I am not a pro programmer and judging from the posts to this lists I am it's dumbest member.
>
>
> Having said this, our thread about PHP and Lua yesterday left me wondering about Mod_lua.
>
>
> It seems to me the Mod_PHP is the preferred way to deploy PHP while Mod_Python is not the preferred way to deploy Python. It is my understanding that Mod_Python can access Apache's internals in such a way that it make it unsuitable for deployment with economy hosting providers as one account could clobber another account. If Mod_lua is being bundled with Apache by default now, surely it will not cause the same problem as Mod_python will it?

Mod_lua is not ready yet and as things are moving slowly with Apache
2.4, I wouldn't count on it before two years (this is only my opinion,
I might be wrong).

About mod_php, more recent benchmarks show that it is slower than
using fastcgi because mod_php only works correctly when Apache uses
its prefork MPM. The prefork MPM is less performant that other Apache
MPM because it doesn't use all the Apache threading potential. If you
use fastcgi, you don't have this problem anymore and can use a better
suited Apache MPM. If I understand correctly, the problem is not
really with mod_php, but with some PHP extensions which are not
threadsafe. And because it is better to be safe than sorry, most
people prefer to keep the prefork MPM.

Currently, the best setup I have tried in term of overall performance
(rps, memory, cpu) is with Nginx and fastcgi. The new PHP 5.3 makes it
even easier to use this setup because it doesn't require spawn-fcgi
anymore. With older versions, you can use spawn-fcgi with great
performance as well. The good thing is that Nginx + spawn-fcgi also
works great with Lua, as long as you manage to install wsapi.fcgi. And
since spawn-fcgid is a subproduct of Lighttpd, it will also work well
with this server. Fabio posted a small tutorial on his brand new shiny
blog :
http://mascarenhas.github.com/2009/10/24/wsapi-nginx-fcgi.html

This means you can use both PHP and Lua at the same time with the same
Nginx server and almost the same configuration.

I also heard good things about the Cherokee
http://www.cherokee-project.com it has a nice admin interface and
supports fastcgi.

In conclusion, I would say that today, Apache might not be the best
choice to run alternatives to Java and PHP. You will probably have to
try one of Nginx, Lighttpd or Cherokee. If you are more adventurous,
you can also try qDecoder's qHttpd server, as it seems it supports Lua
directly http://www.qdecoder.org but I haven't tried it myself. If you
can wait, I am sure mod_lua will be great, but not before long I am
afraid. At the moment it is pretty useless if you are planning
something serious.


--
Bertrand Mansion
Mamasam