httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Poirier <poir...@pobox.com>
Subject More accurate logging of requests per connection
Date Tue, 16 Sep 2008 17:56:59 GMT
I recently contributed a new %k log format that is intended to log how 
many requests have been handled on the current connection.  It does this 
by logging the value of conn->keepalives.

However, conn->keepalives isn't, strictly speaking, the number of 
requests the connection has handled.  If keepalives are disabled, it's 
zero.  It's also not incremented when the request count reaches 
MaxKeepAliveRequests, so with e.g. MaxKeepAliveRequests 3, it logs 1,2,3,3.

The attached patch adjusts the value logged, so it's always 1 if 
keepalives are disabled, and if it's the last request (conn->keepalive 
== AP_CONN_CLOSE), we add one so the values logged are 1,2,3,4 instead 
of 1,2,3,3.

There's one remaining problem.  There are some error paths which set 
conn->keepalive to AP_CONN_CLOSE after conn->keepalives has already been 
incremented, and in that case, this logging code will log a value that's 
one too many.  I don't think that's a terrible problem, but I'd welcome 
suggestions on how to catch that case.

Thanks.
Dan Poirier
poirier@pobox.com




Mime
View raw message