Re: How to adjust priority for both backend healthy

2021-02-18 Thread Guillaume Quintard
I'm formally abandoning this thread and will only focus on the other one
-- 
Guillaume Quintard


On Thu, Feb 18, 2021 at 8:21 AM Hamidreza Hosseini 
wrote:

> I read you article and it was great but I didn't find out my answer, I
> said that I have 2 layer varnish:  disk layer and ram layer and ram layer,
> I want to check the health of layer 2 for example:
>
> Varnish Ram ===> Varnish Disk ===> Webserver
> I adjust this probe on varnish ram:
>
> probe myprobe {
> .request =
>   "HEAD / HTTP/1.1"
>   "Connection: close"
>   "User-Agent: Varnish Health Probe";
> .timeout = 1s;
> .interval = 5s;
> .window = 5;
> .threshold = 3;
> }
> and varnish says: ` 0 Backend_health - boot.varnish_1 Still sick 
> 0 3 5 0.00 0.00 Open error 111 (Connection refused)`
> And I think it is right because it checks HEAD / on varnish backends and
> there is nothing there!
> So I'm asking how should I configure the probe to trigger another varnish
> health as a backend
>
> Best regards.
>
> --
> *From:* Hamidreza Hosseini
> *Sent:* Thursday, February 18, 2021 5:31 AM
> *To:* varnish-misc@varnish-cache.org 
> *Subject:* How to adjust priority for both backend healthy
>
> I have two backend that both of them are healthy and I use fallback for
> them and I want to say all request should goes to backend1 and if backend1
> become unhealthy all requests should go to backend2 but backend1 has higher
> priority and when backend1 become healthy, all  requests should go to
> backend1,
> How can I define priority?
> my config:
>
> ```
> vcl 4.1;
>
> import directors;
>
> probe myprobe {
> .request =
>   "HEAD / HTTP/1.1"
>   "Connection: close"
>   "User-Agent: Varnish Health Probe";
> .timeout = 1s;
> .interval = 5s;
> .window = 5;
> .threshold = 3;
> }
>
> backend backend1 { .host = "backend1"; .port = "8080"; .probe = myprobe; }
>
> backend backend2 { .host = "backend2"; .port = "8080"; .probe = myprobe; }
> backend backend3 { .host = "backend3"; .port = "8080"; .probe = myprobe; }
>
>
> sub vcl_init {
>
> new backend2_cluster = directors.round_robin();
> backend2_cluster.add_backend(backend2);
> backend3_cluster.add_backend(backend3);
>
>
> new backend_cluster_fb = directors.fallback();
> backend1_fb.add_backend(backend1);
> backend2_cluster_fb.add_backend(backend2_cluster.backend());
> }
>
> sub vcl_recv {
> set req.backend_hint = backend_cluster_fb.backend();
>
> }
>
> ```
>
> ___
> varnish-misc mailing list
> varnish-misc@varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
___
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


Re: Varnish Health check

2021-02-18 Thread Guillaume Quintard
please keep the mailing-list in CC for future communications.

> Open error 111 (Connection refused)

This is a TCP issue, the backend is just not accepting the connection, are
you sure the IP:PORT is right?

-- 
Guillaume Quintard


On Thu, Feb 18, 2021 at 8:16 AM Hamidreza Hosseini 
wrote:

