Sunday, 24 November 2013

Re: [dcphp-dev] WordPress + Varnish resources?

What I would do first is check varnishstat which will tell you what your overall cache hit rate is. Anecdotally you probably want that to be in excess of 90%. If it's not there are three likely possibilities: 1) too large of a site for the size of the cache is forcing cache evictions, 2) not a long enough cache expiration period or 3) poor varying rules.

The first should be fairly straightforward, if you know you have a lot of pages, images, PDFs, etc. check and increase the size of the cache pool. 

For the second, Varnish is usually configured to use the backend's cache expiration policy. So if the backend sends cache headers for 5 minutes the item will only be cached by Varnish for 5 minutes. If you don't have a lot of traffic for the same URI within the cache period than Varnish isn't going to do you a whole lot of good. Increasing that period will help, but keep in mind that you'll need the backend to probably tell Varnish when to purge or ban the appropriate URIs when they do change if you don't want to serve stale content. 

For the third, Varnish is usually configured to vary on cookies; that is if the user has cookies with the host Varnish will pass the request to the backend and not try to serve it from the cache. Most of the time this is configured with a black list of cookies, that is Varnish will attempt to remove unnecessary cookies from the header and then check to see if there are any left; and example would be removing Google Analytics cookies (__utm[a-z]). One problem with this approach is that various JS components, other analytics, proxies, etc. may set their own cookies that can interfere with the caching. I'd recommend looking at varnishlog and filtering by misses to see the headers as they go by. Another option on cookies is to whitelist certain session cookies; essentially say if the header contains a pattern then pass it to the backend. Depending on how the session cookie for Wordpress is constructed this may be easier or harder than the black list.

I claim no special knowledge of Wordpress or typical VCL configuration for it, but I have had to tweak Varnish reasonably extensively for Drupal in a variety of circumstances. 


On Thu, Nov 21, 2013 at 3:03 PM, Jason A. Lefkowitz <jason@jasonlefkowitz.net> wrote:
Hey all --

Does anyone know of good resources for learning how best to set up VCLs in Varnish 3 to improve performance on WordPress sites? 

Googling turns up lots of hits, but they tend to be either really old tutorials that use Varnish 2 VCL syntax that doesn't work anymore with 3, or giant copy-paste VCL dumps with no explanation of the purpose of each rule and how they interact with each other. I've heard lots of people say Varnish radically increased the performance of their WP sites, but I'm not getting that kind of result out of the box, so I'm trying to find resources that will help me figure out why that's the case and how to get things tuned up properly.

Thanks in advance for any help you can provide!

-- Jason

=====
Jason A. Lefkowitz
President, Rogue Repairman Productions
http://roguerepairman.com
"Technology sucks. We make it suck less."

--
You received this message because you are subscribed to the Google
Group: "Washington, DC PHP Developers Group" - http://www.dcphp.net
To post, send email to washington-dcphp-group@googlegroups.com
To unsubscribe, send email to washington-dcphp-group+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/washington-dcphp-group?hl=en
---
You received this message because you are subscribed to the Google Groups "Washington, DC PHP Developers Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to washington-dcphp-group+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
William Hurley
Manager of Programming
Forum One Communications
http://forumone.com/
703.894.4346

--
You received this message because you are subscribed to the Google
Group: "Washington, DC PHP Developers Group" - http://www.dcphp.net
To post, send email to washington-dcphp-group@googlegroups.com
To unsubscribe, send email to washington-dcphp-group+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/washington-dcphp-group?hl=en
---
You received this message because you are subscribed to the Google Groups "Washington, DC PHP Developers Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to washington-dcphp-group+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 comments:

Post a Comment