Michel Lespinasse | 25 Aug 2008 23:37

SCGI proof-of-concept implementation

Hi,

I've been looking at the scgi protocol and found it really easy to
implement. Would there be any interest in this ? and if so, is it too
late to make it into mathopd-1.6 already ?

Attached is a small proof-of-concept patch to start up the discussion.
I'm not sure if majordomo likes attachments, so if it gets eaten please
get it at http://www.lespinasse.org/mathopd-scgi.diff instead.

The idea is this:
* process_cgi was renamed into process_cgi_scgi. It builds the CGI
  environment as before, then calls either process_cgi or process_scgi.
* process_cgi forkexecs the CGI script. The master process keeps
  a socketpair to talk with it.
* process_scgi connects to an existing SCGI unix socket socket, and the
  master process keeps that socket to talk with it. The client_input pool
  is prefilled with the CGI environment variables converted to SCGI format.
* calling writetochild directly at the end of process_scgi is not necessary
  for correctness, but I found out that it made a large difference (35%) in
  performance when the SCGI serves small (3KB) cached replies.

I have a few questions about how to go further:

Currently, my patch uses the following configuration item:
Specials { SCGI { .scgi }}

The .scgi file must exist, but it can't be the unix socket for the scgi
process - otherwise, get_path_info() complains that it cannot openit. I
have not found a nice workaround for this yet, so I just use a hardcoded
(Continue reading)

Michel Lespinasse | 25 Aug 2008 23:43

Re: SCGI proof-of-concept implementation

On Mon, Aug 25, 2008 at 02:37:18PM -0700, Michel Lespinasse wrote:
> Attached is a small proof-of-concept patch to start up the discussion.
> I'm not sure if majordomo likes attachments, so if it gets eaten please
> get it at http://www.lespinasse.org/mathopd-scgi.diff instead.

And I, of course, forgot to attach it. Here it is, hope it'll make it to
the list.

Cheers,

--

-- 
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.
Attachment (mathopd-scgi.diff): text/x-diff, 5612 bytes

Gmane