Welcome! Log In Create A New Profile


RE: Nginx+Redis Dynamic Page Caching & Cache Purging (vs Varnish)

Reinis Rozitis
July 29, 2021 04:34AM
> And most importantly, how its capabilities compare to Varnish. From my searching and articles I have read so far, the general
consensus seems to be that Varnish is more flexible and offers more abilities for dynamic page caching
and cache purging. Is this indeed the case today?

Depends on what are your requirements.
While Varnish with its VCL might be more "programmable" from the get go (I imagine you can achieve the same with openresty (nginx and Lua)) there are advantages and drawbacks for each product. I haven't used recent versions of varnish (so these points might be now invalid) here are some from my own experience:

- it seems Varnish still doesn't have a native SSL/TLS support [1] so you need some SSL termination/offloading (hitch, haproxy, nginx or some CDN) above it - adds and extra layer and additional piece of software you have to manage
- the community nginx version doesn't have a callable cache PURGE option [2] - you have to either use the nginx plus version or compile a third party module for that. Varnish offers that by default.
- Varnish has different kinds of storage backends (mmap, umem,file etc) which might be more optimal/performant for particular cases. For nginx besides the file based you have to use other services redis/memcache etc. On the other hand the persistent storage for Varnish seems to be deprecated what is/could be problematic for large caches in case of restarts.
- based on your cache objects (count) there might be some hardware requirement differences - Varnish used to have a 1Kb per object memory overhead (even using a file based storage backend) - and in my case on a 32Gb ram node I could cache at most ~33mil objects while nginx on the same hardware could handle 800+ mil easily (obviously nowadays ram amounts might not be an issue)

My 2 cents ..

[1] https://docs.varnish-software.com/varnish-administration-console/installation/ssl/
[2] http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_purge


nginx mailing list
Subject Author Posted

Nginx+Redis Dynamic Page Caching & Cache Purging (vs Varnish)

s s July 27, 2021 06:14AM

RE: Nginx+Redis Dynamic Page Caching & Cache Purging (vs Varnish)

Reinis Rozitis July 29, 2021 04:34AM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 87
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready