I have a wordpress based content site which has at least 300 online user instantly, the monthly pageview count is more than 3 million.
I’ll start using Amazon S3 in order to move images to cloud.
But I didn’t use any cache system before. Should I chosse redis or varnish? Which one is better for me?
I have 16 GB ram droplet, running Ubuntu 14.04 and nginx.
Thanks a lot.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $100 of credit to try our products over 60 days!
@ibrahimmumcu
Honestly, both Redis and Varnish benefit more from isolation than configuration on the same server that the web server and database reside on. Redis and Varnish should be deployed as independent Droplets. You would need to configure Redis and Varnish Cache to use your Droplet’s Private Network IP and establish a connection to that IP from your WordPress plugin (for Redis).
Varnish, ideally, would sit in front of your web server Droplet(s), thus all requests for
yourdomain.ext
would hit the Varnish server first and Varnish, based on how it’s configured, would proxy the request to your actual web server.Configuring Varnish as the primary entry point and proxy would allow you to, for example, setup 10x web servers, define them in the Varnish configuration file and from that point, Varnish could be used to not only cache/accelerate requests, it would be able to manage load-balancing between the web server cluster based on priority.
The firewall configuration for both Redis and Varnish would be restrictive. More specifically, you would set it to deny all except to the IP’s you specifically allow to connect. Likewise, you’d want to setup the firewall on your web/database server to do the same.
NOTE: UFW is an iptables wrapper that simplifies adding, removing and editing firewall rules – it’s disabled by default and can be enabled on Ubuntu using (you may need to use
apt-get
to installufw
on Debian):BEFORE you enable UFW, to prevent lock-out, you’ll need to use the
ufw
command to add rules - specifically, a rule to allow SSH, HTTP, HTTPS, DNS (if you’re running BIND or an alternative), SMTP, IMAP etc.You can add basic rules using the format:
As an example, to allow the default SSH port through:
You can then proceed to add HTTP, HTTPS, DNS etc (commands shown in that order):
The above commands will allow both IPv4 and IPv6 access to those ports by default.
–
That being said, the primary difference is that Redis is a key => value store that stores the value of X to a defined key, whereas Varnish is a web application accelerator / caching HTTP reverse proxy. While both provide caching, they both perform entirely different tasks.
You can definitely utilize both, though based on experience, using both can be a little tricky with WordPress simply due to how it’s designed and how the caching plugins work. It’s not to say that it’s impossible (it’s not), though it’ll likely take some time as well as trial and error to ensure the caches flush when you need them to.
Why not use Nginx to do the caching?
https://rtcamp.com/wordpress-nginx/tutorials/single-site/fastcgi-cache-with-purging/