Weird backend selection policy
Stig Sandbeck Mathisen
ssm at redpill-linpro.com
Thu Mar 26 11:10:31 CET 2009
On Wed, Mar 25, 2009 at 07:14:45PM +0300, Sergei Kononov wrote:
> Update:
>
> Well, I spent almost whole day to figure out why this problem happend. As I
> mentioned earlier the most strange thing is missing log entries for 404 in
> varnishlog (but they are seen in tcpdump). I tried few modifications to
> vcl_recv and noticed that if remove "pipe" from:
> if ( req.url ~ "^/api/.*" ) {
> set req.backend = b2;
> set req.url = regsub(req.url, "^/api/", "/")
> set req.http.X-Cacheable = "false";
> pipe; # ---> remove it
> }
>
> Everything start to working fine. It's really strange behavior and
> almost unpredictable. I suppose there is some bug in parsing of VCL or
> something related to vcl anyway.
The "pipe" makes all subsequent requests on the same TCP connection go to the
same backend unaltered. When you use "pipe", it's just a stream of bytes
between the client and the backend. Add:
sub vcl_pipe {
set req.http.connection = "close";
}
A comment have been added to sub vcl_pipe in the default VCL in trunk regarding
this issue, see around line 64 in:
http://varnish.projects.linpro.no/browser/trunk/varnish-cache/bin/varnishd/default.vcl
--
Stig Sandbeck Mathisen
Senior systemadministrator, leder faggruppe nettverk
Redpill Linpro AS - Changing the Game
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20090326/fc80666e/attachment-0003.pgp>
More information about the varnish-misc
mailing list