4 ms·
I thought about incorporating Varnish into my side-project as well. However, Varnish seems to be a [potential] hassle when you account for VCL, ESI, and etc. It
by chlee 15y ago
I thought about incorporating Varnish into my side-project as well. However, Varnish seems to be a [potential] hassle when you account for VCL, ESI, and etc. It also adds an extra layer or indirection and complexity as you've mentioned.
With regards to caching user specific parts of your page, have you considered template caching [1, 2]? This way you can apply different caching policies to different parts of your pages w/o using varnish and ESI.
With that said, why would one choose Varnish + ESI (or reverse proxy in other words) over template caching + memcached/redis/riak? Can someone explain the pro's and con's of both approaches?
[1] http://www.makotemplates.org/docs/caching.html http://www.makotemplates.org/docs/caching.html
[2] http://jinja.pocoo.org/docs/extensions/ http://jinja.pocoo.org/docs/extensions/
- slyall 15y ago1. A reverse proxy will usually be faster since it doesn't have to execute an "code" (even a cut-down framework). 2. Some sites will be "read-only" and your really can serve everyone with exactly the same content. 3. Legacy codebase/programmers may not be able to use more scalable techniques so a reverse proxy is the best solution.
- todsul 15y agoYes, we previously used template caching because it was built into Symfony1 (an MVC PHP framework). Symfony2 now leaves caching to the HTTP Standard, plus integrates Akamai's ESI. Symfony specifically recommends Varnish for live projects. Memcache certainly has its place, but for me, Varnish is a plug-n-play solution that doesn't require code changes. Even with ESI, if you've already set HTTP Cache, you just need to set s-maxage per component. That's it. Then of course there's all the Varnish load balancing features that I haven't used. If my site didn't use logins, I'd definitely just go for Nginx + fastcgi_cache. People argue that Apache can do the same with the right tuning. But there's something to be said for a 5 minute VPS build by a complete novice that can serve 20,000 requests per second using about 10 lines of config code. I think this all becomes much more complicated for seriously large websites. That's where memcache/redis et al. join the party, potentially with Varnish.