Jump to content

Unbelievable results with Varnish


Recommended Posts

Posted

Hi Shamil,



Can you please shed some light on litespeed + internal caching?




Thank you.




Sure, have a quick read here: http://www.vbulletin.com/forum/entry.php/2452-Boosting-vBulletin-performance-via-caching-Apache-Varnish-versus-Litespeed-Cache

Basically, LiteSpeed web server is currently testing a new caching system, much like Varnish; though because it is inbuilt, provides far better performance, and stability than Apache + Varnish. The results, in all cases, are astonishing.
  • Replies 202
  • Created
  • Last Reply
Posted

Sure, have a quick read here: http://www.vbulletin...Litespeed-Cache



Basically, LiteSpeed web server is currently testing a new caching system, much like Varnish; though because it is inbuilt, provides far better performance, and stability than Apache + Varnish. The results, in all cases, are astonishing.




Hello,

It's only available in the Enterprise 2+CPU licenses :(
Posted

Hello,



It's only available in the Enterprise 2+CPU licenses :(




Well, for the best performance, in any case, you should be using that. For a VPS, I'd recommend that you stick with XCache + LSAPI
Posted

Looks impressive, but above my pay grade to implement. Hope someone develops a turnkey Litespeed cache solution for IPB.




It should work with IPB
Posted

I made a small test (using the free/std version) for static files in my VPS (linode) without success:

nginx static file:

No KeeAlive: 6180 req/s
With KeepAlive: 25200 req/s

LIteSpeed (static file):


No KeeAlive: 5590 req/s
With KeepAlive: 9380 req/s

This is just the default install with logs disabled in both, Litespeed had htaccess enabled, but has I said ... this is just my test in a vps environment and using the free version without any tweak.

Maybe someone with more experience using litespeed can give us some tips.

Posted

I made a small test (using the free/std version) for static files in my VPS (linode) without success:



nginx static file:



No KeeAlive: 6180 req/s


With KeepAlive: 25200 req/s



LIteSpeed (static file):




No KeeAlive: 5590 req/s


With KeepAlive: 9380 req/s



This is just the default install with logs disabled in both, Litespeed had htaccess enabled, but has I said ... this is just my test in a vps environment and using the free version without any tweak.



Maybe someone with more experience using litespeed can give us some tips.




nginx, I believe is the best for static files. LiteSpeed I believe is great for dynamic processing, i.e. PHP
Posted

nginx, I believe is the best for static files. LiteSpeed I believe is great for dynamic processing, i.e. PHP




That's fair :)
For a "free" solution varnish + apache/mod_php or nginx + varnish + apache/mod_php combo are great solutions.
I prefer the last because I'm able to run ESI in the backend and nginx just gzip the content.
I made an unfair test between litespeed/lsapi and nginx + varnish + apache/mod_php and the last won ...
Varnish 3 will have gzip with esi integrated - http://www.gossamer-threads.com/lists/varnish/misc/17601
Posted

I'm pretty new at this, but would like to give it a try. I already have xcache installed.
By following this topic, will we be setup correctly ?
(I am on a relatively small vps running plesk with 512mb ram)
first visits are really slow, but 2nd visits are very rapid. Its the first visit for a guest I would like to cure (currently 6-12 seconds) with 1-3 seconds for revisit.

Posted

Hello,

This is my last setup with some ideias from mat206 (mobile phones).
I'm running nginx -> varnish -> apache2+mod_php with esi, but you can test just varnish -> apache+mod_php.
If you don't want to run esi you can delete the line from the config, but this way your post count wont increment *.
Note that at this time varnish won't gzip content and esi doesn't work with gzip, that's why I use nginx in front for gzip content and serve static files, since it's faster that varnish.
This configuration won't cache results if a user change the language or the skin.

* For ESI, please read my last post: http://community.inv...ost__p__2071318

This configuration give me this results for ab -kc 10 -t 30.

Without Varnish: Requests per second:    25.70

With Varnish: Requests per second:    3472.84

So, not only I can have more requests but also the visual perception of speed.

backend default {

  .host = "127.0.0.1";

  .port = "8080";

}


sub vcl_recv {


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

    }

  }

}


