Jump to content

Unbelievable results with Varnish


Recommended Posts

I've tried nearly all VCL configs here, on 3.4.2

but none of them seems to cache anything else than "index.php?blablah.css" files (all other php files are a MISS)

Especially, the above configs do not cache forums, threads, etc on my stock 3.4 install, for a not logged in user.

I'm guessing there is a new cookie in 3.4 that creates a problem. I'm new in varnish and I'd appreciate your thought on this issue...

its really interesting after 3.4.1 my hit ratio dropped we went from 25% to around 16-17% might be some merit to your thinking there.

Link to comment
Share on other sites

  • Replies 202
  • Created
  • Last Reply

After a day of research, I found out that running varnish with IPB is a nightmare.

Not only the board, but also the separate modules are able to set cookies in all directions, and basically with a stock install of varnish you only cache a few calls to index.php for CSS files.

None of the config files posted in this thread work with 3.4 ( maybe they did work with 3.2 or 3.3, i'm just talking about my own experience with 3.4.2 here). See #174. I'm a newbie with varnish ( but not with other similar systems) and the main problem is that the config files posted here seem to only care about cookies sent by the browser, whereas many pages in IPB have set-cookies.

Of course this can be solved. I found on varnish's website an interesting VCL that can be used as a basis for something semi useful. But it's not enough. The complexity of the VCL for a working copy of varnish with 3.4, with a hit ratio close to 100% for non logged in users (which is my goal), is so time consuming that I won't spend more time in this. You have to discard some cookies, not others, and I'm not even talking about thread views and online users, or accurate purging of edited/updated thread. I was just hoping a "gross caching" for most guests' pageviews, and this is nearly impossible to achieve.

I'm impressed some people seem to use varnish with IPB, and would like to know more about it.

Link to comment
Share on other sites

could you include all the VCLs in the ZIP ?

like

# Set up disabled
include "/etc/varnish/disabled.vcl";

# Exclude upgrade, install, server-status, etc
include "/etc/varnish/known.exclude.vcl";

# Set up exceptions
include "/etc/varnish/url.exclude.vcl";

# Set up exceptions
include "/etc/varnish/debugurl.exclude.vcl";

# Set up exceptions
include "/etc/varnish/vhost.exclude.vcl";

# Set up vhost+url exceptions
include "/etc/varnish/vhosturl.exclude.vcl";

# Set up cPanel reseller exceptions
include "/etc/varnish/reseller.exclude.vcl";

# Restart rule for bfile recv
include "/etc/varnish/bigfile.recv.vcl";

thanks :)

Link to comment
Share on other sites

  • 4 weeks later...

Hi,
My host installed Varnihs on my server but then I start having issues with IP Board.

Users can loggin or they get logged in with diferent user, so they can write and act as someone else. Now, I have to much spam post on forum, which I cant delete.

I am using IP Board and IP Chat.

I find configuration for Varnish and edit to my default.vlc

backend default {
  .host = "127.0.0.1";
  .port = "8080";
}
      
sub vcl_recv {
  
## == Normalise Accept-Encoding ==
  if (req.http.Accept-Encoding) {
      if (req.url ~ ".(jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg)$") {
          # No point in compressing these
          remove req.http.Accept-Encoding;
      } elsif (req.http.Accept-Encoding ~ "gzip") {
          set req.http.Accept-Encoding = "gzip";
      } elsif (req.http.Accept-Encoding ~ "deflate") {
          set req.http.Accept-Encoding = "deflate";
      } else {
          # unkown algorithm
          remove req.http.Accept-Encoding;
      }
  }
 
  ## == Mobile ==
  if (req.http.User-Agent ~ "(iPad|iPhone|iPod|Android|SymbianOS|^BlackBerry|^SonyEricsson|^Nokia|^SAMSUNG|^LG)") {
    return(pass);
  }

  if (!((req.http.Cookie ~ "member_id=" && req.http.Cookie !~ "member_id=(0|-1)") || req.http.Cookie ~ "(guestSkinChoice|language)"))  {
    if (req.url ~ "^/(public|forum|topic|gallery|blogs|members|user|calendar)/") {
      unset req.http.cookie;
      set req.grace = 15s;
    }
    if (req.url == "/" || req.url == "/index.php") {
      unset req.http.cookie;
      set req.grace = 15s;
    }
  }
}

sub vcl_fetch {
  if (!((req.http.Cookie ~ "member_id=" && req.http.Cookie !~ "member_id=(0|-1)") || req.http.Cookie ~ "(guestSkinChoice|language)")) {

    ## == INDEX ==

    if (req.url == "/" || req.url == "/index.php") {
      unset beresp.http.set-cookie;
      set beresp.ttl = 300s;
      set beresp.grace = 30s;
    }

    ## == ESI ==

    if (req.url ~ "^/(gallery/image|topic)/") {
      esi;
      unset beresp.http.set-cookie;
      set beresp.ttl = 300s;
      set beresp.grace = 30s;

    ## Others

    } elseif (req.url ~ "^/(public|forum|gallery|blogs|members|user|calendar)/") {
      unset beresp.http.set-cookie;
      set beresp.ttl = 600s;
      set beresp.grace = 30s;
    }
  }
}
  
sub vcl_deliver {
  remove resp.http.X-Varnish;
  remove resp.http.Via;
  remove resp.http.Age;
  remove resp.http.X-Powered-By;
      
  if (obj.hits > 0) {
    set resp.http.X-Cache = "HIT";
    set resp.http.X-Cache-Hits = obj.hits;
  } else {
    set resp.http.X-Cache = "MISS";
  }
}

But I still keep having the same issues.

Please help

Link to comment
Share on other sites

Hi,
Sorry, I am new with IP board and Varnish as well, so can you tell me what to turn off, because I find a lot of settings:

Friendly URL Features

Redirect to new friendly URL format - YES
URL type - Path info
Use .htaccess mod_rewrite - No

In SEO ADVICE

I found that .htaccess mod_rewrite should be turned on.

My forum link now are like this:
http://www.sitename.com/forum/index.php/forum/9-forum-i-chat/

Please advice :)
Thanks

Link to comment
Share on other sites

Redirect to new friendly URL format

turn that to off and see if people keep getting logged out.

if it does help then its (in my experience) often a cookie setting.

if that does not help get the host to bypass varnish to you.

its hard to setup on a dynamic site.

Link to comment
Share on other sites

Hi Guys,
I guess:
Redirect to new friendly URL format - NO did the trick.

But I still have a lot of spam post from user that do not exist in members list, Guest_SegePleatte_*, Guest_Kuisajk* ...

I try to delete their posts, but nothing happend.

Please help,
Thanks

Link to comment
Share on other sites

  • 1 year later...

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...