You'd probably be better off with varnish.
I'm currently using the "file" cache driver, thinking of switching to "redis" any caveats?
A little background: I'm currently running a site that's mostly articles (so basically static pages) and I'm using https://github.com/Anahkiasen/flatten to automatically cache my pages.
I'm running it on Laravel Forge with a 2GB droplet and HHVM installed. Currently using the "file" cache driver I'm sitting at ~40% RAM usage.
My concern is would it be worth it to switch to Redis for extra additional speed gains? My understanding of Redis is that it uses memory for caching and memory is faster than SSD storage.
Also would switching be a trivial one-line code edit? I'm hoping so since Forge comes all this stuff out of the box.
I'm worried about doing a push and then finding out Redis isn't set up properly, things break, site goes down, lose customers etc. I'm a strong believer in "if it isn't broken, don't fix it" --the file driver works fine at the moment but I would like some more speed.
I had no experience with it when I set it up the first time either, but it's pretty painless. Basically it runs on port 80, instead of your webserver running on port 80.. if a requested page is in cache it's served immediately, so php, db, etc never get touched at all. If it's not in cache (the varnish cache, specifically) it passes the request through to the webserver, now running on port 8080, for example, which serves up the response, which varnish then caches.
That will always be significantly faster than any cache backend option because it's able to prevent the app from having to bootstrap at all to generate responses.
Any speed differences you find between file based and redis based caching are likely to be fairly minimal, because you still have the overhead and latency of bootstrapping the app, checking the cache, and responding. Vs. varnish which will simply respond from memory directly in usually 200ms or so. The result is that your site will load pretty much instantly. This kind of solution would also handle traffic spikes better than a different cache backend, because, again.. php wouldn't be part of the equation at all for handling many of the requests.
Please or to participate in this conversation.