From hugues at betabrand.com Fri May 3 00:05:16 2019 From: hugues at betabrand.com (Hugues Alary) Date: Thu, 2 May 2019 17:05:16 -0700 Subject: storage.memory.free_space and storage.memory.used_space Message-ID: Hi, I am using varnish-6.0.0 revision a068361dff0d25a0d85cf82a6e5fdaf315e06a7d and the malloc storage. My vcl_deliver looks like this: sub vcl_deliver { set resp.http.X-Varnish-Storage = {"Free: "} + storage.memory.free_space + " Used: " + storage.memory.used_space + " Happy? : " + storage.memory.happy; } I am confused because upon making a request to my varnish server, storage.memory.free_space is always equal to storage.memory.used_space * -1. E.g if storage.memory.used_space is 150000.000 then storage.memory.free_space is -150000.000. Moreover, storage.memory.happy is always false. This has been the case for the longest time. I'm pretty sure I had this issue with Varnish 4, and maybe even earlier versions. Am I doing something wrong? Or is this a bug? Sincerely, -Hugues -------------- next part -------------- An HTML attachment was scrubbed... URL: From guillaume at varnish-software.com Fri May 3 00:54:24 2019 From: guillaume at varnish-software.com (Guillaume Quintard) Date: Thu, 2 May 2019 17:54:24 -0700 Subject: storage.memory.free_space and storage.memory.used_space In-Reply-To: References: Message-ID: could it be that you are using unbounded Transient? If so, while it's indeed a bit weird, it's more or less explained by the fact that the space value is irrelevant anyway. -- Guillaume Quintard On Thu, May 2, 2019 at 5:06 PM Hugues Alary wrote: > Hi, > > I am using varnish-6.0.0 revision a068361dff0d25a0d85cf82a6e5fdaf315e06a7d > and the malloc storage. > > My vcl_deliver looks like this: > > sub vcl_deliver { > set resp.http.X-Varnish-Storage = {"Free: "} + > storage.memory.free_space + " Used: " + storage.memory.used_space + " > Happy? : " + storage.memory.happy; > } > > I am confused because upon making a request to my varnish server, storage.memory.free_space > is always equal to storage.memory.used_space * -1. > > E.g if storage.memory.used_space is 150000.000 then > storage.memory.free_space is -150000.000. > > Moreover, storage.memory.happy is always false. > > This has been the case for the longest time. I'm pretty sure I had this > issue with Varnish 4, and maybe even earlier versions. > > Am I doing something wrong? Or is this a bug? > > Sincerely, > -Hugues > > _______________________________________________ > varnish-misc mailing list > varnish-misc at varnish-cache.org > https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hugues at betabrand.com Fri May 3 01:21:02 2019 From: hugues at betabrand.com (Hugues Alary) Date: Thu, 2 May 2019 18:21:02 -0700 Subject: storage.memory.free_space and storage.memory.used_space In-Reply-To: References: Message-ID: Hi Guillaume, Indeed! This is the issue. An error in one of my script is passing -s 'memory=malloc, ' to Varnish, instead of a sane value. Cheers, -Hugues On Thu, May 2, 2019 at 5:54 PM Guillaume Quintard < guillaume at varnish-software.com> wrote: > could it be that you are using unbounded Transient? If so, while it's > indeed a bit weird, it's more or less explained by the fact that the space > value is irrelevant anyway. > > -- > Guillaume Quintard > > > On Thu, May 2, 2019 at 5:06 PM Hugues Alary wrote: > >> Hi, >> >> I am using varnish-6.0.0 revision >> a068361dff0d25a0d85cf82a6e5fdaf315e06a7d and the malloc storage. >> >> My vcl_deliver looks like this: >> >> sub vcl_deliver { >> set resp.http.X-Varnish-Storage = {"Free: "} + >> storage.memory.free_space + " Used: " + storage.memory.used_space + " >> Happy? : " + storage.memory.happy; >> } >> >> I am confused because upon making a request to my varnish server, storage.memory.free_space >> is always equal to storage.memory.used_space * -1. >> >> E.g if storage.memory.used_space is 150000.000 then >> storage.memory.free_space is -150000.000. >> >> Moreover, storage.memory.happy is always false. >> >> This has been the case for the longest time. I'm pretty sure I had this >> issue with Varnish 4, and maybe even earlier versions. >> >> Am I doing something wrong? Or is this a bug? >> >> Sincerely, >> -Hugues >> >> _______________________________________________ >> varnish-misc mailing list >> varnish-misc at varnish-cache.org >> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hetardik.p at gmail.com Wed May 15 11:20:43 2019 From: hetardik.p at gmail.com (Hardik) Date: Wed, 15 May 2019 16:50:43 +0530 Subject: Reg: global variable in vcl Message-ID: Hi Team, I have requirement to use a global variable which i can access through out VCL (particular vcl). I came across globalvar vmod. I want to access this variable for all the requests for that vcl. If really require more information about my requirement I can share. query: -I am not able to get any information about this vmod on internet. Means not used much ? or is there any problem for using this vmod ? -can you point out exact path/location I can checkout and use this vmod, if below path is not correct. ( I am using varnish 6.1 ) https://gitlab.com/uplex/varnish/varnish-objvar/tree/6.1 Thank you Hardik -------------- next part -------------- An HTML attachment was scrubbed... URL: From geoff at uplex.de Wed May 15 11:32:12 2019 From: geoff at uplex.de (Geoff Simmons) Date: Wed, 15 May 2019 13:32:12 +0200 Subject: Reg: global variable in vcl In-Reply-To: References: Message-ID: On 5/15/19 13:20, Hardik wrote: > > -can you point out exact path/location I can checkout and use this vmod, if > below path is not correct. ( I am using varnish 6.1 ) > https://gitlab.com/uplex/varnish/varnish-objvar/tree/6.1 That's a branch, you'll want to check out the 6.1 branch. $ git clone https://code.uplex.de/uplex-varnish/varnish-objvar.git $ cd varnish-objvar/ $ git checkout 6.1 The you can build the version compatible with 6.1 by following the instructions in INSTALL.rst. HTH, Geoff -- ** * * UPLEX - Nils Goroll Systemoptimierung Scheffelstra?e 32 22301 Hamburg Tel +49 40 2880 5731 Mob +49 176 636 90917 Fax +49 40 42949753 http://uplex.de -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: OpenPGP digital signature URL: From hetardik.p at gmail.com Thu May 16 08:41:28 2019 From: hetardik.p at gmail.com (Hardik) Date: Thu, 16 May 2019 14:11:28 +0530 Subject: Reg: global variable in vcl In-Reply-To: References: Message-ID: Hi Geoff, Thank you for the hint. I am able to get the vmod src. Does I have to take care something while using this vmod ? Because first time going to use and also not getting any information about this. -Hardik On Wed, 15 May 2019 at 17:02, Geoff Simmons wrote: > On 5/15/19 13:20, Hardik wrote: > > > > -can you point out exact path/location I can checkout and use this vmod, > if > > below path is not correct. ( I am using varnish 6.1 ) > > > https://gitlab.com/uplex/varnish/varnish-objvar/tree/6.1 > > That's a branch, you'll want to check out the 6.1 branch. > > $ git clone https://code.uplex.de/uplex-varnish/varnish-objvar.git > $ cd varnish-objvar/ > $ git checkout 6.1 > > The you can build the version compatible with 6.1 by following the > instructions in INSTALL.rst. > > > HTH, > Geoff > -- > ** * * UPLEX - Nils Goroll Systemoptimierung > > Scheffelstra?e 32 > 22301 Hamburg > > Tel +49 40 2880 5731 > Mob +49 176 636 90917 > Fax +49 40 42949753 > > http://uplex.de > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hetardik.p at gmail.com Fri May 17 08:16:36 2019 From: hetardik.p at gmail.com (Hardik) Date: Fri, 17 May 2019 13:46:36 +0530 Subject: Reg: global variable in vcl In-Reply-To: References: Message-ID: Hi Team, what is difference between below this ? https://github.com/varnish/varnish-modules/blob/master/src/vmod_var.c and https://code.uplex.de/uplex-varnish/varnish-objvar.git I am familiar with first link flow wise. Generation of *.vcc file in second link is totally different then previous one which I am not familiar with. Someone please clarify confusion that which one should use for global variable vmod ? Thank you Hardik On Thu, 16 May 2019 at 14:11, Hardik wrote: > Hi Geoff, > > Thank you for the hint. I am able to get the vmod src. > > Does I have to take care something while using this vmod ? Because first > time going to use and also not getting any information about this. > > -Hardik > > On Wed, 15 May 2019 at 17:02, Geoff Simmons wrote: > >> On 5/15/19 13:20, Hardik wrote: >> > >> > -can you point out exact path/location I can checkout and use this >> vmod, if >> > below path is not correct. ( I am using varnish 6.1 ) >> > >> https://gitlab.com/uplex/varnish/varnish-objvar/tree/6.1 >> >> That's a branch, you'll want to check out the 6.1 branch. >> >> $ git clone https://code.uplex.de/uplex-varnish/varnish-objvar.git >> $ cd varnish-objvar/ >> $ git checkout 6.1 >> >> The you can build the version compatible with 6.1 by following the >> instructions in INSTALL.rst. >> >> >> HTH, >> Geoff >> -- >> ** * * UPLEX - Nils Goroll Systemoptimierung >> >> Scheffelstra?e 32 >> 22301 Hamburg >> >> Tel +49 40 2880 5731 >> Mob +49 176 636 90917 >> Fax +49 40 42949753 >> >> http://uplex.de >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From geoff at uplex.de Fri May 17 11:09:43 2019 From: geoff at uplex.de (Geoff Simmons) Date: Fri, 17 May 2019 13:09:43 +0200 Subject: Reg: global variable in vcl In-Reply-To: References: Message-ID: On 5/16/19 10:41, Hardik wrote: > > Does I have to take care something while using this vmod ? Because first > time going to use and also not getting any information about this. That's a very generic question. Do you have something specific in mind? objvar is actually a bundle of four VMODs, and they each have documentation as .rst files in the src/ directory. These get converted and installed as man pages on installation. So you might want to start there. To take a guess at possible answers to the generic question, the main thing to decide is the scope and mutability of the variables you want to use. That's what distinguishes the four VMODs: - constant: global constants (immutable) - globalvar: global variables (mutable) - taskvar: variables with task scope - scoped to the client or backend context of a single request/response transaction - topvar: ESI top-level scope - these are variables accessible in client context for an ESI include and all of its sub-includes You should be aware that the global variables use locking and memory barriers to prevent simultaneous updates. So if you have a lot of threads accessing a variable at the same time, you could run into lock contention. Conceivably you might want to think about how memory is allocated for the different scopes. If you only need a couple of variables in VCL, you won't notice the difference. But if you're using a lot of them, if you're trying to minimize RAM usage, trying to minimize workspace size configurations to reduce Varnish's footprint, if you're using a lot of workspace for other purposes (large ESI trees, other VMODs that consume workspace ...) ... then it could matter. The global constants and variables are allocated from the system heap, for the lifetime of the VCL instance. Task scoped variables are allocated from the workspace of the client or backend task. ESI top-level variables are allocated from client workspace, which is re-used for the entire ESI include tree. Workspaces are reset and re-used for new request/response transactions. > what is difference between below this ? > > https://github.com/varnish/varnish-modules/blob/master/src/vmod_var.c > > and > https://code.uplex.de/uplex-varnish/varnish-objvar.git > > I am familiar with first link flow wise. Generation of *.vcc file in second > link is totally different then previous one which I am not familiar with. > Someone please clarify confusion that which one should use for global > variable vmod ? VMOD var supports global variables for the STRING, INT and REAL types, and task-scoped variables for STRING, INT, REAL, DURATION, IP and BACKEND. The objvar VMODs cover all of the VCL data types, and have the different options for scope and mutability described above. They also have methods to undefine or protect a variable (a protected variable may not be changed), and check if a variable is defined or protected. See the .rst files for documentation, or the manpage if you install any of the VMODs. HTH, Geoff -- ** * * UPLEX - Nils Goroll Systemoptimierung Scheffelstra?e 32 22301 Hamburg Tel +49 40 2880 5731 Mob +49 176 636 90917 Fax +49 40 42949753 http://uplex.de -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: OpenPGP digital signature URL: From rodrigo.garcia at the-cocktail.com Fri May 17 12:01:56 2019 From: rodrigo.garcia at the-cocktail.com (=?UTF-8?Q?Rodrigo_Garc=C3=ADa_Su=C3=A1rez?=) Date: Fri, 17 May 2019 14:01:56 +0200 Subject: Bad times in client but not backend side for not cached request Message-ID: Hello everybody. I have this weird issue with Varnish 5.0.0 on Debian 9.4 and maybe somebody here can help me with it. The thing is, I have this request: https://somehost.com//cart/current_cart.json?clear_cart=false&_=1550491039254 It is always a miss in varnish (as it should be) and making only one, works just fine. But doing some performance testing the response times increases quickly. For example, with 2 requests/s, after 4 or 5 request, the response time begins to increase exponentially and after 20 request I have 11s of latency, reaching 40s after 40 requests. If I take out Varnish (sending the request from nginx to the app) it works just fine. And looking at the varnish log, the "%T" format option in the backend log keeps a response <=1s but in the client side I see the incremental reponse times. The request can't be cached so now I am keeping it out from varnish but I don't like the idea of this exception in the configuration and I am worry it could reproduce with other requests (in fact I have two other suspects) so any idea or suggestion will be greatly appreciated. Thanks for your time. -- Rodrigo Garc?a Su?rez rodrigo.garcia at the-cocktail.com 679 141 132 The Cocktail c/ Salamanca 17 28020 Madrid (+34) 915 670 605 www > http://the-cocktail.com -- Este mensaje se dirige exclusivamente a su destinatario. Puede contener informaci?n confidencial sometida a secreto profesional o cuya divulgaci?n est? prohibida, en virtud de la legislaci?n vigente. No est? permitida su divulgaci?n, copia o distribuci?n a terceros sin la autorizaci?n previa y por escrito de The Cocktail. Si ha recibido este mensaje por error, le rogamos nos lo comunique inmediatamente por esta misma v?a y proceda a su destrucci?n. This message is intended exclusively for the individual or entity to which it is addressed and may contain confidential or legally privileged information, which may not be disclosed under current legislation. Any form of disclosure, copying or distribution of this message is strictly prohibited, save with written authorization from The Cocktail. If you have received this message in error, please notify the sender immediately by this way and delete all copies of the message. -------------- next part -------------- An HTML attachment was scrubbed... URL: From slink at schokola.de Fri May 17 14:29:54 2019 From: slink at schokola.de (Nils Goroll) Date: Fri, 17 May 2019 16:29:54 +0200 Subject: Reg: global variable in vcl In-Reply-To: References: Message-ID: Hi, On 17/05/2019 10:16, Hardik wrote: > what is difference between below this ? > > https://github.com/varnish/varnish-modules/blob/master/src/vmod_var.c > > and? > https://code.uplex.de/uplex-varnish/varnish-objvar.git? I would like to add to Geoff's response: * Conceptual differences between the vmods: while the var vmod uses strings to identify variables, the objvar vmods use objects. The main difference is that objects need to be declared in vcl_init, which can be an advantage for code clarity, but does not allow for runtime declaration. Also, object access should be somewhat faster and scale better. * with respect to global variables and types: On 17/05/2019 13:09, Geoff Simmons wrote: > VMOD var supports global variables for the STRING, INT and REAL types, not that I would be aware, to my knowledge the var vmod only supports STRING for global variables. vmod globalvar from the objvar project support virtually all types. In general, to achieve consistent concurrent access to global variables, the var vmod copies the global variable string value to each caller's workspace. The globalvar vmod uses refcounting to avoid copying. Other than for short strings, it should thus use less workspace than the "var" vmod and be more efficient and scalable. (refcounting will most definitely use less workspace for multiple read access within the same task). And once I am at it: > -I am not able to get any information about this vmod on internet. Means not > used much ? It is comparably new (initially released 27 October 2018) and also we at UPLEX are probably not particularly good with marketing, so vmod var will probably be more widely used simply for existing _much_ longer and being mentioned more often. The objvar bundle is being used (and sponsored by) some very high traffic sites and, as mentioned before, was written for optimal flexibility, scalability and efficiency. Nils From guillaume at varnish-software.com Fri May 17 14:34:23 2019 From: guillaume at varnish-software.com (Guillaume Quintard) Date: Fri, 17 May 2019 07:34:23 -0700 Subject: Bad times in client but not backend side for not cached request In-Reply-To: References: Message-ID: Hi, Is the ttl <= 0 when you return from vcl_backend_reponse? It looks like you are telling varnish to cache, for 0 seconds. The result is that it'll coalesce requests, but at the same time, can't reuse the responses, so the backend requests are just serialized. You have two ways to deal with that: - if you know in vcl_recv that the request isn't cacheable, return(pass). - if you discover the uncacheability in vcl_backend_response, set a positive ttl, and set beresp.uncacheable to true. This will tell varnish to remember to non coalesce requests for this object for the duration of the ttl. Note that this is already done in the built-in.vcl ( https://github.com/varnishcache/varnish-cache/blob/master/bin/varnishd/builtin.vcl) that gets appended to your code when you load a vcl. However this only gets executed if you don't return from the routine yourself. Hope that helps, On Fri, May 17, 2019, 05:03 Rodrigo Garc?a Su?rez < rodrigo.garcia at the-cocktail.com> wrote: > Hello everybody. > > I have this weird issue with Varnish 5.0.0 on Debian 9.4 and maybe > somebody here can help me with it. > > The thing is, I have this request: > > > https://somehost.com//cart/current_cart.json?clear_cart=false&_=1550491039254 > > It is always a miss in varnish (as it should be) and making only one, > works just fine. > > But doing some performance testing the response times increases quickly. > For example, with 2 requests/s, after 4 or 5 request, the response time > begins to increase exponentially and after 20 request I have 11s of > latency, reaching 40s after 40 requests. > > If I take out Varnish (sending the request from nginx to the app) it works > just fine. And looking at the varnish log, the "%T" format option in the > backend log keeps a response <=1s but in the client side I see the > incremental reponse times. > > The request can't be cached so now I am keeping it out from varnish but I > don't like the idea of this exception in the configuration and I am worry > it could reproduce with other requests (in fact I have two other suspects) > so any idea or suggestion will be greatly appreciated. > > Thanks for your time. > > > -- > Rodrigo Garc?a Su?rez > rodrigo.garcia at the-cocktail.com > 679 141 132 > > The Cocktail > c/ Salamanca 17 > 28020 Madrid > (+34) 915 670 605 > > www > http://the-cocktail.com > > Este mensaje se dirige exclusivamente a su destinatario. Puede contener > informaci?n confidencial sometida a secreto profesional o cuya divulgaci?n > est? prohibida, en virtud de la legislaci?n vigente. No est? permitida su > divulgaci?n, copia o distribuci?n a terceros sin la autorizaci?n previa y > por escrito de The Cocktail. Si ha recibido este mensaje por error, le > rogamos nos lo comunique inmediatamente por esta misma v?a y proceda a su > destrucci?n. > > This message is intended exclusively for the individual or entity to which > it is addressed and may contain confidential or legally privileged > information, which may not be disclosed under current legislation. Any form > of disclosure, copying or distribution of this message is strictly > prohibited, save with written authorization from The Cocktail. If you have > received this message in error, please notify the sender immediately by > this way and delete all copies of the message. > _______________________________________________ > varnish-misc mailing list > varnish-misc at varnish-cache.org > https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc > -------------- next part -------------- An HTML attachment was scrubbed... URL: From slink at schokola.de Fri May 17 14:35:52 2019 From: slink at schokola.de (Nils Goroll) Date: Fri, 17 May 2019 16:35:52 +0200 Subject: Reg: global variable in vcl In-Reply-To: References: Message-ID: <1eb66b32-7501-9e2b-d1ca-d0fca5a85678@schokola.de> On 17/05/2019 16:29, Nils Goroll wrote: > The globalvar vmod uses refcounting to avoid copying. Risking to get carried away into implementation details: It actually does this only for types which require it, immediate values like REAL, INT etc. do not need refcounting. From geoff at uplex.de Fri May 17 15:14:00 2019 From: geoff at uplex.de (Geoff Simmons) Date: Fri, 17 May 2019 17:14:00 +0200 Subject: Reg: global variable in vcl In-Reply-To: References: Message-ID: On 5/17/19 16:29, Nils Goroll wrote: > > * with respect to global variables and types: > > On 17/05/2019 13:09, Geoff Simmons wrote: > > VMOD var supports global variables for the STRING, INT and REAL types, > > not that I would be aware, to my knowledge the var vmod only supports > STRING for global variables. Yeah I think you're right. I was confused by what the docs for VMOD var say, IMO this could use some better clarity: -----8<----- It supports strings, integers and real numbers. There are methods to get and set each data type. Global variables have a lifespan that extends across requests and VCLs, for as long as the vmod is loaded. The remaining functions have PRIV_TASK lifespan ... -----8<----- The first sentence lists STRING, INT and REAL, and then further down there's a contrast to the "remaining functions" with task scope. Since the paragraph in the middle says something about global variables, I thought it meant that there is support for global variables of those three types. If I'm reading the .vcc file correctly: - VMOD var supports six types, not just those three (STRING, INT, REAL, IP, DURATION and BACKEND). - It supports task scope for all six types. - It also supports global scope for STRING. Best, Geoff -- ** * * UPLEX - Nils Goroll Systemoptimierung Scheffelstra?e 32 22301 Hamburg Tel +49 40 2880 5731 Mob +49 176 636 90917 Fax +49 40 42949753 http://uplex.de -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: OpenPGP digital signature URL: From hetardik.p at gmail.com Sun May 19 12:58:43 2019 From: hetardik.p at gmail.com (Hardik) Date: Sun, 19 May 2019 18:28:43 +0530 Subject: Reg: global variable in vcl In-Reply-To: <1eb66b32-7501-9e2b-d1ca-d0fca5a85678@schokola.de> References: <1eb66b32-7501-9e2b-d1ca-d0fca5a85678@schokola.de> Message-ID: Thank you Geoff and Nils for detailed explanation. I am trying to use one of the vmods as per my requirement. If I face any problem will get back to you. Thanks again. Hardik On Fri, 17 May 2019 at 20:05, Nils Goroll wrote: > On 17/05/2019 16:29, Nils Goroll wrote: > > The globalvar vmod uses refcounting to avoid copying. > > Risking to get carried away into implementation details: It actually does > this > only for types which require it, immediate values like REAL, INT etc. do > not > need refcounting. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hetardik.p at gmail.com Wed May 29 11:54:57 2019 From: hetardik.p at gmail.com (Hardik) Date: Wed, 29 May 2019 17:24:57 +0530 Subject: Reg: backend 'name' in VCL before going to origin Message-ID: Hi Team, Requirement : *to set few headers based on backend origin ( having multiple origins/backends in single director)*. I want to do similar to this. https://stackoverflow.com/questions/43357690/varnish-vcl-how-can-i-switch-on-req-backend-hint sub vcl_backend_fetch { if (bereq.backend.name == "one") { std.log("one"); } else if (bereq.backend.name == "two") { std.log("two"); } else { std.log("neither one"); } } I am trying to do same (inside b_fetch) but getting error that symbol not found. I am using varnish 6.1. Is this different function call/name for varnish 6.1 ? Thank you Hardik -------------- next part -------------- An HTML attachment was scrubbed... URL: From guillaume at varnish-software.com Wed May 29 22:50:41 2019 From: guillaume at varnish-software.com (Guillaume Quintard) Date: Wed, 29 May 2019 15:50:41 -0700 Subject: Reg: backend 'name' in VCL before going to origin In-Reply-To: References: Message-ID: Hi, man vcl is your friend. I believe what you want is "bereq.backend" Also, you could just write: std.log("using backend: " + bereq.backend) note that bereq.backend will return the unresolved backend, meaning that if backends are inside a director, you'll get the name of the director, since the backend choice happens between v_b_f and v_b_r. To know what exact backend was used, you have to check in v_b_r. cheers, -- Guillaume Quintard On Wed, May 29, 2019 at 4:56 AM Hardik wrote: > Hi Team, > > Requirement : *to set few headers based on backend origin ( having > multiple origins/backends in single director)*. > > I want to do similar to this. > https://stackoverflow.com/questions/43357690/varnish-vcl-how-can-i-switch-on-req-backend-hint > > sub vcl_backend_fetch { > if (bereq.backend.name == "one") { > std.log("one"); > } else if (bereq.backend.name == "two") { > std.log("two"); > } else { > std.log("neither one"); > } > } > > > I am trying to do same (inside b_fetch) but getting error that symbol not > found. I am using varnish 6.1. > Is this different function call/name for varnish 6.1 ? > > Thank you > Hardik > > > _______________________________________________ > varnish-misc mailing list > varnish-misc at varnish-cache.org > https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hetardik.p at gmail.com Thu May 30 01:25:58 2019 From: hetardik.p at gmail.com (Hardik) Date: Thu, 30 May 2019 06:55:58 +0530 Subject: Reg: backend 'name' in VCL before going to origin In-Reply-To: References: Message-ID: Thanks Guillaume. I am already using bereq.backend in v_b_f which is giving director name. As you have pointed out, I want 'exact' backend name inside director. Also before sending to origin because want to set few headers for origin as per exact backend. On Thu, 30 May 2019, 04:20 Guillaume Quintard, < guillaume at varnish-software.com> wrote: > Hi, > > man vcl is your friend. I believe what you want is "bereq.backend" > > Also, you could just write: std.log("using backend: " + bereq.backend) > > note that bereq.backend will return the unresolved backend, meaning that > if backends are inside a director, you'll get the name of the director, > since the backend choice happens between v_b_f and v_b_r. To know what > exact backend was used, you have to check in v_b_r. > > cheers, > -- > Guillaume Quintard > > > On Wed, May 29, 2019 at 4:56 AM Hardik wrote: > >> Hi Team, >> >> Requirement : *to set few headers based on backend origin ( having >> multiple origins/backends in single director)*. >> >> I want to do similar to this. >> https://stackoverflow.com/questions/43357690/varnish-vcl-how-can-i-switch-on-req-backend-hint >> >> sub vcl_backend_fetch { >> if (bereq.backend.name == "one") { >> std.log("one"); >> } else if (bereq.backend.name == "two") { >> std.log("two"); >> } else { >> std.log("neither one"); >> } >> } >> >> >> I am trying to do same (inside b_fetch) but getting error that symbol not >> found. I am using varnish 6.1. >> Is this different function call/name for varnish 6.1 ? >> >> Thank you >> Hardik >> >> >> _______________________________________________ >> varnish-misc mailing list >> varnish-misc at varnish-cache.org >> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hetardik.p at gmail.com Thu May 30 06:19:35 2019 From: hetardik.p at gmail.com (Hardik) Date: Thu, 30 May 2019 11:49:35 +0530 Subject: Reg: backend 'name' in VCL before going to origin In-Reply-To: References: Message-ID: Adding one more point. This directory case is regarding fallback and nearest algorithms. Thanks in advance for hint. On Thu, 30 May 2019 at 06:55, Hardik wrote: > Thanks Guillaume. > > I am already using bereq.backend in v_b_f which is giving director name. > As you have pointed out, I want 'exact' backend name inside director. > Also before sending to origin because want to set few headers for origin > as per exact backend. > > On Thu, 30 May 2019, 04:20 Guillaume Quintard, < > guillaume at varnish-software.com> wrote: > >> Hi, >> >> man vcl is your friend. I believe what you want is "bereq.backend" >> >> Also, you could just write: std.log("using backend: " + bereq.backend) >> >> note that bereq.backend will return the unresolved backend, meaning that >> if backends are inside a director, you'll get the name of the director, >> since the backend choice happens between v_b_f and v_b_r. To know what >> exact backend was used, you have to check in v_b_r. >> >> cheers, >> -- >> Guillaume Quintard >> >> >> On Wed, May 29, 2019 at 4:56 AM Hardik wrote: >> >>> Hi Team, >>> >>> Requirement : *to set few headers based on backend origin ( having >>> multiple origins/backends in single director)*. >>> >>> I want to do similar to this. >>> https://stackoverflow.com/questions/43357690/varnish-vcl-how-can-i-switch-on-req-backend-hint >>> >>> sub vcl_backend_fetch { >>> if (bereq.backend.name == "one") { >>> std.log("one"); >>> } else if (bereq.backend.name == "two") { >>> std.log("two"); >>> } else { >>> std.log("neither one"); >>> } >>> } >>> >>> >>> I am trying to do same (inside b_fetch) but getting error that symbol >>> not found. I am using varnish 6.1. >>> Is this different function call/name for varnish 6.1 ? >>> >>> Thank you >>> Hardik >>> >>> >>> _______________________________________________ >>> varnish-misc mailing list >>> varnish-misc at varnish-cache.org >>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc >>> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From guillaume at varnish-software.com Thu May 30 16:53:01 2019 From: guillaume at varnish-software.com (Guillaume Quintard) Date: Thu, 30 May 2019 09:53:01 -0700 Subject: Reg: backend 'name' in VCL before going to origin In-Reply-To: References: Message-ID: Hi, Getting the resolved backend in v_b_f won't be possible until https://github.com/varnishcache/varnish-cache/pull/2680 gets merge. In the meantime (unless you write the vmod for it), there's no way to pre-resolve the director. -- Guillaume Quintard On Wed, May 29, 2019 at 6:26 PM Hardik wrote: > Thanks Guillaume. > > I am already using bereq.backend in v_b_f which is giving director name. > As you have pointed out, I want 'exact' backend name inside director. > Also before sending to origin because want to set few headers for origin > as per exact backend. > > On Thu, 30 May 2019, 04:20 Guillaume Quintard, < > guillaume at varnish-software.com> wrote: > >> Hi, >> >> man vcl is your friend. I believe what you want is "bereq.backend" >> >> Also, you could just write: std.log("using backend: " + bereq.backend) >> >> note that bereq.backend will return the unresolved backend, meaning that >> if backends are inside a director, you'll get the name of the director, >> since the backend choice happens between v_b_f and v_b_r. To know what >> exact backend was used, you have to check in v_b_r. >> >> cheers, >> -- >> Guillaume Quintard >> >> >> On Wed, May 29, 2019 at 4:56 AM Hardik wrote: >> >>> Hi Team, >>> >>> Requirement : *to set few headers based on backend origin ( having >>> multiple origins/backends in single director)*. >>> >>> I want to do similar to this. >>> https://stackoverflow.com/questions/43357690/varnish-vcl-how-can-i-switch-on-req-backend-hint >>> >>> sub vcl_backend_fetch { >>> if (bereq.backend.name == "one") { >>> std.log("one"); >>> } else if (bereq.backend.name == "two") { >>> std.log("two"); >>> } else { >>> std.log("neither one"); >>> } >>> } >>> >>> >>> I am trying to do same (inside b_fetch) but getting error that symbol >>> not found. I am using varnish 6.1. >>> Is this different function call/name for varnish 6.1 ? >>> >>> Thank you >>> Hardik >>> >>> >>> _______________________________________________ >>> varnish-misc mailing list >>> varnish-misc at varnish-cache.org >>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc >>> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From hetardik.p at gmail.com Thu May 30 17:09:49 2019 From: hetardik.p at gmail.com (Hardik) Date: Thu, 30 May 2019 22:39:49 +0530 Subject: Reg: backend 'name' in VCL before going to origin In-Reply-To: References: Message-ID: Hi Guillaume Ok..! Today I saw one VCL where it was resolving actual backend from director in miss/pass function. I have not tried it. Will let you know how it goes.. Thank you Hardik On Thu, 30 May 2019, 22:23 Guillaume Quintard, < guillaume at varnish-software.com> wrote: > Hi, > > Getting the resolved backend in v_b_f won't be possible until > https://github.com/varnishcache/varnish-cache/pull/2680 gets merge. In > the meantime (unless you write the vmod for it), there's no way to > pre-resolve the director. > > -- > Guillaume Quintard > > > On Wed, May 29, 2019 at 6:26 PM Hardik wrote: > >> Thanks Guillaume. >> >> I am already using bereq.backend in v_b_f which is giving director name. >> As you have pointed out, I want 'exact' backend name inside director. >> Also before sending to origin because want to set few headers for origin >> as per exact backend. >> >> On Thu, 30 May 2019, 04:20 Guillaume Quintard, < >> guillaume at varnish-software.com> wrote: >> >>> Hi, >>> >>> man vcl is your friend. I believe what you want is "bereq.backend" >>> >>> Also, you could just write: std.log("using backend: " + bereq.backend) >>> >>> note that bereq.backend will return the unresolved backend, meaning that >>> if backends are inside a director, you'll get the name of the director, >>> since the backend choice happens between v_b_f and v_b_r. To know what >>> exact backend was used, you have to check in v_b_r. >>> >>> cheers, >>> -- >>> Guillaume Quintard >>> >>> >>> On Wed, May 29, 2019 at 4:56 AM Hardik wrote: >>> >>>> Hi Team, >>>> >>>> Requirement : *to set few headers based on backend origin ( having >>>> multiple origins/backends in single director)*. >>>> >>>> I want to do similar to this. >>>> https://stackoverflow.com/questions/43357690/varnish-vcl-how-can-i-switch-on-req-backend-hint >>>> >>>> sub vcl_backend_fetch { >>>> if (bereq.backend.name == "one") { >>>> std.log("one"); >>>> } else if (bereq.backend.name == "two") { >>>> std.log("two"); >>>> } else { >>>> std.log("neither one"); >>>> } >>>> } >>>> >>>> >>>> I am trying to do same (inside b_fetch) but getting error that symbol >>>> not found. I am using varnish 6.1. >>>> Is this different function call/name for varnish 6.1 ? >>>> >>>> Thank you >>>> Hardik >>>> >>>> >>>> _______________________________________________ >>>> varnish-misc mailing list >>>> varnish-misc at varnish-cache.org >>>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc >>>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From guillaume at varnish-software.com Thu May 30 17:18:24 2019 From: guillaume at varnish-software.com (Guillaume Quintard) Date: Thu, 30 May 2019 10:18:24 -0700 Subject: Reg: backend 'name' in VCL before going to origin In-Reply-To: References: Message-ID: Why not share it? I might be missing something. -- Guillaume Quintard On Thu, May 30, 2019 at 10:10 AM Hardik wrote: > Hi Guillaume > > Ok..! > > Today I saw one VCL where it was resolving actual backend from director in > miss/pass function. I have not tried it. Will let you know how it goes.. > > Thank you > Hardik > > On Thu, 30 May 2019, 22:23 Guillaume Quintard, < > guillaume at varnish-software.com> wrote: > >> Hi, >> >> Getting the resolved backend in v_b_f won't be possible until >> https://github.com/varnishcache/varnish-cache/pull/2680 gets merge. In >> the meantime (unless you write the vmod for it), there's no way to >> pre-resolve the director. >> >> -- >> Guillaume Quintard >> >> >> On Wed, May 29, 2019 at 6:26 PM Hardik wrote: >> >>> Thanks Guillaume. >>> >>> I am already using bereq.backend in v_b_f which is giving director >>> name. As you have pointed out, I want 'exact' backend name inside >>> director. Also before sending to origin because want to set few headers >>> for origin as per exact backend. >>> >>> On Thu, 30 May 2019, 04:20 Guillaume Quintard, < >>> guillaume at varnish-software.com> wrote: >>> >>>> Hi, >>>> >>>> man vcl is your friend. I believe what you want is "bereq.backend" >>>> >>>> Also, you could just write: std.log("using backend: " + bereq.backend) >>>> >>>> note that bereq.backend will return the unresolved backend, meaning >>>> that if backends are inside a director, you'll get the name of the >>>> director, since the backend choice happens between v_b_f and v_b_r. To know >>>> what exact backend was used, you have to check in v_b_r. >>>> >>>> cheers, >>>> -- >>>> Guillaume Quintard >>>> >>>> >>>> On Wed, May 29, 2019 at 4:56 AM Hardik wrote: >>>> >>>>> Hi Team, >>>>> >>>>> Requirement : *to set few headers based on backend origin ( having >>>>> multiple origins/backends in single director)*. >>>>> >>>>> I want to do similar to this. >>>>> https://stackoverflow.com/questions/43357690/varnish-vcl-how-can-i-switch-on-req-backend-hint >>>>> >>>>> sub vcl_backend_fetch { >>>>> if (bereq.backend.name == "one") { >>>>> std.log("one"); >>>>> } else if (bereq.backend.name == "two") { >>>>> std.log("two"); >>>>> } else { >>>>> std.log("neither one"); >>>>> } >>>>> } >>>>> >>>>> >>>>> I am trying to do same (inside b_fetch) but getting error that symbol >>>>> not found. I am using varnish 6.1. >>>>> Is this different function call/name for varnish 6.1 ? >>>>> >>>>> Thank you >>>>> Hardik >>>>> >>>>> >>>>> _______________________________________________ >>>>> varnish-misc mailing list >>>>> varnish-misc at varnish-cache.org >>>>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc >>>>> >>>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From hetardik.p at gmail.com Fri May 31 08:47:06 2019 From: hetardik.p at gmail.com (Hardik) Date: Fri, 31 May 2019 14:17:06 +0530 Subject: Reg: backend 'name' in VCL before going to origin In-Reply-To: References: Message-ID: Hi Guillaume, There shard algorithm is used for director. That's why it is working. I tried same and able to get exact backend name in v_b_f. new di_utc_0 = directors.shard(); di_utc_0.add_backend(be_utc_16); di_utc_0.reconfigure(); But I can not use shard algorithm as requirement is to use fallback/nearest. I understood your point that currently no function call available which can provide exact backend. Still if any work around for this then please let me know. It is really required. Thank you Hardik On Thu, 30 May 2019 at 22:48, Guillaume Quintard < guillaume at varnish-software.com> wrote: > Why not share it? I might be missing something. > -- > Guillaume Quintard > > > On Thu, May 30, 2019 at 10:10 AM Hardik wrote: > >> Hi Guillaume >> >> Ok..! >> >> Today I saw one VCL where it was resolving actual backend from director >> in miss/pass function. I have not tried it. Will let you know how it >> goes.. >> >> Thank you >> Hardik >> >> On Thu, 30 May 2019, 22:23 Guillaume Quintard, < >> guillaume at varnish-software.com> wrote: >> >>> Hi, >>> >>> Getting the resolved backend in v_b_f won't be possible until >>> https://github.com/varnishcache/varnish-cache/pull/2680 gets merge. In >>> the meantime (unless you write the vmod for it), there's no way to >>> pre-resolve the director. >>> >>> -- >>> Guillaume Quintard >>> >>> >>> On Wed, May 29, 2019 at 6:26 PM Hardik wrote: >>> >>>> Thanks Guillaume. >>>> >>>> I am already using bereq.backend in v_b_f which is giving director >>>> name. As you have pointed out, I want 'exact' backend name inside >>>> director. Also before sending to origin because want to set few headers >>>> for origin as per exact backend. >>>> >>>> On Thu, 30 May 2019, 04:20 Guillaume Quintard, < >>>> guillaume at varnish-software.com> wrote: >>>> >>>>> Hi, >>>>> >>>>> man vcl is your friend. I believe what you want is "bereq.backend" >>>>> >>>>> Also, you could just write: std.log("using backend: " + bereq.backend) >>>>> >>>>> note that bereq.backend will return the unresolved backend, meaning >>>>> that if backends are inside a director, you'll get the name of the >>>>> director, since the backend choice happens between v_b_f and v_b_r. To know >>>>> what exact backend was used, you have to check in v_b_r. >>>>> >>>>> cheers, >>>>> -- >>>>> Guillaume Quintard >>>>> >>>>> >>>>> On Wed, May 29, 2019 at 4:56 AM Hardik wrote: >>>>> >>>>>> Hi Team, >>>>>> >>>>>> Requirement : *to set few headers based on backend origin ( having >>>>>> multiple origins/backends in single director)*. >>>>>> >>>>>> I want to do similar to this. >>>>>> https://stackoverflow.com/questions/43357690/varnish-vcl-how-can-i-switch-on-req-backend-hint >>>>>> >>>>>> sub vcl_backend_fetch { >>>>>> if (bereq.backend.name == "one") { >>>>>> std.log("one"); >>>>>> } else if (bereq.backend.name == "two") { >>>>>> std.log("two"); >>>>>> } else { >>>>>> std.log("neither one"); >>>>>> } >>>>>> } >>>>>> >>>>>> >>>>>> I am trying to do same (inside b_fetch) but getting error that symbol >>>>>> not found. I am using varnish 6.1. >>>>>> Is this different function call/name for varnish 6.1 ? >>>>>> >>>>>> Thank you >>>>>> Hardik >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> varnish-misc mailing list >>>>>> varnish-misc at varnish-cache.org >>>>>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc >>>>>> >>>>> -------------- next part -------------- An HTML attachment was scrubbed... URL: