Subject: Re: Differenz between developing websites with PHP/LISP
From: rpw3@rpw3.org (Rob Warnock)
Date: Fri, 08 Sep 2006 05:20:00 -0500
Newsgroups: comp.lang.lisp
Message-ID: <aZCdnV1SJ7pN3pzYnZ2dnUVZ_sKdnZ2d@speakeasy.net>
Torsten Zühlsdorff  <thornythegod@arcor.de> wrote:
+---------------
| Robert Uhl schrieb:
| > Araneida is a nice little web server; then there's AllegroServe or
| > Portable AllegroServe (I use the latter with the WebActions framework);
| > and there're TNBL and UnCommon Web and KPAX & CL-HTTP which all
| > immediately come to mind.  There're probably more, too.  CLiki is your
| > friend:-)
| 
| That means that i need a little web server behind my apache-webserver?
+---------------

Well, yes, but... The "little web server behind Apache" is more like
a "little CGI server" than a full "web server" per se. It doesn't have
to handle the full range of HTTP request types; doesn't have to serve up
static files & images (if you don't want it to); doesn't have to handle
SSL (you can let Apache do that). Have you ever looked at FastCGI or
"mod_jserv"?  Well, "mod_lisp" <http://www.cliki.net/mod_lisp> is like
those, but simpler. There's a tiny piece that goes inside Apache that
talks to your Lisp server (over a socket) only when the right kind of
request comes to the Apache server.

[Actually, if you're in an environment where you *don't* control your
web server but you *are* allowed to run CGI scripts/programs and leave
persistent daemon processes running, you can use "mod_proxy" or FastCGI
or even (as I do) a small C program that runs as a CGI but then connects
to a local-domain socket to talk "mod_lisp" protocol to the Lisp server.]

But, yes. The most common way of using Lisp in web servers is for Lisp
to run as a persistent daemon process -- either as a full web server
[like CL-HTTP] or behind some other full web server (e.g., Apache).

However, for prototyping or development, it *is* possible to run Lisp
as a traditional CGI program, firing up a whole new process for every
web request. And if you build a special "heap image" file that has all
of your web infrastructure already in it, that doesn't have to be *too*
horribly slow -- I've gotten ~6 requests/sec with CLISP and ~7 requests/sec
with CMUCL [same demo program in both cases]. This is (just barely) fast
enough for you to get a taste of what doing web apps in Lisp is like.

But with my little C-based CGI program that connect to a persistent
CMUCL process, I get ~70 requests/sec. I haven't used "mod_lisp" myself,
but I've heard that several hundred requests/sec is possible with it.
Hmmm... On the "tbnl-devel" list, Marc Battyani reported 440 req/s for
a fixed reply, if you enable the option that keeps the socket open
between multiple requests. That's *fast*!


-Rob

p.s. The pages used for the "traditional CGI" timing results above
and the "C-based-socket-trampoline + persistent-CMUCL-daemon" result
can be found below, including the application source code [though
not the infrastructure code yet, sorry]:

    http://rpw3.org/hacks/lisp/clisp-demo.cgi
    http://rpw3.org/hacks/lisp/cmucl-demo.cgi
    http://rpw3.org/hacks/lisp/appsrv-demo.lhp

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607