Jump to content

Unbelievable results with Varnish


Recommended Posts


Add the value of the command ulimit -n or less.



unfortunately still the same error (but with different values) depending on which way round they are set


: invalid number HTTP accelerator: /etc/init.d/varnish: line 54: ulimit: 30000
: invalid numberish: line 57: ulimit: 32000


: invalid number HTTP accelerator: /etc/init.d/varnish: line 54: ulimit: 30000
: invalid numberish: line 57: ulimit: 30000


: invalid number HTTP accelerator: /etc/init.d/varnish: line 54: ulimit: 32000
: invalid numberish: line 57: ulimit: 30000
Link to comment
Share on other sites

  • Replies 202
  • Created
  • Last Reply

Your WHM panel based, So why do you not use the WHM plugin which is Globally rather than per account ?





Only makes sense. :whistle:




http://community.invisionpower.com/topic/328398-unbelievable-results-with-varnish/page__view__findpost__p__2074456

Ant :P

I have tested and does seem fine, Nice layout for a plugin also but I have not put it under real preasure yet, I will do via localhost probably in a few days time.
Link to comment
Share on other sites


Varnish is brilliant at what it does. Thought i would share this with you, great for people who use cPanel http://www.unixy.net/varnish/



Not tried it myself yet but i'm thinking about having a play with the 14 day trial next week.




I have it installed on my server since yesterday. As I was installing it I had a second terminal running top. Load was running between 2 and 3 before the install, it rarely reaches 1 now.

I have noticed a few anomalies regarding persistent login on my admin account. Initially I was logged out on my first visit after the install. Switching skins sometimes causes unintentional logout. During an ongoing session on the forum these issues do not crop up.

The installation was smooth as silk and it creates an uninstall button in WHM. I think it is likely I'll be licensing this Varnish plugin.
Link to comment
Share on other sites


I have it installed on my server since yesterday. As I was installing it I had a second terminal running top. Load was running between 2 and 3 before the install, it rarely reaches 1 now.



I have noticed a few anomalies regarding persistent login on my admin account. Initially I was logged out on my first visit after the install. Switching skins sometimes causes unintentional logout. During an ongoing session on the forum these issues do not crop up.



The installation was smooth as silk and it creates an uninstall button in WHM. I think it is likely I'll be licensing this Varnish plugin.




Hello,

If your talking about the forum in your signature, varnish is not caching anything.
You must setup a configuration that suites you setup.
Varnish default behavior is not cache content with cookies and IPB use them.
You can see my setup here and start with that.
Link to comment
Share on other sites


Read this article to understand how you can raise ulimit value: http://www.cyberciti.biz/faq/linux-increase-the-maximum-number-of-open-files/



I've increased my ulimits now but I still get the same error when I run
service varnish start

if I run this command
varnishd -f /etc/varnish/default.vcl -s malloc,1G -T 127.0.0.1:2000 -a 0.0.0.0:8080

it works, logging entries in varnishlog

whats the difference between this command and the service varnish start?
Link to comment
Share on other sites

  • 2 months later...

I've personally had better results using LiteSpeed and it's internal caching.



You ought to write a tutorial. Might bring some decent traffic to your site. I'm going to give varnish and litespeed a go tomorrow, but litespeed cache info for ipb is hard to come by.
Link to comment
Share on other sites


You ought to write a tutorial. Might bring some decent traffic to your site. I'm going to give varnish and litespeed a go tomorrow, but litespeed cache info for ipb is hard to come by.




I sure will do, I've actually written tutorials on my company's intranet, so staff are able to do this on clients' servers.
Link to comment
Share on other sites

  • 2 weeks later...

My host switched from litespeed to Varnish lately to improve server performance. The performance increase was noticeable but it did cause issues with my forum. The main issue being that with Varnish active for my domain I am unable to stay logged in. With Varnish de-active for my domain I am able to stay logged in.
I was not aware of this thread until it was pointed out in the long support ticket I had with IPS over the weekend.

Link to comment
Share on other sites

Amy if your host implemented Varnish, it was probably the Unixy plugin. Which works quite differently than the Varnish VCL discussed here. Following is from a vB test, but the results should be much the same:

Unixy.net took a different approach to Varnish caching as WHM/Cpanel users are predominantly web hosts with many shared or VPS hosting accounts, so per site/application configuration of VCL rules and logic would be a daunting and time consuming task. So Unixy.net opted to change Varnish’s default VCL rules from don’t cache files with cookies, to hash and cache files with cookies – essentially turning Varnish into a per user/visitor cache. This dramatically reduces the maximum potential cache hits ratio and adds a bit more resource usage but is countered by the default Unixy.net’s VCL rule set only setting a TTL of 20 seconds for Varnish cache, so a user whether logged in member or guest with cookies would only see a cached file for their session for 20 seconds...



The end result was much snappier loading pages on my vBulletin and wordpress sites – I have 2 vB forums and 2 wordpress based sites which are live and active. But cache hit rate for per user caching config is much lower than what I tested with on virtualized server running Varnish in it’s native default VCL state. The ratio of Cache hit rate to requests served was between 0.10 to 0.25 average with peak of around 0.28 to 0.30 cache hit rate which means 70-80+ % of requests still hit the Apache backend server.



Maybe the 20 second TTL cache is responsible for the log in issues?
Link to comment
Share on other sites


Lucky you not to have the log in issues.



I will admit it is faster though.




If you note, I don't cache "index.php", only topics/, forum/, gallery/ and blogs/. If you do this you wont get login/logout problems
I use nginx -> varnish -> apache2+mod_php. nginx is serving static content and gzip varnish+apache content and last ... I use esi to count topics/images views.

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){:content:}quot;) {

          # 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";

  }

}

Link to comment
Share on other sites


WOW I just installed the Unixy mod on my dedicated box and page loads (even IPB pages) are near instant now. I'll for sure be licensing this.



are you having issues with staying logged in on your IPB install. Reason I ask is when my host changed to Varnish it caused log in issues for IPB.
If you do not have that issue could you post your Varnish config so I can let my host know.
Link to comment
Share on other sites


are you having issues with staying logged in on your IPB install. Reason I ask is when my host changed to Varnish it caused log in issues for IPB.


If you do not have that issue could you post your Varnish config so I can let my host know.




I'm just running the standard configuration that the unixy installed.
Link to comment
Share on other sites


As far as I know that is what my host is running too. They actually did not want to modify it just to get my ipb issues fixed.




You may have to play with your redirect settings if they won't change it - I noticed that varnish by default caches redirects, and if they didn't change that you might get problems with redirects. Other than that, Varnish shouldn't interfere too much with IPB.
Link to comment
Share on other sites

Cookies are what I have had issues with. Not even seen any redirect issues unless going to the ip.content or gallery is a redirect.

The cookie issue is being logged out, constantly. Been told it is do to Varnish caching cookies.

Link to comment
Share on other sites

I got my issue fixed.
I had to turned off Path and Prefix for the cookie settings and the issue went way.
The issue comes back if you set a prefix.
So now I am able to run Varnish with no issues.

Link to comment
Share on other sites

Archived

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

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...