Live data from Hacker News

Varnish Cache 5.0

varnish.org

31–40 of 55 posts

Re: Varnish Cache 5.0

#31
post #9

Earlier quoted context omitted.

A one or two orders of magnitude greater speed, lots of configurations for caching policies, the ability to split a request in several subrequests (ESI) and some other nice things.

Not sure if the performance gains are still valid. There's reports that state the contrary: https://deliciousbrains.com/page-caching-varnish-vs-nginx-fa... Nginx has something similar to ESI called SSI ( http://serverfault.com/questions/406103/main-differences-bet... )

There is quite a few places for improvement in that test (e.g. tweaking number of threads in Varnish) and by no means the tests are like for like.

I will take it with a grain of salt or do your own tests, if you really care.

Re: Varnish Cache 5.0

#32
post #22
post #10

Do I understand this right? It supports HTTP/2, but doesn't support HTTPS. Therefore it supports HTTP/2 in a mostly unusable form, because browser vendors (for good reasons) decided to support HTTP/2 only over HTTPS.

The reason I don't want to link Varnish against a SSL library, is that in my considered opinion, they all suck. From a purely operational point of view, you are better of with two different SSL proxies in front if your Varnish (or other webserver), so that you can turn OpenSSL off in even-numbered weeks and the other (pick your poison) in odd-numbered weeks. The code to hold safely onto your certificate and do all th…

This is why i love hn. Thanks for answering this!

Re: Varnish Cache 5.0

#33
post #29
post #19

Earlier quoted context omitted.

Out of interest, do you have any metrics to support this? It would be interesting to see data that compares the two, and see how close they come in different scenarios, and how tuning/configuration might affect the performance.

I've used both in production. They both fast enough that their performance won't be your bottleneck. One's probably faster than the other by some percentage, but whatever you do, you're going to have some other problem that's bigger than that percentage. At that point, talking about metrics is likely procrastination.

I don't think your experience alone is enough to say whether performance differences are significant or not.

While in your experience the performance differences were negligible, but that doesn't mean that will hold true in all usage scenarios. For example, maybe they perform similarly when caching many small files, but one struggles with serving longer running requests.

Re: Varnish Cache 5.0

#34
post #29

Earlier quoted context omitted.

I've used both in production. They both fast enough that their performance won't be your bottleneck. One's probably faster than the other by some percentage, but whatever you do, you're going to have some other problem that's bigger than that percentage. At that point, talking about metrics is likely procrastination.

I don't think your experience alone is enough to say whether performance differences are significant or not. While in your experience the performance differences were negligible, but that doesn't mean that will hold true in all usage scenarios. For example, maybe they perform similarly when caching many small files, but one struggles with serving longer running requests.

Oh, sure. And one will be faster than the other in any given scenario. Not "faster like c++ is faster than ruby", though, it's "faster like this c++ compiler is faster than that one".

Re: Varnish Cache 5.0

#35
post #34

Earlier quoted context omitted.

I don't think your experience alone is enough to say whether performance differences are significant or not. While in your experience the performance differences were negligible, but that doesn't mean that will hold true in all usage scenarios. For example, maybe they perform similarly when caching many small files, but one struggles with serving longer running requests.

Oh, sure. And one will be faster than the other in any given scenario. Not "faster like c++ is faster than ruby", though, it's "faster like this c++ compiler is faster than that one".

I'm sorry but I strongly disagree with the line of thought there.

Parent above was saying "both are at the same speed / none offer any speed advantage".

He is then asked for any metrics to support that statement, which is not an extravagant request and should be encouraged more.

Your answer that "At that point, talking about metrics is likely procrastination" and "one will be faster than the other in any given scenario" serves nothing other that further his statement while deriding the need for said metrics to prove that this is not turning anecdotal evidence into facts, and frankly serves nothing to the discussion short of saying the point should be accepted without verification and that asking for verification is useless.

A point of view I really cannot agree with. I do not know which is faster, nor if any of them is faster than the other or not, but if somebody claims one way or the other in a factual manner, he should not find it a waste of time to find an actual metric that shows it.

Re: Varnish Cache 5.0

#36
post #21

Earlier quoted context omitted.

I think "proxy_cache_use_stale updating;" covers this case

Nope: "updating" does what I described, if another request initiated an update and it's in progress, it will serve a stale value, but the request who triggered the update is still "hanging" until the cache is refreshed. So you get that annoying slowdown for at least 1 user (often the CEO of your client company). The way to work around this issue with nginx (for simple endpoints) is to write scripts that will hit the…

There's a $500 bounty for this [1], but it doesn't look like anyone has taken it on.

[1] - https://www.bountysource.com/issues/972735-proxy_cache_use_s...

Re: Varnish Cache 5.0

#37

As someone who has never used Varnish but has used Nginx's cache to some degree... whats the benefit of placing varnish in the middle vs going with Nginx?

If you're already using Nginx and its caching subsystem is working for your use case(s), then I wouldn't worry about it. A typical web stack is composed of load balancing, SSL termination, caching and compression, and static and dynamic content serving. Nginx is capable of all these things (including dynamic content serving using OpenResty).

Once you start breaking your stack apart to 1) add redundancy, 2) isolate hardware for different workloads, and 3) scale the components independently of each other, the situation gets a little more interesting. Sure, you could run different clusters of Nginx for each of SSL termination, static content, cache and compress, etc. and have them reverse proxy to each other (and some people probably do this), but when you get to this evolution of your architecture, it's worth evaluating the different options for each layer of the stack. There's an argument to be made that e.g. HAProxy is a better load balancer, Nginx is a better static content server, Pound is a better SSL terminator, Varnish is a better caching and compressing reverse proxy, etc. (N.B. that I am not saying these things, I am just saying that they can be said.) If you're not serving static content at all—let's say you're presenting an API written in Elixir/Phoenix—it may not make sense to go with Nginx in the first place!

Regarding Varnish, specifically, I've found that it offers unparalleled power and flexibility when it comes to caching and compression. Yes, that power and flexibility comes at the cost of more complexity, but it's there when you need it. It offers different storage backends, including a pure memory backend; the ability to serve gzipped content directly from cache (for supported clients); PURGE and BAN HTTP verbs; synthetic responses; query string sorting; the ability to serve stale content while updating; ESI; and probably a whole bunch of other stuff I'm forgetting and/or have never used. Nginx and Nginx Plus may support some or all of these things, built-in or as modules... I'm not sure.

Re: Varnish Cache 5.0

#39
post #19
post #15

Earlier quoted context omitted.

Faster in theory maybe. In production nginx has always faster, more stable, less resources. I've used both extensively. Varnish has more caching features and configuration for sure.

Out of interest, do you have any metrics to support this? It would be interesting to see data that compares the two, and see how close they come in different scenarios, and how tuning/configuration might affect the performance.

For caches much larger than available memory nginx will win because it caches to static files and uses sendfile:

http://www.bbc.co.uk/blogs/internet/entries/17d22fb8-cea2-49...

Re: Varnish Cache 5.0

#40
post #38

https://www.nginx.com/blog/maximizing-drupal-8-performance-n... In the BBC’s testing, they found that with NGINX as a drop-in replacement for Varnish, they saw five times more throughput.

I don't suppose that particular workload was very suited for Varnish in the first place, if you read carefully, you'll soon realize that most people don't have that kind of content.

I have heard from (other parts of) BBC that Varnish saved a fair amount of bacon for them during the London Olympics, obviously in different workloads.

And nobody would be more surprised than me, if Varnish was a micacle-cure for every single website in the world...

Post reply on HN