Varnish web site optimization

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
blackandcode's picture

Hello everybody

I'm new to Balkan group. I have one question regarding optimizing site with Varnish. I have installed varnish and Expire modules and setup them. They are working very well but I have one problem regarding deleting cache from varnish.

The problem is how to delete varnish cache only for index(home) page and not to delete cache for other pages. I look at he varnish log and I found that whole varnish cache is deleted every time Drupal executes command

ban req.http.host ~ www.cdm.me && req.url ~ "/"

This command is executed by varnish module or expire module.

So the question is how to fix this? How can I delete only cache on home page?

Comments

Have you looked at the Cache

Ivan Zugec's picture

Have you looked at the Cache Expiration (http://drupal.org/project/expire) module. I remember a presentation where the presenter said they used this module to purge specific page from Varnish over the administrative socket.

Try out the module.

We've been using Varnish on

slashrsm's picture

We've been using Varnish on Drupal 7 in production for about a year now. We are using Varnish module to handle clears and it works OK.

We have some custom logic also, that call function in varnish.module to execute bans.

Your ban command looks OK. Maybe you should check what host is beeing used to save pages. It is not the same if you ban www.cdm.me or cdm.me. And I am not sure that you can use wildcard on host, so you should config your setup to only use one I guess.

Janez Urevc - software engineer @ Examiner.com - @slashrsm - janezurevc.name

Varnish web site optimization - Solution

blackandcode's picture

Thanks for answers! But unfortunately they didn't help me a lot. At the end I revised all used modules:

  1. Varnish
  2. Expire module

And changed their code a little bit. They had a few bugs. Now site is working very good