[gambit-list] Web applications in Gambit

Andrew Whaley andrew at trailgauge.com
Thu Mar 19 16:37:03 EDT 2009


Hi Marc,

Thanks for your email in response to my post on comp.lang.scheme. For 
the benefit of the other subscribers, I'm trying to create a web 
application framework using Gambit that is secure, performant and above 
all allows great developer productivity.

I'm aiming for something similar to SISCWeb but a lot faster and able to 
support very many concurrent users. I already use Gambit for other 
things like my win-control library that I use for automated application 
testing so I really like Gambit.

I've made some good progress in the last couple of days by finding the 
ssax-sxml library and Francisco Ferreira's basic scgi interface. Putting 
these together with a multithreaded dispatcher, I now have gambit 
serving complex SXML web pages in around 50ms which is about 20 times 
faster than SISCWeb with the same page.

I have an immediate problem in that the main thread which listens for 
incoming connections and then spawns handler threads for each page 
requests works fine if I run it in the REPL window but that then 
prevents REPL from doing anything else. If I try and spawn a separate 
thread for this listener so that I can carry on using REPL then the 
listener stops running unless I repeatedly press return in the REPL window !

I want to keep REPL running concurrently with the listener so that I can 
redefine procedures on the fly during development rather than having to 
stop and start gsi and therefore losing any application state. Have I 
missed something here as it seems that threads are blocked whilst REPL 
is waiting for input ? I'm using 4.4.0 MinGW Windows version.

I have enough working now to start on the continuations based web 
framework but pretty soon I'll need to try and interface with a backend 
database e.g. Oracle or MySQL. The obvious way to do this will be to use 
the relevant C API for the database but I'm guessing that if I call into 
C then all the pseudo-threads in Gambit will stop until the C call 
returns - is this correct ? This would probably OK for a short call but 
would be disastrous  for a long running call e.g. to a database that has 
a latency of at least 30ms and could be several seconds for some queries.

Do you have any thoughts on how I could do this ?

Many thanks

Andrew





More information about the Gambit-list mailing list