lua-users home
lua-l archive

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



On Sep 29, 2009, at 7:38 PM, Cosmin Apreutesei wrote:

For now, I am happy with WSAPI + mod_fcgid + apache, which is similar
to tcpserver + nanoki's http library except for:
 1) there's a process pool => great speed advantage;

You can setup Nanoki that way, more or less, by using a reverse proxy and a process pool, e.g. with nginx:

http
{
    upstream cluster
    {
        server 127.0.0.1:2081;
        server 127.0.0.1:2082;
        server 127.0.0.1:2083;
        server 127.0.0.1:2084;
        server 127.0.0.1:2085;
        server 127.0.0.1:2086;
        server 127.0.0.1:2087;
        server 127.0.0.1:2088;
    }

    server
    {
        listen      3388;
        location    /
        {
            proxy_pass          http://cluster;
            proxy_set_header    Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
    }
}

 2) apache does a few things like keepalive and on-the-fly
compression (no biggie- could be easily done in lua).

Permanent connection are handled by HTTP.lua out-of-the-box, see ConnectionFilter:

http://dev.alt.textdrive.com/browser/HTTP/HTTP.lua#L278

Ditto for compression, assuming one has the proper library binding available, see GZIPFilter:

http://dev.alt.textdrive.com/browser/HTTP/HTTPExtra.lua#L194