You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by aw...@dm4.com.pl on 2006/08/30 16:30:34 UTC

[users@httpd] Do KeepAlive options have a problem with counting ?

Hi

Maybe problem is known for years but I could not find any information
about it :/ so ... I suspect there is a problem with counting
MaxKeepAliveRequests counter :/ Please tell me if I'm wrong ...

Version:
**********
anws:~# apache -v
Server version: Apache/1.3.34 (Debian)
Server built:   Aug 16 2006 12:32:35
**********

I have very simple test config:
*********
ServerRoot /etc/apache
ServerName localhost 
ErrorLog logs/error_testowy.log
DocumentRoot /var/www
LoadModule mime_module /usr/lib/apache/1.3/mod_mime.so
LoadModule config_log_module /usr/lib/apache/1.3/mod_log_config.so
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog logs/access_log common
KeepAlive on
MaxKeepAliveRequests 2
KeepAliveTimeout 130
*********

As you can see there is MaxKeepAliveRequests=2 so apache should accept
TCP/IP connection to the server, send 1st HTTP answer for request, wait
for the 2nd HTTP request on this same TCP/IP connection and then (after
the 2nd HTTP request) close TCP/IP connection. As I can see this is not
true :/

Let's check tcp/ip connections to port 80. There is null when I'm
starting: 

*******
anws:/var/www# netstat -na --protocol=inet | grep 80 ; date tcp        0
   0 0.0.0.0:80              0.0.0.0:*               LISTEN     
*******

Now, I'm looking at my site in my favorit browser :) and I can see new
TCP/IP connection:
*****
anws:/var/www# netstat -na --protocol=inet | grep 80 ; date
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:80            127.0.0.1:1904          ESTABLISHED
tcp        0      0 127.0.0.1:1904          127.0.0.1:80            ESTABLISHED
śro sie 30 11:43:09 CEST 2006
*****

1st HTTP request was served.
Now, I'm looking at my site in brobser again and I can see that my TCP/IP
connection is still active :/

*****
anws:/var/www# netstat -na --protocol=inet | grep 80 ; date tcp        0
   0 0.0.0.0:80              0.0.0.0:*               LISTEN tcp        0 0
   127.0.0.1:80            127.0.0.1:1904          ESTABLISHED tcp
 0      0 127.0.0.1:1904          127.0.0.1:80            ESTABLISHED śro
sie 30 11:43:16 CEST 2006
*****

2nd HTTP request was served by this same TCP/IP connection and coneection
is still active :/

I'm looking at my site in brobser again and I can see that my TCP/IP
connection is in closing state:

*****
anws:/var/www# netstat -na --protocol=inet | grep 80 ; date tcp        0
   0 0.0.0.0:80              0.0.0.0:*               LISTEN tcp        0 0
   127.0.0.1:1904          127.0.0.1:80            TIME_WAIT śro sie 30
11:43:22 CEST 2006
*****

but this is after 3rd HTTP request (not after the 2nd as I have written in
my config). 

To be sure that it was not cached I can show you also CustomLog:

*****
127.0.0.1 - - [30/Aug/2006:11:43:07 +0200] "GET /index.cos HTTP/1.1" 200 12
127.0.0.1 - - [30/Aug/2006:11:43:14 +0200] "GET /index.cos HTTP/1.1" 200 12
127.0.0.1 - - [30/Aug/2006:11:43:19 +0200] "GET /index.cos HTTP/1.1" 200 12
*****

So there were three HTTP request with 12 bytes response :/

It seems like problem with counting from 0 not from 1 (loop programing problem?) Any suggestion :/ 

regards
-- 
AndY


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org