httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Pane <bp...@pacbell.net>
Subject Re: mod_file_cache performance
Date Tue, 03 Jul 2001 02:46:17 GMT
dean gaudet wrote:
[...]

>a mostly optimal syscall sequence for responses to a keep-alive
>connection on linux should look something like:
>
>	sockfd = accept();
>	fcntl(sockfd, F_SETFL, O_NDELAY)
>	setsockopt(sockfd, TCP_CORK = 1)
>	while (1) {
>		rc = read(sockfd);
>		if (rc <= 0) {
>			save_errno = errno;
>			/* send any remaining packets now */
>			setsockopt(sockfd, TCP_CORK = 0);
>			if (rc == 0) break;
>			if (save_errno == EAGAIN) {
>				poll(until we can read sockfd);
>				continue;
>			}
>			/* log error */
>			break;
>		}
>		/* parse request */
>		respfd = open(response_file);
>		write(sockfd, response headers)
>		sendfile(sockfd, respfd)
>		close(respfd)
>	}
>	close(sockfd);
>

The current 2.0 httpd does basically this, except that it resets the
TCP_CORK and TCP_NODELAY flags (to 'off' and 'on,' respectively)
after each sendfile call (rather than just when it gets EAGAIN on a
read).  This seems like a bug.  Is there some context in which the resetting
of these flags after every sendfile call is really necessary?

--Brian



Mime
View raw message