Okay, so I've been running a VPS for a little while now, but I recently got a message telling me it had to be restarted due to using too much memory, so I'm looking at ways to trim this down.
The following are options that are available, but I'm not sure which ones I should try (I don't want to just change them randomly), so I'd appreciate answers to some questions and/or advice on which ones should work best.
Consolidating User Accounts:
When I transitioned to my VPS I initially only moved one site, which required me to create a new user account, however I've since moved the rest of my sites across to the VPS, but this means I now have two user accounts.
If I were to make sure that all sites were on the same account, would that save me much on RAM? More importantly, will switching user account on my busiest and largest site result in significant downtime? It has a large number of files and can generate a lot of traffic.
Disabling mod_php:
On the PS Optimisation wiki page it states "If all domains are set to use FCGI or CGI for the PHP mode, you may safely deactivate mod_php in the PS configuration to save a good deal of memory", however the mod_php option on the VPS configuration page states "This will save a significant amount of memory if your site serves a lot of static content. PHP-intensive sites may benefit more from setting all domains to use mod_php in Manage Domains and enabling a PHP cache", so which is it exactly?
My busiest domain is basically one large phpBB forum, with most of its guest traffic offloaded into CloudFlare using a custom cache. This means that most of the traffic that does make it to my server requires dynamic page generation, so do I need mod_php or not? Regarding the VPS configuration page's note, I don't even see a mod_php option under domains when I go into Manage Domains, which is nice and confusing
Enabling XCache:
I know that this will increase RAM use per PHP process, which is something that confused me before (or does it use shared memory), but is it likely to reduce RAM usage overall by serving up pages faster?
Like I say my main use is a phpBB forum, and average page generation time is around 0.06 to 0.12 seconds; any pages that take longer to generate (such as posting a new message) usually do so because they're connecting to other sites for spam filtering, so a cache presumably won't help those.
Anyway, I'd appreciate any feedback on which options I should try (and why), as while I know what most of them do in theory, I don't really want to just operate by trial and error on a live site
That said, I'm also confused as to why my site restarted at all; when I go into the Manage Resources page, my actual memory use rarely passes around 110mb, with the rest of my 500mb allowance eaten up by "Cached Memory"; what exactly is cached memory, and do I really need so much of it? My site does serve up a lot of files, but at the same time I've made an effort to ensure that most of these are served up by CloudFlare, so the server should only rarely be getting requests when CloudFlare needs a new file, or needs to refresh an expired one. Is it possible to tweak how much cached memory there is? For example, on my MySQL VPS, even with cached memory the total usage is around 250mb out of the 300mb allowance, so there's plenty of breathing room in case of any spikes.