Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Varnish: Misc

Modification to url lookup

 

 

Varnish misc RSS feed   Index | Next | Previous | View Threaded


arundobriyaliitkgp at gmail

May 21, 2012, 5:42 AM

Post #1 of 3 (340 views)
Permalink
Modification to url lookup

Hi,
Is it possible to smehow fire multiple queries to the varnish cache
depending on the output of the cache hit or miss of a
url. So, if a particular url is not present in the cache, I want to modify
this url to create a new url.
Then I want to do a lookup using the new url, to see if this new url is in
the cache or not.

Thanks
Arun


perbu at varnish-software

May 21, 2012, 9:37 AM

Post #2 of 3 (325 views)
Permalink
Re: Modification to url lookup [In reply to]

Hi Arun,

On Mon, May 21, 2012 at 2:42 PM, Arun Dobriyal <arundobriyaliitkgp [at] gmail
> wrote:

> Hi,
> Is it possible to smehow fire multiple queries to the varnish cache
> depending on the output of the cache hit or miss of a
> url. So, if a particular url is not present in the cache, I want to modify
> this url to create a new url.
> Then I want to do a lookup using the new url, to see if this new url is in
> the cache or not.
>

That is doable.

Take https://www.varnish-cache.org/trac/wiki/VCLExampleRestarts and modify
it. You probably want to trigger the restarts in vcl_miss instead. If you
reach it you've missed the cache, then just alter the URL and restart.


--
Per Buer
Phone: +47 21 98 92 61 / Mobile: +47 958 39 117 / Skype: per.buer
*Varnish makes websites fly!*
Whitepapers <http://www.varnish-software.com/whitepapers> |
Video<http://www.youtube.com/watch?v=x7t2Sp174eI> |
Twitter <https://twitter.com/varnishsoftware>


arundobriyaliitkgp at gmail

May 22, 2012, 1:15 AM

Post #3 of 3 (365 views)
Permalink
Re: Modification to url lookup [In reply to]

Hi ,

Take https://www.varnish-cache.org/trac/wiki/VCLExampleRestarts and modify
> it. You probably want to trigger the restarts in vcl_miss instead. If you
> reach it you've missed the cache, then just alter the URL and restart.
>

Thanks @Per , I was looking for this only.

I modified the vcl file and the content of my vcl_miss file is

* sub vcl_miss {
if(req.restarts==0){
std.log("I came here "+req.http.host+" and the url is "+req.url);

return(restart);
}
return (fetch);
}*


Clearly the above code should also work (It will enter the if block once
whenever it gets a cache miss.. but then subsequently the req.restarts will
increase and varnish wont enter the block) . But when I tested this on my
machine.. I get these strange messages on the varnishlog, and varnish cant
load any page.

* 0 Debug - "INCOMPLETE AT: cnt_miss(1213)"
0 WorkThread - 0xb15fd0e0 start
0 CLI - Rd vcl.load "boot" ./vcl.ndNJIZ0m.so
0 CLI - Wr 200 36 Loaded "./vcl.ndNJIZ0m.so" as "boot"
0 CLI - Rd vcl.use "boot"
0 CLI - Wr 200 0
0 CLI - Rd start
0 Debug - "Acceptor is epoll"
0 CLI - Wr 200 0
0 WorkThread - 0xb78a90e0 start
0 WorkThread - 0xb78980e0 start
0 WorkThread - 0xb78870e0 start
0 WorkThread - 0xb78760e0 start
0 WorkThread - 0xb78650e0 start
0 WorkThread - 0xb78540e0 start
0 WorkThread - 0xb78430e0 start
0 WorkThread - 0xb78320e0 start
0 WorkThread - 0xb78210e0 start
0 CLI - Rd ping
0 CLI - Wr 200 19 PONG 1337673620 1.0
0 CLI - Rd ping
0 CLI - Wr 200 19 PONG 1337673623 1.0
0 CLI - Rd ping*


What is this error about ?

Thanks
Arun Dobriyal

Varnish misc RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.