5 ms·
nginx ?
by aayala 11y ago
nginx ?
- xinuc 11y agoApache TS is a caching proxy server. It's more similar to varnish than nginx (you can use nginx as a caching proxy if you want, of course). I never use it, but from what I heard, it performs & scale really well too.
- skuhn 11y agoSome people do use nginx as a caching server. CloudFlare, for example, is built on top of it. The reason to do so is because you want the rest of what nginx provides, not to get its caching module. It is an extremely barebones solution that only solves the most basic requirements. I can only presume that CloudFlare and others have written their own caching modules for nginx. A short list of annoyances: 1. No support for multiple disk devices. Files are written to a fixed temp path and then renamed to their real destination. So you need to use RAID to present the disks as one logical device, which is a wholly unnecessary expense in a caching environment. 2. No support for purging in open source. This is an nginx plus feature, which starts at $1900/server/year. 3. Because of the temp file / rename thing, support for streaming subsequent requests off of the first request that is filling cache is janky. Subsequent requests have to acquire a lock. 4. No support for any fancier cache setups, utilizing ICP / HTCP.
- nikolay 11y agoI was considering Varnish + Nginx at some point, but this gets much more complicated than just using ATS.
- skuhn 11y agoIt makes sense, considering that nginx is typically ahead of the pack on support for things like SPDY and H2. Plus if you use OpenResty with its Lua functionality, you can do a lot of fancy things in nginx and reduce your dependency on Varnish's VCL. And you have to have something in front of Varnish to do SSL anyway. VCL in particular is kind of a trap. Early on it can do what you need -- remove a header, set a header, basic branching. Then you want to do basic arithmetic, or validity checking, or anything that isn't suitable for string assignment or regex and you straight up can't do it. VCL makes me long for the power of bash scripts. Ultimately though, it's really not a great solution to separate these concerns between multiple applications. You're going to get bitten somewhere, even if it's just the old ephemeral port exhaustion problem.
- nikolay 11y agoThat is true. I was particularly interested in tag-based cache purge and although there are similar open-source Nginx modules [0] and [1], they still don't have that out of the box. [0]: https://github.com/pintsized/ledge https://github.com/pintsized/ledge [1]: https://github.com/wandenberg/nginx-selective-cache-purge-module https://github.com/wandenberg/nginx-selective-cache-purge-mo...
- skuhn 11y agoTag-based cache purges are something I would love to see in ATS. I think doing it correctly would require a complete rejiggering of the cache storage though, and that's not something to be undertaken lightly. Storing externally in redis (for ledge) seems like the wrong approach to me. Better to store metadata externally and generate the purge URLs based on that. It's not ideal, but it's the best option I've come up with.
- nikolay 11y agoIt's an essential feature that is dragging me towards Varnish even if this comes with tons of negatives.The bans feature is just amazing. And right or wrong, there are not that many implementations to choose from in the Nginx land, unfortunately.