-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Varnish Cache not being hit at all? #943
Comments
Could this have something to do with the cookies in the request? From the chrome inspector I see that cookies are in the header.
I disabled the modules causing the |
Below is a an excerpt from the beginning of our varnishlog
|
My first suggestion (since I always forget this step) is to be sure you clicked 'apply varnish config' to make sure that Turpentine has applied its VCL to the Varnish instance? It sounds to me like Varnish is just passing everything through. |
@aricwatson I have clicked apply varnish config but it makes no difference :( |
OK - couple other things to rule out - have you disabled all the cache types on the cache management page - other than the two varnish cache types? Are you using any other caching extensions that might conflict? Also be sure that you have the compiler turned off... Also - when testing, be sure to reload your test page two or three times - since the first request will just be piped through Apache/Nginx to get a good session, if you only load the page once you won't see any Varnish "stuff" happening. Sorry if these are things you already know of have already tried, just making sure we aren't missing anything :) |
@aricwatson Yes compiler is turned off. We don't have any other types of HTTP caches. I've been reloading the page several times when testing. I've cleared the Magento cache also |
OK, I think your problem may be related to a bug we just fixed in 0.6.6 - please try updating to current master version and test. Specifically - I think it might be related to #904 |
@aricwatson Still no difference after upgrade. I cleared Magento cache, logged in & out of admin, re-applied Varnish config & restarted varnish on server. After reloading test page TTFB still at approx 850ms and I see no difference on |
I always make Varnish works on ports with Apache/Nginx before installing Turpentine extension.
Do you have some rules in iptables to limit the number of connections? |
I followed the rest of your instructions and double checked the secret string was correct and with the I'm not familiar with iptables and have done nothing with them.
Could this have something to do with the cookies on the page request? |
Please see your post 2. There are no Varnish tags there (if debug is enabled). When Turpentine is working and the configuration file is loaded you don't see information about server or hhvm. Turpentine is hiding this information by default. Conclusion is only one, there is an issue related to applying Turpentine VCL file. |
This is the result of the
I'm using varnish-3.0.7 so I don't think I should have an issue with version 4, I removed it and replaces it with 3. I agree with your conclusion but how to debug it further and fix? |
I see from issue 109, that I can check to see which Varnish VCL by running this command:
|
@addison74 also with debugging enabled I see no varnish tags in the headers and the |
I am not using Nginx as webserver, but you should check your configuration file because you need to add more statements then usual when Nginx is behind a proxy server like Varnish. Do a Google search for this scenario, there is a plenty of tutorials. If you want to test Magento + Varnish + Turpentine I suggest installing Webmin/Virtualmin pack, it comes with everything you need to run Magento into virtual hosts. Apache needs only ports changing to run. Webmin allows you to switch from Apache to Nginx very easy. |
Warm the cache. Stop varnish service. Can you navigate inside your website? My first conclusion Nginx is not well configured. |
just an example: http://mikkel.hoegh.org/2012/07/24/varnish-as-reverse-proxy-with-nginx-as-web-server-and-ssl-terminator/ Please note there statements like: proxy_pass, proxy_set_header, ... Are you using them into your configuration file? |
Thanks for the good advice, I look into that and get back to you. BTW I can't access the website with varnish or nginx stopped. this is my current nginx configuration file
|
If your website is cached by Varnish when you stop nginx service you can continue visiting the website. You don't need a lot of statements in your nginx configuration file. For example those with expire tag. Varnish will do the job once it's working. Check also if there are any other configuration files for Nginx to avoid conflict. Create a simple configuration file for the beginning. There are many tutorials you can find using Google searching for nginx behind varnish. |
I get a 504 gateway error when I use These settings are for setting up NGINX as an SSL terminator which process ssl and passes the decrypted request to Varnish. Fabrizio Branca has a post on the same thing which explains it better. I've checked out some other posts on NGINX + VARNISH and there NGINX configuration is the same as mine, for example this post by Ash Smith |
Got it working! I started from scratch by scrapping our staging server and creating a new one from an AWS image of our origional staging server before I installed varnish, and it works. I think it must have been a conflict in varnish caused by installing varnish v4 first. Still not working perfectly but the other issues are not related to this so I will close the issue but if you can offer any insight into the below issues I'm facing I would be very grateful. 1) Also, I'm loosing my cart items when I refresh the page homepage but when I go to an inside page I see the item in the cart but the html & css is all wrong. The topcart is being generated by a template in our theme 2) When I have a query string such as 3) Varnish cache is not working when I access the page from chrome on ubuntu. I cleared cache, cookies etc. It's chome for Linux Version 40.0.2214.95 (64-bit). Seems to work in all other browsers so not a huge issue. I'll try to sort these out before opening another issue but if you have any tips they'd be more than welcome. Thanks :) |
Same problem with the cart and login as it is described by @rossmc in question#2 |
I'm not sure what you mean by it disappears? Can you elaborate or share screenshots? |
So, are you saying that if you go to a category page you're seeing a number of items in the cart that's the same as the number of items in the category? That's strange. Or are you saying that on category and product pages the number of items in the cart is displaying properly whereas it always shows '0' on the homepage? If that's the case, I'd look into what ESI policies are set up for that homepage block (the one with the cart) - it sounds like it's not being hole-punched. |
Thx, we already solved that by proper configuration of cache module. |
Good to hear! |
I've installed Turpentine on our staging site and it seems as if Varnish is either not caching or being hit and it is just passing the request to NGINX. The TTFB is still at approx 850ms.
The site is on Ubuntu 14.04, NGINX, varnish-3.0.7, Turpentine v0.6.5, Magento 1.9.2.
I've turned on Enabled Debug Info and Logging but I'm getting no error messages.
I only see the following in the turpentine.log when I clear the Varnish cache :
2015-09-12T15:42:15+00:00 DEBUG (7): TURPENTINE: Cleared ESI cache for client (9dcd02d74b13e0b2610a765af415212d) on event: core_session_abstract_add_message
This is what I have in my Daemon Opts in /etc/default/varnish
Here one of the things I changed which wasn't in the instructions was
-f /etc/varnish/default.vcl \
to-f /var/www/staging/var/default.vcl \
. While I think this is correct it has made absolutely no difference.When I run either of the following commands I see a bunch or requests in the console.
The requests include the homepage or page I'm visiting i.e.
/
or/cloths
and all the images, css & js on our server for Magento, 36 in total. I believe theRxURL
is for incoming requests to varnish andTxURL
is for requests passed on to NGINX. Is this correct?Also when I check the varnish CLI with the
varnishadm
command I see nothing of note:When I run the
varnishstat
command and refresh our homepage a few time the hitrate remains at 0, but some other stats change.I would really appreciate any advice on how I can debug this issue further or sort out whats not working with it. Below is my Downloaded Varnish Config from System > Cache Management. Perhaps this is not being loaded by varnish?
The text was updated successfully, but these errors were encountered: