Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to cache pages on my nginx site for fast retrieval. Let's say every 5 hours I want to expire all the cache and have it recreated. Will Varnish make calls to the web-server and recreate cache on it's own or will it have to wait till a user requests a page?

share|improve this question

2 Answers 2

No, Varnish does not generate requests that re-create its caches.

You need to make a manual refresh of the pages in order to get the cache warm.

share|improve this answer

varnishd - HTTP accelerator daemon, it's not it's job to handle those kind of things, but what you can do is schedule a cron job (using curl, wget, etc) that would trigger hitting pages that you like and Varnish will cache them.

curl:

[alexus@wcmisdlin02 ~]$ curl --help | grep -- '--silent'
 -s/--silent        Silent mode. Don't output anything
[alexus@wcmisdlin02 ~]$ 

wget:

[alexus@wcmisdlin02 ~]$ wget --help | grep -- '--quiet'
  -q,  --quiet               quiet (no output).
[alexus@wcmisdlin02 ~]$ 
share|improve this answer
    
curl or wget? I don't need the results, I just have to "call" the page and have it triggered without transferring content –  Jimbotron Aug 27 at 20:24
    
@Jimbotron you can always redirect redirect output to >/dev/null) –  alexus Aug 27 at 21:19
    
Yes I can do that but it's still a waste of data transfer. Is there no way to call and abandon request? –  Jimbotron Aug 28 at 20:51
1  
@Jimbotron it's not a waste as Varnish need to preserve a copy of it for next serve it for next user, if something you just doing work on behalf of user, so that user doesn't have to wait for the backend. –  alexus Aug 28 at 20:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.