Live data from Hacker News

Varnish 4.0.2 released

varnish-cache.org

41–50 of 56 posts

Re: Varnish 4.0.2 released

#41
post #28

Earlier quoted context omitted.

Is this ever a good idea? Doesn't making www.foo.net and foo.net separate but identical cause an indexing split (and index ranking split) at search engines? Why would you ever want that split for the same pages at two different domains, unless they're serving different content?

Now that you mention it, I forget why that specific snippet is in my config... it is part of a block of similar-but-more-useful things (specifically, having multiple caches serving the same static content from a variety of different domain names)

so, what's the answer - this is why Varnish is so confusing. I have my non-www to www redirects working perfectly on nginx.

should I do anything special in varnish, or should I trust it to cache the nginx redirect headers by itself ?

Re: Varnish 4.0.2 released

#42

Does anyone have a fairly basic varnish config that deals with a) non-www to www redirects, b) works with https certificates (with the Cloudfare config) , , c) allows CORS for fonts on cloudfront and d) switches off caching for all /admin pages? Varnish has proven to be very hard to use with nginx in the above setup. Especially, trying to understand the ssl bit is getting to be really hard. Can it also work with spdy…

a) I just let Nginx do the redirect. Varnish can cache 302's so after the first one it won't hit Nginx again until the cache times out. b) You have to terminate SSL connections before hitting Varnish. There is very little chance SSL termination will ever be part of Varnish. On AWS you can terminate with ELB. c) Varnish can add HTTP headers and it will respect the headers your backend sets. d) Varnish can disable cach…

for b), we dont use AWS - we are hosted on Softlayer cloud. Does that mean that - if you use Varnish with SSL, then you NEED to use HaProxy ?

Or is it nginx (SSL termination) -> varnish -> nginx (server) -> Rails

Re: Varnish 4.0.2 released

#43

Varnish and caching in general can be a complete mind-freak the first few times you experience it, however after working with it nearly daily for the last 3 years, I've come to love it. It has allowed me to scale a number of WordPress websites far beyond where they had business being (34mm UV/180mm PV per month on a handful of servers). Super excited to see them continuing to build in great features.

I have never tried but failed miserably in trying to setup a Varnish front-end for a wordpress setup - especially with pretty urls. The hard part was getting varnish to work with the admin interface - especially image uploads - and comments.

Do you know of any good starting config file that can be used ?

Re: Varnish 4.0.2 released

#44

Two questions: (1) Anyone use Varnish in front of Rails? Is it better to just set up some memcached and/or redis and let the app handle it? (2) To deal with session-specific stuff, how common is it to render some common plain html views, then fill in the particulars with JS/Ajax? If you need to support no-JS (heaven forbid) do people use iframes?

Answer to (1): Heroku used Varnish in front of EVERYTHING in their previous stack... So I guess that means that whatever Ruby (or RoR) app you are running you should look into using Varnish.

Re: Varnish 4.0.2 released

#45
post #22

My experience with Varnish was when we tried to use it for something that had relatively complex caching rules. The config/VCL became spaghetti: attaching values to req and restarting the flow. This appeared to be the normal way to write VCL. We ended up writing our own system, with our own high-concurrent LRU cache, that was more tightly coupled with our application servers (and thus able to figure out what the cach…

I think your description might fit if performance and scalability is a non-issue for your site.

Your own caching will make your webapp (or API) scale (say 2x faster or serve 15x the amount of users), but if you need your app to take some serious beating (say 100x to 400x the amount of users with minimal ttfb) because your site/app suddenly becomes flavour of the month on the Internet, then you will really need Varnish.

After seeing several Paywall and API deployments and all sorts of other advanced business logic, such as GeoIP detection or Mobile device classification, applied in the cache layer while keeping a sane and simple VCL, I am not sure your initial point is the case. The normal way to write VCL is to keep it simple.

(Yes, I am biased, but my point is still valid).

Re: Varnish 4.0.2 released

#46

Varnish and caching in general can be a complete mind-freak the first few times you experience it, however after working with it nearly daily for the last 3 years, I've come to love it. It has allowed me to scale a number of WordPress websites far beyond where they had business being (34mm UV/180mm PV per month on a handful of servers). Super excited to see them continuing to build in great features.

I have never tried but failed miserably in trying to setup a Varnish front-end for a wordpress setup - especially with pretty urls. The hard part was getting varnish to work with the admin interface - especially image uploads - and comments. Do you know of any good starting config file that can be used ?

A couple of resources for Varnish 3:

* https://github.com/mattiasgeniar/varnish-3.0-configuration-t... (fairly well maintained with CMS specific VCL examples)

* https://github.com/slashsBin/nuCache (library for different programming languages, not so CMS centric)

Both of these are listed in our utilities directory:

* https://www.varnish-cache.org/utilities

Other Varnish (VCL) extensions can be found in the VMOD directory:

* https://www.varnish-cache.org/vmods

If you have ideas on how to make both these resource more visible and accessible for our users, please let me know.

Re: Varnish 4.0.2 released

#47
Has anyone documented how to convert a 3.x config to 4.x config yet? The documentation on the site assumes a level of understanding of the internal workings I don't have.

I'm still running 3.x because they broke a bunch of stuff. I discovered this when I updated a couple of dev boxes and varnish stopped working.

Re: Varnish 4.0.2 released

#48

Earlier quoted context omitted.

a) I just let Nginx do the redirect. Varnish can cache 302's so after the first one it won't hit Nginx again until the cache times out. b) You have to terminate SSL connections before hitting Varnish. There is very little chance SSL termination will ever be part of Varnish. On AWS you can terminate with ELB. c) Varnish can add HTTP headers and it will respect the headers your backend sets. d) Varnish can disable cach…

for b), we dont use AWS - we are hosted on Softlayer cloud. Does that mean that - if you use Varnish with SSL, then you NEED to use HaProxy ? Or is it nginx (SSL termination) -> varnish -> nginx (server) -> Rails

Yes, I usually set up Nginx just to listen to port 443 and forward to Varnish on the same machine. You could do the same with HaProxy.

It is not as bad it seems since using Nginx to terminate SSL and forward is just a really simple config file. If you have a lot of cached resources then the path is mostly Nginx -> Varnish. Varnish is probably over 100 times faster than Rails at serving anything cacheable.

Re: Varnish 4.0.2 released

#49

Earlier quoted context omitted.

Except we didn't have that. This was 99.9% content pages dynamically generated and nearly static. They all had roughly the same headers that haven't changed really, and they were not even aware of Varnish. Response headers is the first thing we checked, there are only a few of them that affect Varnish: https://www.varnish-software.com/static/book/HTTP.html

Are you sure it wasn't an issue with cache evictions?

All pages at the same exact time?

Re: Varnish 4.0.2 released

#50

Varnish and caching in general can be a complete mind-freak the first few times you experience it, however after working with it nearly daily for the last 3 years, I've come to love it. It has allowed me to scale a number of WordPress websites far beyond where they had business being (34mm UV/180mm PV per month on a handful of servers). Super excited to see them continuing to build in great features.

I have never tried but failed miserably in trying to setup a Varnish front-end for a wordpress setup - especially with pretty urls. The hard part was getting varnish to work with the admin interface - especially image uploads - and comments. Do you know of any good starting config file that can be used ?

It's not difficult. You have to exclude (pass or pipe) either POST and /wp-admin OR all requests with wordpress logged in cookies. That's the basics of it. Also the resources Ruben listed are super great.

hit me on twitter @kentonjacobsen

Post reply on HN