Mailing List Archive

update1: sub probe_resp - VIP RFC
first update based on feedback from Dridi

Hi,

https://github.com/varnishcache/varnish-cache/wiki/Varnish-Improvement-Proposals :
"The VIP procedure starts with a discussions on varnish-dev"

I had skipped this bit for previous suggestions, but this time I want to get it
right. I'd like to propose the following:


# Synopsis

Add support for calling vcl subs on the response of backend probes.

# Why?

Add a way to manipulate backends not just on the basis of a binary health check
result, but optionally also on the basis of other information returned by the
backend with the probe response.

One example would be to dynamically change the weight of backends based on a
load metric returned with the probe response, which will also require
vmod_directors to support changing the weight dynamically.

# How?

* Add VCC support to register VCL subs with probes

* Add a default vcl_probe_response sub to the builtin.vcl which implements the
current behavior. Probes without an explicit response sub definition will
use vcl_probe_response

* in probe response vcl context, make the following objects available

- analogous to beresp

- beresp.backend
- beresp.http.*
- beresp.proto
- beresp.status
- beresp.reason

- later?
- beresp.body

By design, all access should be read-only, but we might want to
have all but .backend writable for practical reasons (writes
having no effect other than being visible in the sub probe_resp)

- probe.* attributes of the probe (read-only)

- probe.name
- probe.expected_response
- probe.timeout
- probe.interval
- probe.initial
- probe.window
- probe.threshold

* a probe response vcl sub may return with the following

ok
fail

* The default vcl_probe_response:

sub vcl_probe_response {
if (beresp.proto ~ "^HTTP/\d+\.\d+$" &&
beresp.status == probe.expected_response) {
return (fail);
}

return (ok);
}

this matches the existing implementation, we might want to change
the first condition to beresp.proto ~ "^HTTP/1\.[01]$" once this
is in place

* Toy example for the use case mentioned above (needs more changes)

sub probe_weight {
if (beresp.http.X-Load ~ "^\d+\.\d+$") {
my_rr.set_weight(beresp.backend,
1 / std.real(req.http.X-Load, 1.0));
}
}



_______________________________________________
varnish-dev mailing list
varnish-dev@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev
Re: update1: sub probe_resp - VIP RFC [ In reply to ]
--------
In message <89511585-58c2-bc0e-b8f6-100d281bcfbd@schokola.de>, Nils Goroll writ
es:

I notice you do not make anything available about the backend,
only about the probe and the response ?

Is that deliberate or accidental ?


--
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: update1: sub probe_resp - VIP RFC [ In reply to ]
--------
In message <CABoVN9CWq1_9QhFK_6qy4AoVnYoAxFp+OU0FQe=3Bfsz+=SMxQ@mail.gmail.com>
, Dridi Boukelmoune writes:

>I notice you do not make anything available about the backend,
>only about the probe and the response ?
>
>Is that deliberate or accidental ?
>
>
>Did you miss the beresp.backend maybe ?

No, I did not.

I was wonder if more intimate exposure was considered or ignored ?

--
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: update1: sub probe_resp - VIP RFC [ In reply to ]
On 16/04/17 19:17, Poul-Henning Kamp wrote:
>> Did you miss the beresp.backend maybe ?
> No, I did not.
>
> I was wonder if more intimate exposure was considered or ignored ?

The whole point of the VIP RFC is to modify the backend, and I intended to add
vmod functions later to (indirectly) manipulate the BACKEND object available in
the sub.

I had given this example:

On 12/04/17 07:35, Nils Goroll wrote:
> * Toy example for the use case mentioned above (needs more changes)
>
> sub probe_weight {
> if (beresp.http.X-Load ~ "^\d+\.\d+$") {
> my_rr.set_weight(beresp.backend,
> 1 / std.real(req.http.X-Load, 1.0));
> }
> }

the vmod code would check if the BACKEND object passed is contained in my_rr.

Nils

_______________________________________________
varnish-dev mailing list
varnish-dev@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev
Re: update1: sub probe_resp - VIP RFC [ In reply to ]
--------
In message <434280ee-a081-87f6-278c-5156cae6d7e3@schokola.de>, Nils Goroll writes:
>On 16/04/17 19:17, Poul-Henning Kamp wrote:
>>> Did you miss the beresp.backend maybe ?
>> No, I did not.
>>
>> I was wonder if more intimate exposure was considered or ignored ?
>
>The whole point of the VIP RFC is to modify the backend, and I intended to add
>vmod functions later to (indirectly) manipulate the BACKEND object available in
>the sub.

So this is where I think all the dragons will be found: Doesn't the
backend implementation get any say in this?

Summary: I'm OK with the idea, but we need to find out how this works
with dynamic backends, in particular dynamic backends speaking FOOPROTO
rather than HTTP.

--
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: update1: sub probe_resp - VIP RFC [ In reply to ]
> So this is where I think all the dragons will be found: Doesn't the
> backend implementation get any say in this?

I touched on that in the first thread. As of today probes only exist
for VBE backends.

> Summary: I'm OK with the idea, but we need to find out how this works
> with dynamic backends, in particular dynamic backends speaking FOOPROTO
> rather than HTTP.

There is no probing mechanism for FOO backends/director, unless we
abstract the probes to make them usable with arbitrary
implementations. But I don't reckon the current behavior would be a
one-size-fits-all for other types of backends.

Dridi

_______________________________________________
varnish-dev mailing list
varnish-dev@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev