Subject: Re: LISP web hosting
From: rpw3@rpw3.org (Rob Warnock)
Date: Sun, 21 Mar 2004 05:00:14 -0600
Newsgroups: comp.lang.lisp
Message-ID: <aBKdnWNRdKoj6MDd3czS-w@speakeasy.net>
Robert Bruce Carleton  <rbc@hakuhale.net> wrote:
+---------------
| I presently run a web hosting company based on FreeBSD servers.
| I've been giving some thought to offering shared server lisp hosting
| services.  Is anyone willing to suggest the kind of lisp environment
| they'd like to see?
+---------------

Keep it simple. For starters, just add Marc Battyani's "mod_lisp" to
your base Apache installation, and allow customers to configure it in
their ".htaccess" files [or if not that, provide a procedure for them
to request that you add configuration lines to "httpd.conf"]. For security,
initially you'll want to restrict it to accessing Unix-domain socket
files and various server ports on "localhost" (IP address [127.0.0.1]).
As you gain experience with it, you might later want to allow some users
to host the Lisp server on a different system than the one running Apache
(for performance), although that requires some *careful* firewalling
(though if properly done, it can increase security).

IMPORTANT ASIDE: "mod_lisp" does *not* require a "Lisp" server per se.
  Its control protocol is a purely textual exchange of ASCII header/value
  pairs, which can easily be parsed by a daemon process written in
  just about any language: Common Lisp, Scheme, C, C++, Java, whatever.
  It just happens to be called "mod_lisp" because that's what the author
  was going to use it for when he cloned it from "mod_jserv" and the
  Apache "mod_example". [Perhaps it should be called just "mod_sock[et]"
  or something, to avoid scaring people? On the other hand, "mod_lisp"
  is good PR for Lisp...]

For security, you also need to allow each customer to run his/her own
copy of their chosen application server (Lisp, Java, whatever), as
themselves (under their UID), since protecting users from each other
within a single Unix process is not yet within the state of the art. ;-}

You will want to provide (if you don't already), some sort of SQL
database, such as MySQL or PostgreSQL or both. [I strongly prefer
the latter myself, but Y+OMMV.]

You will want to establish some reasonable "acceptable use" guidelines
on CPU and memory usage for the persistent user servers (daemons), but
be aware that some Lisps (CMUCL is notable here) "mmap()" a *large*
amount of virtual memory at startup, but then don't actually touch it
until they need it. For example, here's a "ps" on a CMUCL that's been
running as an app server behind Apache continuously for the last three
months (plus another process that I'm doing something else with):

    USER   PID  PPID %CPU %MEM     VSZ   RSS TT WCHAN  STAT     TIME COMMAND
    rpw3 82048 82047  0.0 11.2 1299088 54456 p4 select Ss+  27:14.68 cmucl ...
    rpw3 69831 69814  0.0  4.5 1299076 21780 pe select S+    1:01.99 cmucl ...

Note that the the VSZ values shown (1.3GB per CMCUL) are ludicrous -- that
machine only has 512 MB on it! Even the RSS sizes are a bit large, as you
can see when I type the following into a REPL on the application server
(yes, the GC output format has been customized):

    appsrv> (gc :full t)
    ; Mar 21 02:33:20.75 GC: Start: 15.22 MB in use.
    ; Mar 21 02:33:21.00 GC: Done:  4.39 MB in use, 10.83 MB freed, 0.25 secs.
    appsrv> 

So it's really only using the 20+ MB of the initial image load
plus ~5-20 MB more as web hits occur and GCs bang it back down.

Finally, I strongly encourage allowing users to run Dan Barlow's
"dettachtty", as a way to get at the "console" REPLs of their Lisp
images even though you configure them to start at system boot time.

I'm sure others will chime in, but that's what I'd want (if I weren't
running my own server)...


-Rob

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