Mailing List Archive

[RFC] Changes to pass mode
The original intent was that pass-mode should be able to handle PUT
and POST requests (if invoked from vcl_recv{} and should allow reuse
of the backend connection afterwards.

Judging from the feedback and requests I have received, this is
unnecessary generality. POST and PUT seems to be heavily tangled
in authentication and cookies which disable caching anyway, so using
pipe-mode for those, does not seem to hurt anybody to any extent
that matters.

Discarding the PUT/POST handling requirement from pass, allows me
to treat pass more or less as a miss, and thus avoid a special
case of the functions for talking to the backend, and it gives us
one of the much asked for facilities: slow-client mitigation for
CGI content done in pass mode, almost for free.

This results in some some subtle and some not so subtle changes,
which I am looking for feedback on.

It will help if you have this dot(1) plot open in a window while
reading the rest of this email:
http://phk.freebsd.dk/misc/varnish.gif

Take a moment to follow the green/blue paths which are the normal
hit/miss scenarios.

Pass can take two variants in this new world order, from vcl_recv{}
or from anywhere else.

If vcl_recv{} does pass, an object is created which is not inserted
into the hash table, and it is marked as not cacheable. (The object
will not be inserted in the hash, even if vcl_fetch() invokes "insert".)

We then proceed as a normal cache-miss.

Since the object is not inserted in the hash, the next client to
ask for this url will not find this object and unless that client
also gets a pass in vcl_recv{}, normal processing will happen.

The upshot of this is, that certain clients can be forced to do
a pass in vcl_recv{} without forcing all clients to do this.

If pass is invoked from vcl_miss{} or vcl_fetch{}, an entry
will be inserted into the hash marking this object as a "obj.pass"
object which cannot be cached.

If vcl_hit{} invokes pass, the request will be serviced as a pass,
even if we had found a good cached object.

If vcl_hit{} finds a "obj.pass" hit in the hash, the request
will also be handled as a pass.

The other change
----------------

The other change to be aware of, is that the entire object is
fetched from the backend before vcl_fetch() is called, previously
we only had the headers at that point.

This allows us to detect backend errors in vcl_fetch{}, and once we
implement "retry lookup" we can aim the request at another backend
or whatever error-recovery we prefer.

It also paves the way for gzip'ing things in vcl_fetch() later on.

Does this make sense ?

Any better ideas ?

Does anybody even read this mail-list anymore ? :-)

Poul-Henning

PS: if you want to see the current state diagram, the instructions
for how to create it is at the top of bin/varnishd/cache_center.c


--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
[RFC] Changes to pass mode [ In reply to ]
On Monday 05 February 2007 22:18, Poul-Henning Kamp wrote:
> Does anybody even read this mail-list anymore ? ?:-)

It's a rather quiet place yes, but closely watched.

I'm not quite at the level where I feel I have any technical comments,
but I am happy to se progress.

I just read the Fielding Dissertation, so I expect to be working with Varnish
for quite a while :)

Regards

Gaute Amundsen

--
Programmerer - Pixelhospitalet AS
T?rkoppveien 10, 1570 Dilling
Tlf. 24 12 97 81 - 9074 7344
SV: [RFC] Changes to pass mode [ In reply to ]
Jepp :)

Anders Berg
www.vg.no // VG Nett


-----Opprinnelig melding-----
Fra: varnish-misc-bounces at projects.linpro.no [mailto:varnish-misc-bounces at projects.linpro.no] P? vegne av Poul-Henning Kamp
Sendt: 5. februar 2007 22:18
Til: varnish-misc at projects.linpro.no
Emne: [RFC] Changes to pass mode


Does anybody even read this mail-list anymore ? :-)

Poul-Henning

PS: if you want to see the current state diagram, the instructions
for how to create it is at the top of bin/varnishd/cache_center.c


--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
_______________________________________________
varnish-misc mailing list
varnish-misc at projects.linpro.no
http://projects.linpro.no/mailman/listinfo/varnish-misc

*****************************************************************
Denne fotnoten bekrefter at denne e-postmeldingen ble
skannet av MailSweeper og funnet fri for virus.
*****************************************************************
This footnote confirms that this email message has been
swept by MailSweeper for the presence of computer viruses.
*****************************************************************
SV: [RFC] Changes to pass mode [ In reply to ]
* Poul-Henning
> Does anybody even read this mail-list anymore ? :-)

*hand*

Ingvar


--
N?r alt annet feiler: Symlink
[RFC] Changes to pass mode [ In reply to ]
Poul-Henning Kamp <phk at phk.freebsd.dk> writes:
> Does this make sense ?