sub vcl_fetch {

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


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

  } else {

    set resp.http.X-Cache = "MISS";

  }

}

Posted

just a note to anyone thinking of giving this a go, the sytax given is not compatible with varnish 2.1.x




Mine is! I'm running 2.1.5


Hi,



Did you install it? Do you see any difference in performance?




Thank you.




Yes, there is a notable difference and the numbers talk by them self:

[/size]Without Varnish: Requests per second:    25.70

With Varnish: Requests per second:    3472.84

Posted

Mine is! I'm running 2.1.5



[font="arial, verdana, tahoma, sans-serif"][size="2"]



[/size][/font][size="2"]Yes, there is a notable [/size]difference[size="2"] and the numbers talk by them self:[/size]



[size="2"]

[/size]Without Varnish: Requests per second:    25.70

With Varnish: Requests per second:    3472.84



Do you have a url for your site please?
Posted

php file to update topic views (update_topicviews.php):



<?

require_once( './conf_global.php' );


$link = mysql_connect($INFO['sql_host'], $INFO['sql_user'], $INFO['sql_pass']);


@mysql_select_db($INFO['sql_database'], $link);

@mysql_query("INSERT INTO topic_views (views_tid) VALUES ('" . $_GET['tid'] . "')");


mysql_close($link);

?>



I would like to have some comments from you.



Hi Nuno,

I am assuming I create the file update_topicviews.php
but where does it need to be placed?

Also can you confirm what is mean by "mod_php with esi" please?
Posted

Hi,

You need to place that file in your forum root where you conf_global.php and adjust the path.
Here Is a more secure version:

<?

if (is_numeric($_GET["tid"])) { 

  require_once( './conf_global.php' );

  $link = mysql_connect($INFO['sql_host'], $INFO['sql_user'], $INFO['sql_pass']);

  @mysql_select_db($INFO['sql_database'], $link);

  @mysql_query("INSERT INTO topic_views (views_tid) VALUES ('" . $_GET['tid'] . "')");

  mysql_close($link);

}

?>

you should protect this file adding these lines to htaccess;

<FilesMatch "update_topicviews.php">

Order allow,deny

Deny from all

</FilesMatch>

Do not forget to add this in the beginning of topicViewTemplate (adjust src path):

<if test="!$this->memberData['member_id']">

  <esi:include src="/update_topicviews.php?tid={$topic['tid']}" />

</if>




Vanish implements some ESI functions that allow us to execute partial portions of a cached page.
This way we an cache a topic and call the above script to increment topic view counter.

At this time Varnish can't execute ESI with GZIP content, that's why I use nginx (and to load static content too) as a frontend and this is where i gzip web pages before sent them to the browser and not in apache.
Since you gzip your content in apache or in IPB, when varnish request a page it doesn't read the content and juts sent it to the browser.
Varnish 3 will have this features, until then you have 2 choices (besides running another frontend):

1. Don't GZIP php pages in Apache or IPB (not a good ideia)
2. Dont execute ESI

Posted


1. Don't GZIP php pages in Apache or IPB (not a good ideia)


2. Dont execute ESI




Thank you Nuno, I will add that code so that I am ready. At the moment, I am having issues getting varnish to run

: invalid number HTTP accelerator: /etc/init.d/varnish: line 54: ulimit: 131072

: invalid numberish: line 57: ulimit: 82000

Posted

Thank you Nuno, I will add that code so that I am ready. At the moment, I am having issues getting varnish to run



: invalid number HTTP accelerator: /etc/init.d/varnish: line 54: ulimit: 131072

: invalid numberish: line 57: ulimit: 82000




Hello,

You should lower the value 131072 to 82000 in varnish start up.

Note, the FilesMatch in htaccess is not correct. Do not use it.
Posted

Hello,



You should lower the value 131072 to 82000 in varnish start up.



Note, the FilesMatch in htaccess is not correct. Do not use it.



I've changed it, lowered it, raised it - it makes no difference
: invalid number HTTP accelerator: /etc/init.d/varnish: line 54: ulimit: 30000
: invalid numberish: line 57: ulimit: 32000

Archived

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...