Re: [squid-users] No keep-alives in connections cache<->servers?

From: Pauli Borodulin <[email protected]>
Date: Mon, 31 Mar 2003 05:05:36 +0300

Pauli Borodulin wrote:
> [...]

> Then I checked with packet sniffer that is Squid even sending those
> "Connection: keep-alive" -headers to servers - but no.

Okay, after five hours of Googling, I finally found out what's
"Proxy-Connection: keep-alive" used for. At least I think so. (And,
Inktomi Traffic-server does support it ;-)

Proxy-Connection is sent by client if it's using proxy. Difference
between "Connection: keep-alive" and "Proxy-Connection: keep-alive" is
that "Proxy-Connection: keep-alive" forms keep-alive -connection _only_,
if proxy is able to make keep-alive connection with www-server also.

CLIENT --- PROXY --- WWW-SERVER

Here client would send "Proxy-Connection: keep-alive" to PROXY and PROXY
would send "Connection: keep-alive" to WWW-SERVER, and in case of
success with WWW-SERVER, keep-alive is formed with CLIENT, otherwise
it's rejected totally. This seems to be correct way.

(It would sound more meaningful if CLIENT would always use keep-alive
with PROXY even WWW-SERVER wasn't capable doing it. Does anyone know why
this behaviour isn't used?)

There's problem in Squid in my situation, thou'. My current
configuration is the following:

CLIENT --- PROXY (Squid) --- PROXY (Inktomi) --- WWW-SERVER

Here Squid will send "Proxy-Connection" instead of "Connection", because
  it's connecting (neighbor) proxy, not WWW-SERVER directly.

Squid has some logic sensing if the neighbor proxy can't handle
persistent connections, as FAQ says: "12.24 What does keep-alive ratio
mean?: This is a mechanism to try detecting neighbor caches which might
not be able to deal with persistent connections. Every time we send a
proxy-connection: keep-alive request header to a neighbor, we count how
many times the neighbor sent us a proxy-connection: keep-alive reply
header. Thus, the keep-alive ratio is the ratio of these two counters."

This ratio must be, according to FAQ and http.c, over 50%:

     if ((double) p->stats.n_keepalives_recv / (double)
p->stats.n_keepalives_sent > 0.50)
         httpState->flags.keepalive = 1;

This logic fails to sense the support for keep-alive in at least one
(very likely) case. After Squid is started:

1. CLIENT sends GET to Squid with "Proxy-Connection: keep-alive".
2. Squid connects to neighbor cache with "Proxy-Connection: keep-alive"
and increases "keep-alive request counter".
3. Neighbor cache tries to create keep-alive connection with WWW-server
using header "Connection: keep-alive" (in case of HTTP/1.0).
4. Neighbor fails to create keep-alive connection with WWW-server, so no
keep-alive reply header will be returned to Squid also.

After ten sent keep-alive requests, ratio is first time calculated and
used (set in http.c). If 5 of 10 requests failed, sense logic in Squid
decide that neighbor can't do keep-alive just because this first
WWW-server couldn't do it.

I would propose creating separate configuration parameter for
cache-peer, like "keep-alive" to replace this logic or at least
increasing from 10 to at least 100 in http.c:

Line 984: else if (p->stats.n_keepalives_sent < 10)

I'm using squid-2.5.STABLE2-20030321.

Best regards,

-- 
Pauli Borodulin
boro@fixel.org

Received on Sun Mar 30 2003 - 19:05:46 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:14:26 MST