Yes.

1) I've had trouble with PASS vs. PIPE in the past which have led me
to conclude that PASS as it is today is not very useful.

There is one downside to PIPE: we can't insert a header telling the
backend that we're acting on behalf of a client, which makes
logging difficult. We *can* do so with PASS, though I believe we
currently don't.

2) The current backend code is fragile, and the separate code paths
make debugging it difficult; as I understand your proposal, the
backend code will become more unified, which will help improve
robustness and error handling and facilitate debugging.

> Any better ideas ?

Not off the top of my head...

> Does anybody even read this mail-list anymore ? :-)

Yes :)

DES
--
Dag-Erling Sm?rgrav
Senior Software Developer
Linpro AS - www.linpro.no
[RFC] Changes to pass mode [ In reply to ]
In message <ujrfy9igrv9.fsf at cat.linpro.no>, Dag-Erling =?iso-8859-1?Q?Sm=F8rgra
v?= writes:
>Poul-Henning Kamp <phk at phk.freebsd.dk> writes:

> There is one downside to PIPE: we can't insert a header telling the
> backend that we're acting on behalf of a client, which makes
> logging difficult. We *can* do so with PASS, though I believe we
> currently don't.

Well, it should be (will be) possible to do that in vcl_recv{} but
it may make sense to have a vcl_pipe{} for that job, to avoid
repetitions in vcl_recv{}.

--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
[RFC] Changes to pass mode [ In reply to ]
"Poul-Henning Kamp" <phk at phk.freebsd.dk> writes:
> Dag-Erling Sm?rgrav <des at linpro.no> writes:
> > There is one downside to PIPE: we can't insert a header telling the
> > backend that we're acting on behalf of a client, which makes
> > logging difficult. We *can* do so with PASS, though I believe we
> > currently don't.
> Well, it should be (will be) possible to do that in vcl_recv{} but
> it may make sense to have a vcl_pipe{} for that job, to avoid
> repetitions in vcl_recv{}.

Well, by definition we *can't* do it in PIPE since PIPE is supposed to
pass traffic back and forth unaltered. We *can* (and IMHO *should*)
do it in PASS.

DES
--
Dag-Erling Sm?rgrav
Senior Software Developer
Linpro AS - www.linpro.no
[RFC] Changes to pass mode [ In reply to ]
In message <ujrzm7qf59a.fsf at cat.linpro.no>, Dag-Erling =?iso-8859-1?Q?Sm=F8rgra
v?= writes:
>"Poul-Henning Kamp" <phk at phk.freebsd.dk> writes:
>> Dag-Erling Sm=F8rgrav <des at linpro.no> writes:
>> > There is one downside to PIPE: we can't insert a header telling the
>> > backend that we're acting on behalf of a client, which makes
>> > logging difficult. We *can* do so with PASS, though I believe we
>> > currently don't.
>> Well, it should be (will be) possible to do that in vcl_recv{} but
>> it may make sense to have a vcl_pipe{} for that job, to avoid
>> repetitions in vcl_recv{}.
>
>Well, by definition we *can't* do it in PIPE since PIPE is supposed to
>pass traffic back and forth unaltered. We *can* (and IMHO *should*)
>do it in PASS.

Weeeell,

We can do it in the _first_ PIPE transaction, and that could maybe
be used to force the backend to close after that transaction, so
we avoid piping more than that one transaction.

--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
SV: [RFC] Changes to pass mode [ In reply to ]
On Feb 7, 2007, at 0:01, Ingvar Hagelund wrote:

> * Poul-Henning
>> Does anybody even read this mail-list anymore ? :-)
>
> *hand*

Here too. :-) The changes proposed looked good, but I didn't feel
qualified to reply.

I'm not actually using Varnish yet. My favorite (upcoming) features
are deflate, vary support and eventually ESI.

Another thing that we need (but I don't think Varnish does yet) is
buffering the response so the backend can be freed up while slow
clients retrieve the data at their leisure. (Apologies if we talked
about this before...)


- ask

--
http://develooper.com/ - http://askask.com/
SV: [RFC] Changes to pass mode [ In reply to ]
In message <E6343E52-3EAE-43B2-9EFD-5A08D34260C9 at develooper.com>, =?ISO-8859-1?
Q?Ask_Bj=F8rn_Hansen?= writes:

>Another thing that we need (but I don't think Varnish does yet) is
>buffering the response so the backend can be freed up while slow
>clients retrieve the data at their leisure. (Apologies if we talked
>about this before...)

It already does this in the normal case, with the change I proposed,
pass will also do that.

--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.