> I read you article and it was great but I didn't find out my answer, I
> said that I have 2 layer varnish:  disk layer and ram layer and ram layer,
> I want to check the health of layer 2 for example:
>
> Varnish Ram ===> Varnish Disk ===> Webserver
> I adjust this probe on varnish ram:
>
> probe myprobe {
> .request =
>   "HEAD / HTTP/1.1"
>   "Connection: close"
>   "User-Agent: Varnish Health Probe";
> .timeout = 1s;
> .interval = 5s;
> .window = 5;
> .threshold = 3;
> }
> and varnish says: ` 0 Backend_health - boot.varnish_1 Still sick 
> 0 3 5 0.00 0.00 Open error 111 (Connection refused)`
> And I think it is right because it checks HEAD / on varnish backends and
> there is nothing there!
> So I'm asking how should I configure the probe to trigger another varnish
> health as a backend
>
> Best regards.
>
> --
> *From:* Guillaume Quintard 
> *Sent:* Thursday, February 18, 2021 7:14 AM
> *To:* Hamidreza Hosseini 
> *Subject:* Re: Varnish Health check
>
> Ah, I missed the multilayer setup. In that case, you can have a look at
> this one: https://info.varnish-software.com/blog/howto-respond-to-probes
> --
> Guillaume Quintard
>
>
> On Thu, Feb 18, 2021 at 7:08 AM Hamidreza Hosseini 
> wrote:
>
> How can I probe a backend varnish? for example I have 2 layer varnish disk
> layer and ram layer and ram layer want to check the health of layer 2, How
> can I do this? I've done something but I have error:
>
> sudo varnishadm backend.list -p
> Backend name   Admin  ProbeLast updated
> boot.varnish_1 probe  Sick0/5
>   Current states  good:  0 threshold:  3 window:  5
>   Average response time of good probes: 0.00
>   Oldest == Newest
>    Happy
>
> sudo varnishlog -g raw -i Backend_health
> 0 Backend_health - boot.varnish_1 Still sick  0 3 5 0.00
> 0.00 Open error 111 (Connection refused)
>
> my config:
> probe myprobe {
> .request =
>   "HEAD / HTTP/1.1"
>   "Connection: close"
>   "User-Agent: Varnish Health Probe";
> .timeout = 1s;
> .interval = 5s;
> .window = 5;
> .threshold = 3;
> }
> --
> *From:* Guillaume Quintard 
> *Sent:* Thursday, February 18, 2021 7:00 AM
> *To:* Hamidreza Hosseini 
> *Cc:* varnish-misc@varnish-cache.org 
> *Subject:* Re: Varnish Health check
>
> Hi,
>
> The answer will be highly dependent on your setup, usually you want to
> find a probe request that will truly test the backend. One option, if you
> have control over the backend is to write a page to test the subsystem and
> make sure everybody's up.
>
> This link may prove useful:
> https://info.varnish-software.com/blog/backends-load-balancing
>
> --
> Guillaume Quintard
>
>
> On Thu, Feb 18, 2021 at 4:51 AM Hamidreza Hosseini 
> wrote:
>
> Hi,
> I want to adjust health check on my varnish backends, But I dont know how
> can I know they are healthy or not
> because the nodes are up and running and even service is up but varnish
> does'nt work for all requests (just third of them are responding till I
> restart it (It happens sometimes)).
> How can I check this?
> ```
> backend server1 {
> .host = "server1.example.com";
> .probe = {
> .request =
>   "HEAD / HTTP/1.1"
>   "Connection: close"
>   "User-Agent: Varnish Health Probe";
> .timeout = 1s;
> .interval = 5s;
> .window = 5;
> .threshold = 3;
> }
> }
> ```
> ___
> varnish-misc mailing list
> varnish-misc@varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
>
___
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


Re: How to adjust priority for both backend healthy

2021-02-18 Thread Hamidreza Hosseini
I read you article and it was great but I didn't find out my answer, I said 
that I have 2 layer varnish:  disk layer and ram layer and ram layer, I want to 
check the health of layer 2 for example:

Varnish Ram ===> Varnish Disk ===> Webserver
I adjust this probe on varnish ram:

probe myprobe {
.request =
  "HEAD / HTTP/1.1"
  "Connection: close"
  "User-Agent: Varnish Health Probe";
.timeout = 1s;
.interval = 5s;
.window = 5;
.threshold = 3;
}
and varnish says: ` 0 Backend_health - boot.varnish_1 Still sick  0 3 5 
0.00 0.00 Open error 111 (Connection refused)`
And I think it is right because it checks HEAD / on varnish backends and there 
is nothing there!
So I'm asking how should I configure the probe to trigger another varnish 
health as a backend

Best regards.


From: Hamidreza Hosseini
Sent: Thursday, February 18, 2021 5:31 AM
To: varnish-misc@varnish-cache.org 
Subject: How to adjust priority for both backend healthy

I have two backend that both of them are healthy and I use fallback for them 
and I want to say all request should goes to backend1 and if backend1 become 
unhealthy all requests should go to backend2 but backend1 has higher priority 
and when backend1 become healthy, all  requests should go to backend1,
How can I define priority?
my config:

```
vcl 4.1;

import directors;

probe myprobe {
.request =
  "HEAD / HTTP/1.1"
  "Connection: close"
  "User-Agent: Varnish Health Probe";
.timeout = 1s;
.interval = 5s;
.window = 5;
.threshold = 3;
}

backend backend1 { .host = "backend1"; .port = "8080"; .probe = myprobe; }

backend backend2 { .host = "backend2"; .port = "8080"; .probe = myprobe; }
backend backend3 { .host = "backend3"; .port = "8080"; .probe = myprobe; }


sub vcl_init {

new backend2_cluster = directors.round_robin();
backend2_cluster.add_backend(backend2);
backend3_cluster.add_backend(backend3);


new backend_cluster_fb = directors.fallback();
backend1_fb.add_backend(backend1);
backend2_cluster_fb.add_backend(backend2_cluster.backend());
}

sub vcl_recv {
set req.backend_hint = backend_cluster_fb.backend();

}

```

___
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


Re: How to adjust priority for both backend healthy

