varnish-cache

How clean the cache on Varnish 3

Recently I started with Varnish and it’s so interesting. For the people that don’t know Varnish-cache is a proxy-cache that you can install on web server and, configured correctly, it can make that your web fly.

How works is easy to understand, when Varnish is installed, you need indicate where must go to request the information that the users are requesting to it. So when the visitors look your web, Varnish download your web for next, send it to users and save the result the time that you indicate. In this time, if other users request your web, if the info is not changed, Varnish do no need to request the web again, saving the bandwidth and cpu, and accomplishing that your web fly.

The last version added new features but, (same when you update your version of JAVA and your application stops working), some methods of the last version don’t work on Varnish 3 so is important know what is the changes for update your applications and plugins.

Probably, the most important change is the method to clean the cache. Now, for clean the cache you need call the ban method. The command is it:

View Code SHELL
1
# /usr/bin/varnishadm -T 127.0.0.1:6082 -S /etc/varnish/secret "ban.url .*"

For the people that don’t know, varnishadm is the console that is installed with the Varnish program, and help you to manage Varnish. It have more options (if you connect with it and execute the command help, it show a long list of commands) between they, are the ban command that replace the old command purge to clean the cache.

So the people that don’t know what is all parameters written on the before command, here are a little summary:

– T
It is the ip:port that the varnishadm response. You can found the configuration in /etc/sysconfig/varnish on the next fields:

  • VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1
  • VARNISH_ADMIN_LISTEN_PORT=6082
– S
It is the route to found the file that contains the pw for connect to varnishadm. You can found on /etc/varnish/secret by default

Leave a Reply

Your email address will not be published. Required fields are marked *