Mailing List Archive

RFC: unify directors and backends vcl interface
backends and directors are both represented as VCL_BACKEND aka struct director,
yet VCL authors need to differentiate between them:

* backends are represented directly as the BACKEND type
* directors are represented as vmod objects, for which a method (.backend() by
convention only) returns a BACKEND

I don't see why we would need to make this distinction and getting rid of it
would simplify VCL code generation and -refactoring. Consider the case having
backend "b" which you now want to layer under director "d": all instances of "b"
in the vcl now need to be replaced with something like "d.backend()".

I see two obvious options to simplify:

* implement backends as vmod objects

and/or

* add a default getter method for objects such that

d == d.backend()

Opinions?
_______________________________________________
varnish-dev mailing list
varnish-dev@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev
Re: RFC: unify directors and backends vcl interface [ In reply to ]
my example was missing the point

On 19/09/2018 12:14, Nils Goroll wrote:
> backend "b" which you now want to layer under director "d": all instances of "b"
> in the vcl now need to be replaced with something like "d.backend()".

... while, if we had a common accessor, b could be renamed to bb and the
director be called b.
_______________________________________________
varnish-dev mailing list
varnish-dev@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev
Re: RFC: unify directors and backends vcl interface [ In reply to ]
On Wed, Sep 19, 2018 at 12:19 PM Nils Goroll <slink@schokola.de> wrote:
>
> my example was missing the point
>
> On 19/09/2018 12:14, Nils Goroll wrote:
> > backend "b" which you now want to layer under director "d": all instances of "b"
> > in the vcl now need to be replaced with something like "d.backend()".
>
> ... while, if we had a common accessor, b could be renamed to bb and the
> director be called b.

That won't work when .backend() takes arguments *cough* hash *cough*.

I think the confusion is mostly that we make an amalgam of the VMOD
object and the underlying director. I'm not strictly against adding some
magic to VCL, in this case saying that having a no-arg method returning
a VCL_BACKEND could be used automagically when casting an
"expression" to a backend and even enforce that the name of the no-arg
method is .backend().

I suggested in the past that "vmod-object ~ arg" syntax could automatically
be turned into "vmod-object.match(arg)" when we have a matching (pun
intended) "BOOL .match(SINGLE-ARG)" method.

In case it's not clear, I think it's a good idea, and I'm merely discussing
caveats to consider. Mainly, disambiguation.

Dridi
_______________________________________________
varnish-dev mailing list
varnish-dev@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev
Re: RFC: unify directors and backends vcl interface [ In reply to ]
--------
In message <CABoVN9Cq9zWMpCErJZcO+460QN-iF5jcaDDp_zjxjRDx9baukw@mail.gmail.com>, Dridi Boukelmoune writes:

>I think the confusion is mostly that we make an amalgam of the VMOD
>object and the underlying director. [...]

Well, there is a lot of ways to get confused, and I have yet to find
any obvious ways to make all the confusion go away.

I already thought about the hidden "are you a backend?" method Dridi
proposes, but it opens a lot of corner cases and becomes quite
complicated.

Most of the ideas I have toyed with, which supressed a *lot* of
confusion is stuff which forces a major version release, and I'm
not quite sure I'm ready for that yet.

One thing I *really* miss right now is some serious high-end
benchmarking, to inform decisions about how much CPU we can afford
to "waste" on stuff like this.

--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk@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-dev mailing list
varnish-dev@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev
Re: RFC: unify directors and backends vcl interface [ In reply to ]
On 19/09/2018 22:20, Poul-Henning Kamp wrote:
> One thing I *really* miss right now is some serious high-end
> benchmarking, to inform decisions about how much CPU we can afford
> to "waste" on stuff like this.

Apologies for playing this back to you, but you seem to imply that we would need
some kind of run-time method resolution and this is in no way what I had been
thinking of when I proposed to dedicate an "object accessor" method.

Re Dridi:

On 19/09/2018 19:08, Dridi Boukelmoune wrote:
> That won't work when .backend() takes arguments *cough* hash *cough*.

Sure, I am aware that the simple text replacement example is a special case -
and it was only that, an example.

> I suggested in the past that "vmod-object ~ arg" syntax could automatically
> be turned into "vmod-object.match(arg)" when we have a matching (pun
> intended) "BOOL .match(SINGLE-ARG)" method.

+1

Nils
_______________________________________________
varnish-dev mailing list
varnish-dev@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev
Re: RFC: unify directors and backends vcl interface [ In reply to ]
--------
In message <ac30c32f-dc7c-1e38-5d32-f454c679463c@schokola.de>, Nils Goroll writes:
>On 19/09/2018 22:20, Poul-Henning Kamp wrote:
>> One thing I *really* miss right now is some serious high-end
>> benchmarking, to inform decisions about how much CPU we can afford
>> to "waste" on stuff like this.
>
>Apologies for playing this back to you, but you seem to imply that we would need
>some kind of run-time method resolution and this is in no way what I had been
>thinking of when I proposed to dedicate an "object accessor" method.

I was talking in context of the broader backend-issues, refcounting
and all that.

--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk@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-dev mailing list
varnish-dev@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev