8 Sep 2008 11:40
SCGI patch for mathopd-1.6b9
Michel Lespinasse <walken <at> zoy.org>
2008-09-08 09:40:06 GMT
2008-09-08 09:40:06 GMT
Hi,
I have implemented an SCGI patch for mathopd-1.6b9.
You use it with:
Specials { SCGI { .scgi }}
where the .scgi file is a unix domain socket to the SCGI application.
Also, the SCGI application should have a large enough listen queue to
accomodate the number of simultaneous connections configured in mathopd,
or there is a possibility to get 503 code errors under load.
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 modified get_path_info to consider cases where the open call returns
ENXIO (as happens with unix sockets). When this happens, the finfo field
of the request is not filled in. A new field 'valid_finfo' was added to
track the validity of the finfo field.
P.S. the patch also backports easily to 1.5 based versions.
Hope this helps,
(Continue reading)
RSS Feed