2021-02-18 Thread Guillaume Quintard
Hi,

No offense, I think you would get better answers on this mailing list if
you started only one thread and focused on it. The current way of sending
similar but slightly different questions, and then duplicating messages
make it hard to focus for people willing to help you.

With this being said, I believe I replied to this question in the other
thread.

Kind regards,

-- 
Guillaume Quintard


On Thu, Feb 18, 2021 at 7:11 AM Hamidreza Hosseini 
wrote:

> How can I probe a backend varnish? for example I have 2 layer varnish disk
> layer and ram layer and ram layer want to check the health of layer 2, How
> can I do this? I've done something but I have error:
>
> sudo varnishadm backend.list -p
> Backend name   Admin  ProbeLast updated
> boot.varnish_1 probe  Sick0/5
>   Current states  good:  0 threshold:  3 window:  5
>   Average response time of good probes: 0.00
>   Oldest == Newest
>    Happy
>
> sudo varnishlog -g raw -i Backend_health
> 0 Backend_health - boot.varnish_1 Still sick  0 3 5 0.00
> 0.00 Open error 111 (Connection refused)
>
> my config:
> probe myprobe {
> .request =
>   "HEAD / HTTP/1.1"
>   "Connection: close"
>   "User-Agent: Varnish Health Probe";
> .timeout = 1s;
> .interval = 5s;
> .window = 5;
> .threshold = 3;
> }
>
> --
> *From:* Hamidreza Hosseini
> *Sent:* Thursday, February 18, 2021 5:31 AM
> *To:* varnish-misc@varnish-cache.org 
> *Subject:* How to adjust priority for both backend healthy
>
> I have two backend that both of them are healthy and I use fallback for
> them and I want to say all request should goes to backend1 and if backend1
> become unhealthy all requests should go to backend2 but backend1 has higher
> priority and when backend1 become healthy, all  requests should go to
> backend1,
> How can I define priority?
> my config:
>
> ```
> vcl 4.1;
>
> import directors;
>
> probe myprobe {
> .request =
>   "HEAD / HTTP/1.1"
>   "Connection: close"
>   "User-Agent: Varnish Health Probe";
> .timeout = 1s;
> .interval = 5s;
> .window = 5;
> .threshold = 3;
> }
>
> backend backend1 { .host = "backend1"; .port = "8080"; .probe = myprobe; }
>
> backend backend2 { .host = "backend2"; .port = "8080"; .probe = myprobe; }
> backend backend3 { .host = "backend3"; .port = "8080"; .probe = myprobe; }
>
>
> sub vcl_init {
>
> new backend2_cluster = directors.round_robin();
> backend2_cluster.add_backend(backend2);
> backend3_cluster.add_backend(backend3);
>
>
> new backend_cluster_fb = directors.fallback();
> backend1_fb.add_backend(backend1);
> backend2_cluster_fb.add_backend(backend2_cluster.backend());
> }
>
> sub vcl_recv {
> set req.backend_hint = backend_cluster_fb.backend();
>
> }
>
> ```
>
> ___
> varnish-misc mailing list
> varnish-misc@varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
___
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


Re: How to adjust priority for both backend healthy

2021-02-18 Thread Hamidreza Hosseini
How can I probe a backend varnish? for example I have 2 layer varnish disk 
layer and ram layer and ram layer want to check the health of layer 2, How can 
I do this? I've done something but I have error:

sudo varnishadm backend.list -p
Backend name   Admin  ProbeLast updated
boot.varnish_1 probe  Sick0/5
  Current states  good:  0 threshold:  3 window:  5
  Average response time of good probes: 0.00
  Oldest == Newest
   Happy

sudo varnishlog -g raw -i Backend_health
0 Backend_health - boot.varnish_1 Still sick  0 3 5 0.00 0.00 
Open error 111 (Connection refused)

my config:
probe myprobe {
.request =
  "HEAD / HTTP/1.1"
  "Connection: close"
  "User-Agent: Varnish Health Probe";
.timeout = 1s;
.interval = 5s;
.window = 5;
.threshold = 3;
}


From: Hamidreza Hosseini
Sent: Thursday, February 18, 2021 5:31 AM
To: varnish-misc@varnish-cache.org 
Subject: How to adjust priority for both backend healthy

I have two backend that both of them are healthy and I use fallback for them 
and I want to say all request should goes to backend1 and if backend1 become 
unhealthy all requests should go to backend2 but backend1 has higher priority 
and when backend1 become healthy, all  requests should go to backend1,
How can I define priority?
my config:

