[plt-scheme] just starting, comming from j2ee

From: Noel Welsh (noelwelsh at yahoo.com)
Date: Mon Nov 8 08:25:23 EST 2004

> My question is, how would the architecture be with PLT?
> Behind Apache with some equivalent to mod_lisp?  (I know
> PLT has its own web server but I understand is not too
> secure so far.)

As others have mentioned, I'd place the PLT server behind
Apache.  This is the situation at untyped.com and I am
happy
with it.
 
> Is it posible to build a *high performance*, *highly
> scalable* web site (say, Amazon) using PLT? With
> continuations for linear flow control, or they will kill
> performance?

No-one has done this but in theory is should be possible.
The main issue is distributing requests across multiple web
servers.  There are two options:

  - store all state in a database

  - have smart load-balancers that return requests to the
    originating server

To do the former requires serializing continuations, which
only Gambit and SISC support at the moment.  To do the
latter requires investing in some expensive-but-proven
hardware from Foundry or Alteon.


On Scheme For Web Services
-------------------------

IMHO Scheme has two 'killer app' features for web services:

  - continuations
  - close integration with XML

Continuations give you function call semantics in web
pages.
This gets around so many problems with web apps -- passing
parameters between servlets, forgetting to store stuff in
session variables etc.  Writing J2EE web apps seems like an
exercise in masochism in comparison.

The close integration with XML makes rendering HTML a
breeze.  Most templating systems (JSP, PHP, XSLT etc.) have
one of two problems:

  1. poor abstraction facilities
  2. poor integration with the host language

E.g. 1:

Flickr has 60K lines of application code, and 60K lines of
templates
(http://www.unmediated.org/archives/2004/10/flickr_architec_1.php)
To me that is an insane amoount of template code,
suggesting
that the templating system (PHP-based) is incapable of
expressing useful abstractions.  This has been my
experience
with JSP as well.

In contrast, when generating HTML from Scheme you don't
need
to enter a special templating language, so the full power
of
the language is available.

E.g. 2: I refer you to the song and dance needed to pass
parameters into XSLT, or to perform an XPath query, from
within Java.

In contrast Scheme has XML transformation and querying
(WebIt and SXPath respectively) as 'built-in'.  I use the
term 'built-in' to contrast with the Java scenario where
these facilities are provided by interpreters written in
Java but not actually Java; the Scheme systems *are*
Scheme.


On SISC vs PLT Scheme
---------------------

I've written a fair amount on SISC code (see
http://schematics.sourceforge.net/scheme-london/nmk-case-study.pdf)
and lots of PLT Scheme code.  My impressions:

  - PLT is a nicer environment.  It's module system is
    better, DrScheme is great for finding bugs, and I like
    the libraries.

  - SISC gives you access to the Java APIs, which avoids a
    lot of drudge-work (e.g. writing database drivers)

  - SISC's Java FFI is a bit of a pain.  JScheme is better
    but SISC is the only Java-based Scheme to support full
    continuations, which you really want when writing web
    apps.

HTH,
Noel

=====
Email: noelwelsh <at> yahoo <dot> com
AIM: noelhwelsh

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Posted on the users mailing list.