[plt-scheme] Faster CGI

From: Henk Boom (lunarc.lists at gmail.com)
Date: Sat Dec 6 17:16:09 EST 2008

I am looking for a way to serve many small sites (for 1-2 week school
projects) running servlets in Scheme. In the past I have been using
PHP, since it is very easy to deploy because of the built-in
functionality provided by the hosting company. I would really prefer
to use Scheme, though.

The PLT Web Server seems to use too much memory for a shared hosting
environment (they start to complain when I break ~80MiB). Using the
PLT Web Server also makes me either use one instance per site (again
giving memory issues), or mess with my the configuration for each new
site I put up. (with CGI and PHP I only need to do the configuration
in one place: my host's control panel). I like to play around with
lots of small sites, often for 1-2 week school projects which get left
up permanently afterwards, so this gets a little awkward.

I want to make sure it's clear that I'm not complaining about the PLT
Web Server, I just don't think it was designed with a use like mine in
mind. Please correct me if you disagree.

CGI scripts, on the other hand, are very easy to deploy, and take no
memory when not in use, but are too slow because of the start-up time.
The lack of persistent continuations is not a problem for me, since I
am not planning to make use of that feature in these small projects.

I'm thinking that I could implement a Scheme 'launcher', to avoid the
servlet startup cost. The launcher would accept signals containing a
filename, and would use dynamic-require to run a specific function of
that module in a separate thread. Then, the #! line in my servlets
would invoke a command to send a message to this launcher.

Given that the modules could use parameters instead of global
variables, this doesn't sound difficult to me. On the other hand, it
sounds like part of the PLT Web Server's purpose is to implement
something similar, so would I end up with similar memory issues?

Alternatively, I have heard of a FastCGI interface for Scheme, but
haven't actually seen anything concrete. Does anyone know more?


Posted on the users mailing list.