I am trying to scale out my web services and having hard time making my mind between Nginx and Varnish cache for proxy server / load balancer.
I have a wordpress multisite (20+ websites) server and a data server that hosts mariadb / media files for wordpress + other data services at the moment.
My plan is to add one more wordpress server and load balancer in front of two wordpress servers.
Besides, I also want to bring in the data service to the same load balancer, which has so far been running on different static IP.
In a nutshell, the combined service will have 1 static IP, 1 load balancer, and two services (wordpress and data service) w/ two wordpress servers and one data service server, and 1 data server.
Initially my choice of load balancer was Mikrotik router RB5009. This is a great router and helps me all kinds of custom settings. I can map all traffic on nearly all my own terms.
But, the router only has 1GB ram, and wouldn't be that helpful when it come to caching a chunk, like Varnish cache does. All my web services are un-clouded and I have machines with plenty of cores and rams. At first, I thought what if I have 200GB RAM as cache for my web/data services. Wouldn't it make the website ultra fast, at least for static contents? Having gone through a number of docs for Varnish, I come to understand that I need to add a lot of other features, like SSL, cookies... if I want to use Varnish cache as proxy, although the idea of using massive chunk of ram for caching is intoxicating.
Then, what came to my mind is that, if I can assign a ton of RAM just for FastCGI cache (or any microcache for Nginx), and set rules similar to Varnish, I might be able to keep my dependency to Nginx from a single server to all servers. My wordpress and data service are already on Nginx, so preferrably Nginx can be a choice for proxy.
Though I am aware that multiple benchmarks stands with Nginx's superior performance to Varnish, heavier services may still be dependent to more chunky cache. What's the Nginx expert's opinion on this?