Re: Best practice for caching scenario with different backend servers but same content

2021-10-06 Thread Dridi Boukelmoune
On Mon, Aug 16, 2021 at 1:34 PM Hamidreza Hosseini wrote: > > > In that case, hashing the URL only would prevent you from adding new > domains through your Varnish server. It won't hurt if you know you > will only ever have one domain to deal with, but hashing the host will > also not hurt as

Re: Best practice for caching scenario with different backend servers but same content

2021-08-16 Thread Hamidreza Hosseini
> In that case, hashing the URL only would prevent you from adding new domains through your Varnish server. It won't hurt if you know you will only ever have one domain to deal with, but hashing the host will also not hurt as long as you normalize it to a unique value. Hi, Let me elaborate my

Re: Best practice for caching scenario with different backend servers but same content

2021-08-15 Thread Dridi Boukelmoune
On Sat, Aug 14, 2021 at 10:54 AM Hamidreza Hosseini wrote: > > Hi, > Thanks to you and all varnish team for such answers that helped me alot, > I read the default varnish cache configuration again: > https://github.com/varnishcache/varnish-cache/blob/6.0/bin/varnishd/builtin.vcl > and find out

Re: Best practice for caching scenario with different backend servers but same content

2021-08-14 Thread Hamidreza Hosseini
Hi, Thanks to you and all varnish team for such answers that helped me alot, I read the default varnish cache configuration again: https://github.com/varnishcache/varnish-cache/blob/6.0/bin/varnishd/builtin.vcl and find out vcl_hash as follow: ``` sub vcl_hash { hash_data(req.url); if

Re: Best practice for caching scenario with different backend servers but same content

2021-08-09 Thread Geoff Simmons
On 8/9/21 14:49, Geoff Simmons wrote: > > A hash algorithm computes a number h(b) for a backend b, ... Sorry, this should have been more like h(bereq), meaning that the number is computed from features of the request. From that you get to the choice of a backend. The Varnish hash director uses

Re: Best practice for caching scenario with different backend servers but same content

2021-08-09 Thread Geoff Simmons
Hello, The best way to answer these questions is to start with the last one: On 8/9/21 10:50, Hamidreza Hosseini wrote: > > 6. conceptual question: > > 1.What's the exact difference between hash and shard directive and when > should we use which one? > the Doc says when the backend changes

Re: Best practice for caching scenario with different backend servers but same content

2021-08-09 Thread Hamidreza Hosseini
Hi, This is my configuration based on Doc and sample configuration, I would appreciate if you answer my questions: ``` probe myprobe { .request = "HEAD / HTTP/1.1" "Connection: close" "User-Agent: Varnish Health Probe"; .timeout = 1s; .interval = 5s; .window =

Re: Best practice for caching scenario with different backend servers but same content

2021-08-07 Thread Hamidreza Hosseini
Hi, I read the sample config that you sent but Can I use "bereq.url" in this way: for example I want to shard my requests for live streams based on the url's that clients enter, for example if the following url's are different live streams (stream1 and stream2 are the name of different streams

Re: Best practice for caching scenario with different backend servers but same content

2021-08-05 Thread Guillaume Quintard
Hi, I'm pretty sure there's a confusion with the sequence of actions here. Normalization happen *before* you look into the cache, so that way before you fetch anything from the backend. By the time you cache the data (vcl_backend_response), the hash key has already been set (vcl_hash), it's way

Re: Best practice for caching scenario with different backend servers but same content

2021-08-05 Thread Hamidreza Hosseini
Hi, 1. Is there any way to normalize host headers and other things to say to varnish not to cache the same content for different backend? I want to use round robin director but after fetching the content I want to normalize the header and cache the content, I would appreciate if you give me an

Re: Best practice for caching scenario with different backend servers but same content

2021-08-01 Thread Guillaume Quintard
Hi, There are a lot of things to unpack here. > if a varnish for specific file requests to one backend server and for the same file but to another backend server it would cache that file again because of different Host headers ! so my solution is using fallback director instead of round-robin

Best practice for caching scenario with different backend servers but same content

2021-08-01 Thread Hamidreza Hosseini
Hi, I want to use varnish in my scenario as cache service, I have about 10 http servers that serve Hls fragments as the backend servers and about 5 varnish servers for caching purpose, the problem comes in when I use round-robin director for backend servers in varnish, if a varnish for specific