httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: Which thread/process
Date Thu, 12 Aug 1999 23:35:39 GMT
On Thu, 12 Aug 1999, Ryan Bloom wrote:

> 
> > to be honest, i find your zillion of pipes solution to be extremely
> > distasteful. 
> 
> Why?  The only one that are actually open, and the ones that are in use
> currently.  When the server dies, they go away, and the purpose is
> performance.  If I need to create three named pipes each time I want to
> execute a cgi, that is wasted time.  I would much rather just open the
> pipes and execute the cgi.

Why?  Your solution requires a priori knowledge of the maximum number of
concurrent requests possible.  I don't believe this is knowledge which ANY
module should be privy to -- it requires too much of an intimate
understanding of what each MPM is doing.

What do you do when we can support 10000 concurrent connections?  This is
not an impossible scenario, this is reality -- this is the realm that we
will be entering.  You're going to have 10000 (or wait, is it 30000?)
named pipes sitting there consuming inodes?  Oh are you going to start
putting a filesystem hash structure on them now because a directory with
30k filenames in it has linear lookup issues on most unixes?

I never suggested creating named pipes on the fly.  I suggested creating
one during configuration.

You don't need three sockets -- sockets are bi-directional.  One would
handle stdin/stdout. 

stderr is connected to the log, you don't need it connected back to the
httpd child.

Let me be more explicit:
    
    in httpd during post_config:
	create unix domain socket $serverroot/logs/cgisock
	fork() and create cgisockd process  (actually use the
	other_child API)

    in httpd during the cgi handler:

	fd = open("$serverroot/logs/cgisock", O_RDWR);
	fill in a cgisock request structure
	write(fd, &cgisock_req, sizeof(cgisock_req));

	read/write gets you stdout/stdin of the cgi
    
    in cgisockd:

	cgisock = socket();
	bind(cgisock, "$serverroot/logs/cgisock");
	for(;;) {
	    fd = accept(cgisock);
	    if (fork() == 0) {
		read(fd, &cgisock_req, sizeof(cgisock_req));
		close(0);
		close(1);
		dup2(fd, 0);
		dup2(fd, 1);
		close(2);
		dup2(lookup_correct_logfd(cgisock_req), 2);
		exec(args from cgisock_req);
	    }
	    close(fd);
	    while (waitpid(-1, NULL, WNOHANG) > 0) {
		;
	    }
	}

Dean


Mime
View raw message