```
vcl 4.1;

import directors;

probe myprobe {
.request =
  "HEAD / HTTP/1.1"
  "Connection: close"
  "User-Agent: Varnish Health Probe";
.timeout = 1s;
.interval = 5s;
.window = 5;
.threshold = 3;
}

backend backend1 { .host = "backend1"; .port = "8080"; .probe = myprobe; }

backend backend2 { .host = "backend2"; .port = "8080"; .probe = myprobe; }
backend backend3 { .host = "backend3"; .port = "8080"; .probe = myprobe; }


sub vcl_init {

new backend2_cluster = directors.round_robin();
backend2_cluster.add_backend(backend2);
backend3_cluster.add_backend(backend3);


new backend_cluster_fb = directors.fallback();
backend1_fb.add_backend(backend1);
backend2_cluster_fb.add_backend(backend2_cluster.backend());
}

sub vcl_recv {
set req.backend_hint = backend_cluster_fb.backend();

}

```

___
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


Re: Varnish Health check

2021-02-18 Thread Christian Nölle

Hi everybody,

Am 18.02.2021 um 16:00 schrieb Guillaume Quintard:


I want to adjust health check on my varnish backends, But I dont know
how can I know they are healthy or not



The answer will be highly dependent on your setup, usually you want
to find a probe request that will truly test the backend. One option,
if you have control over the backend is to write a page to test the 
subsystem and make sure everybody's up.


True. It definitely is important to have a close look at the system that 
you are performing the health check on.


We are running a php based cms and are running a health check on a small 
script. That script is testing if there is an active db, if the 
rendering engine of the cms is responding and if everthing is fine. it 
is returning a "1". If not, it will exit and the probe fails, rendering 
the backend as sick.


--
-c



smime.p7s
Description: S/MIME Cryptographic Signature
___
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


Re: Varnish Health check

2021-02-18 Thread Guillaume Quintard
Hi,

The answer will be highly dependent on your setup, usually you want to find
a probe request that will truly test the backend. One option, if you have
control over the backend is to write a page to test the subsystem and make
sure everybody's up.

This link may prove useful:
https://info.varnish-software.com/blog/backends-load-balancing

-- 
Guillaume Quintard


On Thu, Feb 18, 2021 at 4:51 AM Hamidreza Hosseini 
wrote:

> Hi,
> I want to adjust health check on my varnish backends, But I dont know how
> can I know they are healthy or not
> because the nodes are up and running and even service is up but varnish
> does'nt work for all requests (just third of them are responding till I
> restart it (It happens sometimes)).
> How can I check this?
> ```
> backend server1 {
> .host = "server1.example.com";
> .probe = {
> .request =
>   "HEAD / HTTP/1.1"
>   "Connection: close"
>   "User-Agent: Varnish Health Probe";
> .timeout = 1s;
> .interval = 5s;
> .window = 5;
> .threshold = 3;
> }
> }
> ```
> ___
> varnish-misc mailing list
> varnish-misc@varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
___
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


How to adjust priority for both backend healthy

2021-02-18 Thread Hamidreza Hosseini
I have two backend that both of them are healthy and I use fallback for them 
and I want to say all request should goes to backend1 and if backend1 become 
unhealthy all requests should go to backend2 but backend1 has higher priority 
and when backend1 become healthy, all  requests should go to backend1,
How can I define priority?
my config:

```
vcl 4.1;

import directors;

probe myprobe {
.request =
  "HEAD / HTTP/1.1"
  "Connection: close"
  "User-Agent: Varnish Health Probe";
.timeout = 1s;
.interval = 5s;
.window = 5;
.threshold = 3;
}

backend backend1 { .host = "backend1"; .port = "8080"; .probe = myprobe; }

backend backend2 { .host = "backend2"; .port = "8080"; .probe = myprobe; }
backend backend3 { .host = "backend3"; .port = "8080"; .probe = myprobe; }


sub vcl_init {

new backend2_cluster = directors.round_robin();
backend2_cluster.add_backend(backend2);
backend3_cluster.add_backend(backend3);


new backend_cluster_fb = directors.fallback();
backend1_fb.add_backend(backend1);
backend2_cluster_fb.add_backend(backend2_cluster.backend());
}

sub vcl_recv {
set req.backend_hint = backend_cluster_fb.backend();

}

```

___
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


Varnish Health check

2021-02-18 Thread Hamidreza Hosseini
Hi,
I want to adjust health check on my varnish backends, But I dont know how can I 
know they are healthy or not
because the nodes are up and running and even service is up but varnish does'nt 
work for all requests (just third of them are responding till I restart it (It 
happens sometimes)).
How can I check this?
```
backend server1 {
.host = "server1.example.com";
.probe = {
.request =
  "HEAD / HTTP/1.1"
  "Connection: close"
  "User-Agent: Varnish Health Probe";
.timeout = 1s;
.interval = 5s;
.window = 5;
.threshold = 3;
}
}
```
___
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc