[plt-scheme] Faster CGI

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Mon Dec 8 10:02:26 EST 2008

Hi Henk,

If you are worried about memory usage and the Web Server, there are
two approaches you can take:

* Use the LRU manager that lets you set a bound on memory usage.

http://docs.plt-scheme.org/web-server/lru_ss.html

* Use the stateless language that uses no memory for continuations

http://docs.plt-scheme.org/web-server/stateless-servlets.html

Jay

On Sat, Dec 6, 2008 at 3:16 PM, Henk Boom <lunarc.lists at gmail.com> wrote:
> 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?
>
>    Henk
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>



-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://jay.teammccarthy.org

"The glory of God is Intelligence" - D&C 93


Posted on the users mailing list.