chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] repl with scgi?


From: Graham Fawcett
Subject: Re: [Chicken-users] repl with scgi?
Date: Wed, 28 Jun 2006 21:35:19 -0400

On 6/28/06, jbarciela jbarciela <address@hidden> wrote:
I found this description: http://python.ca/nas/scgi/protocol.txt, but
it only address the data format, it doesn't talk about what services
(if any) scgi provides. I have seen articles
(http://www.mems-exchange.org/software/scgi/;
http://www.zedshaw.com/projects/scgi_rails/)  talking about clusters,
starting new processes/threads, etc; are those things specified in
scgi itself or you have to do them by hand if you need them?

Before I get started -- keep in mind, you don't need SCGI to build a
Web application in Chicken. You can always write a CGI script --
inefficient but it works! -- or you can use the Spiffy server's own
Web-application procedures to run your application within the Web
server itself. That might let you focus more on learning Chicken and
less on fighting with your Web server configuration.

SCGI is a protocol for binding a Web application to a Web server.
Apache was the first Web server to support SCGI, but it is now
supported by other Web servers as well.

SCGI is analogous to FastCGI -- it is a way of keeping a Web
application running in a persistent process, so that -- unlike CGI --
a new process is not created every time a Web request comes in; so
performance is many times better than CGI in most cases. It's
generally considered to be cleaner, simpler and easier to implement
than FastCGI, though performance is probably similar in most cases.

An SCGI application runs as a process and listens on its own network
port. When the Web server has a request to pass to the Web
application, it sends the request to the application's network port,
communicating via the SCGI protocol. A code-module in the Web server
(in Apache's case, mod_scgi) acts as the "SCGI client" and speaks to
your application which acts as the "SCGI server".

SCGI the protocol does not specify how the Web application process
runs. The original SCGI-server implementation was for Quixote, a
Python web framework, and runs as a forking-server (each request is
handled by a child process, managed in a pool by a controller
process). I'm pretty sure that Thomas' implementation for Chicken is
multithreaded. This matters to your app, but not to the front-end Web
server.

SCGI makes sense if you already have an existing Web server in place
-- one that provides an SCGI module, of course! It can be used to
scale an application, by running one or more Web servers, in front of
one or more SCGI servers (where your application lives), which
themselves are presumably in front of one or more database servers --
a setup called a three-tier architecture -- if that's your cup of tea.

Sorry for being long-winded, but I hope I've answered your questions.

Graham




reply via email to

[Prev in Thread] Current Thread [Next in Thread]