[squid-users] simultanous requests: collapsed_forwarding

Alex Rousskov rousskov at measurement-factory.com
Thu Sep 5 14:24:23 UTC 2019


On 9/5/19 5:52 AM, fansari wrote:

> I ran a test where I start one download with curl and with short delay
> (about 1s) I request the same content by another client.
> 
> 1567673769.781 12123 xxx.xxx.0.1   TCP_MISS/200 15553655 ... HIER_NONE
> 1567673769.782 13992 xxx.xxx.0.239 TCP_MISS/200 15553655 ... HIER_DIRECT
> 
> From the documentation I found that there is a setting called
> "collapsed_forwarding" which when enabled gives the behaviour we want to
> achieve: let the first request finish with download and then handle the
> others from squid cash.

Regardless of the collapsed_forwarding setting, the second request never
waits for the first request to finish downloading the response. Instead:

* When collapsed forwarding is prohibited: There is no waiting at all.

* When collapsed forwarding is allowed: The second request waits until
the response headers arrive.


> I am just wondering about one thing: I did not enable this setting (I also
> tried to set it to "off" explicitly) and nevertheless it already behaves
> this way.

You cannot make that conclusion by examining v3-4 access log records.
Latest (unreleased) Squids mark collapsed requests using a CF tag (e.g.
TCP_CF_MISS): https://github.com/squid-cache/squid/commit/d2a6dcb


> When I interpret the logs correctly the first line indicates a waiting and
> the second shows the download.

Not necessarily:

1. The first access.log record could be a cache hit (by the second
transaction) of an in-progress download initiated by the first
transaction. You build Squid with --enable-delay-pools which marks such
transactions as misses after bug 1001 changes:
https://bugs.squid-cache.org/show_bug.cgi?id=1001

2. The second access.log record can be a regular cache miss (by the
first transaction). It just happened to end a bit later so it was logged
second. You can check request:record mapping by looking at logged client
IPs.



> With "collapsed_forwarding on" it behaves in the same way as with "off". To
> me it looks like as if the collapsing is used regardless whether it is
> enabled or not.

Yes, but probably because there are no collapsable (in Squid
terminology) requests in your tests.

To test collapsed forwarding, you need Squid to receive the second
request _before_ Squid receives the response headers for the first request.


HTH,

Alex.


More information about the squid-users mailing list