Disclaimer: I never used Varnish. So please do not treat this as Varnish v/s Nginx post. It will be wrong on my part to compare Nginx to something that I have never used.
Since we published WordPress-Nginx tutorials, we have been asked many times that why we haven’t posted anything about Varnish!
Here is my attempt to answer…
Short Answer: Using Varnish + Nginx is not worth my effort!
I never used Varnish. So I will have to spend some time learning Varnish. Apart from this, Varnish will increase one more package on Nginx + PHP + MySQL + APC/Memcache stack we commonly use. That means if something goes wrong, we will need to debug Varnish also apart from other packages!
So not only in learning but I will have to spend time in maintenance on ongoing basis.
Nginx can handle static files itself pretty fast. On larges sites, people generally use CDN to host static files (images, videos, js, css, etc).
Varnish is surely useful when used with Apache. If Apache has mod_php enabled, Apache performance significantly drops for static-file requests.
Again, Nginx does this for me! In a client-setup, we have a micro Amazon EC2 instance running nginx as load-balancer in front of range of PHP, mysql.
Beauty of Nginx is that it can directly talk to other Nginx and PHP directly. It can read from memcache directly! So it works really well for us in multi-machine environment.
I am not fond of benchmarks. Still, if Varnish + Nginx gives 5-10% performance improvement but cost in days to learn and hours every month in ongoing maintenance, I will prefer to leave that 5-10% of performance gain.
That being said I find this Varnish/Nginx benchmark quite good!
My point is… rather than learning multiple tools partially, I will dig deeper into Nginx. I will master it to the point that it can cater to all our needs! 🙂
That’s it from my side! You can prove me wrong using comment-form below! 😉