Вопрос

This question might be a bit long and specific, but I have been attempting to find conclusive answers to the following questions for about a month now and I have yet to find decisive information. A question as specific as this is hard to generalize and if I would have come across a similar question it would have been informative even if the specific server configurations would've differed from mine.

My server is a VPS running cPanel (WHM) and PHP mode is SuPHP. The server has 768MB of RAM and hosts about 12 websites. Some are quite memory intensive whereas other hardly use any memory or cpu at all.

I have recently installed a Magento store for one of my customers and have since been experimenting with different settings to achieve performance gains. Nothing really helped until I installed xCache and configured PHP to run as FCGID or DSO (because xCache will not work with SuPHP). This configuration boosted performance by 2/3 (meaning pages loaded about 3 times faster).

The only setback was that after a few minutes, the server ran out of memory and I had to hard reset it. So now I'm back to SuPHP and things are fine.

Even if I disabled xCache and only left FCGID or DSO mode instead of SuPHP, the server ran out of memory in about 30 mins or so. The culprit, therefore, seems to be PHP running as anything else then SuPHP.

I also noticed that my memory usage went way up when I opened a new front-end URL from a different WHM-defined user, but the usage seemed to remain fairly constant when I opened up multiple URLS from the same WHM user account.

To the point then:

  • How can I make sure PHP + xCache keep running stable? Or do I just need to buy more memory?
  • What are the differences in memory usage between SuPHP, DSO and FCGID? Is it possible to tweak this by changing some php.ini vars?

Also, I'm contemplating to update some of my other servers to use xCache. What configuration of settings and PHP mode (SuPHP, DSO or FCGI) and xCache would you recommend for the following servers?

  • Quad core @ 2.4Ghz, 4GB RAM dedicated server with 1 huge Magento store, with cPanel and WHM
  • Quad core @ 2.4Ghz, 8GB RAM server with some 20 large Magento stores, with cPanel and WHM
  • Quad core @ 2.66Ghz, 8GB RAM server with 100+ Joomla-like websites, with cPanel and WHM, also acting as e-mail server with mailman enabled etc.
Это было полезно?

Решение

Since you are running cPanel - you can easily install Munin (a graphing plugin). Go to WHM, type plugins in the search box and install Munin.

Let it collect some statistics for about a week, then you will have a good overview of memory usage.

SuPHP is actually quite CPU intensive, so you will want to switch.

We recommend PHP-fCGI when using cPanel, it is a drop in replacement and works well. We compile with Eaccellerator - as we have tested all other options (APC/Xcache) and found it to be the fastest by a significant margin. I go into some detail here about it http://magebase.com/magento-tutorials/magento-session-storage-which-to-choose-and-why/comment-page-1/#comment-1986

If you are hitting OOM (out-of-memory) errors, then you'll probably find you are overcommitting on memory; this is a result of two things (we'll just focus on PHP):

  1. Too high a PHP memory_limit
  2. Too many PHP processes

You need to cap one of the two. For a small VPS like you have, you are going to struggle with 768MB RAM. We never advocate using a VPS as you are far too constrained to efficiently run Magento.

Based on your specifications, a 2.4Ghz, 8GB RAM server will not be capable of running 20 "large" Magento sites. To put this into perspective, typically, (for shared hosting) we put 8 stores maximum on a 3.3GHz, 16GB RAM server.

I would suggest seeking help from a professional in order to set your server up properly, as you are going to find a lot of conflicting information regarding Magento optimisation.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top