5

I've got a 512mb server instance with one core. As of right now I have about 3 websites with about 10k articles, on all of them I have wp super cache enabled. The typical cache time is 3600 secs or 7200 secs. And The vps instance is holding on just fine. It has only a spike of around 60% of cpu once a day.

I read that once a website reaches 30k articles, it is not a good practice to rely on wp super cache, because of the file number (linux file system) or something like that.

So I thought maybe, I should switch to using, nginx fastcgi cache. In their website they recommend this as the best practice, compared to wp super cache or w3 total cache.

Considering the amount of ram, I have available. Would you guys think fastcgi cache would be a better alternative for my sites?

What about memcached?

I have php 7.1 with opcache enabled.

Ryan
  • 53
  • 5

1 Answers1

3

Your 30K number is likely irrelevant. In this question someone has 8 million files in a folder.

If you have many anonymous users you'd probably be best off with Nginx page caching and a CDN like CloudFlare (simple, with a free tier) or CloudFront. An anonymous user is any user who doesn't log into the website, o. It might be more accurate to say you can cache pages that aren't personalised at all. You can't cache, for example, account balance, threads started, etc, as they're different for each user.

FastCGi caching is what I call page caching. I have a tutorial that may be interesting.

Any Wordpress plugin means PHP needs to be started. PHP is slow and memory hungry. Nginx page caching means you don't invoke PHP, so it's much much faster. I would guess Nginx page caching 10 to 100 times faster than calling PHP, and uses significantly less resources - CPU and RAM.

Memcached is a fast key / value store, but it's typically callled from Wordpress so you still have the PHP overhead.

Tim
  • 31,888
  • 7
  • 52
  • 78
  • Hi, what do you mean many anonymous users? What does it have to do with caching? – Ryan Oct 22 '17 at 22:44
  • Thank you for clearing some doubts I have. So the link your provided "nginx page caching", it relates to fastcgi caching right? Or that is a different nginx method/module? Sorry for my ignorance Thank you – Ryan Oct 22 '17 at 22:45
  • I'll edit my post to clarify, give me a few minutes. – Tim Oct 23 '17 at 00:44
  • Thank you. I have php 7.1 with opcache enabled. That is a plus, so even with 7.1 with opcache, you would still recommend fastcgi cache I guess. Would fascgi consume less memory as the current setup? Since fasctgi needs a certain amount of ram, to run, wouldn't it leave less ram for mysql and php to run? – Ryan Oct 23 '17 at 13:59
  • Any PHP process takes RAM and CPU - typically 64 to 256MB RAM, and Wordpress is bit of a CPU hog. An Nginx worker process returning a cached page might use a couple of MB of RAM and very little CPU. Invoking a PHP scrip that simply wrote "hello world" probably takes an order of magnitude or two more resources than returning a page from the Nginx page cache. One of the keys to scaling is caching, at multiple levels. Another key which is less relevant here is distributing work, either to application / web server nodes or a CDN. – Tim Oct 23 '17 at 17:23
  • You've been perfectly clear. Many thanks my friend, Tim :) – Ryan Oct 24 '17 at 12:23
  • Just one last question path/to/cache levels=1:2 keys_zone=my_cache:10m max_size=10g my_cache:10m, will these 10m be reserved in ram for nginx, or "my_cache" could also be a file, if there is no ram available? Thank you – Ryan Oct 24 '17 at 12:25
  • Off the top of my head I don't know sorry. Have a look at the documentation or ask another question. – Tim Oct 24 '17 at 18:25