Vps – Very high Magento/Apache memory usage even without visitors (are we fooled by our hosting company?)

magentomemoryperformanceswapvps

I am no server guy and we have issues with our speed so I come here asking for advise. We have a VPS with 2 cores and 2gb of RAM at a Magento specialized hosting company. Over the course of the last weeks our site speed has gotten worse, even though our store is new, has less than 1000 SKUs and not even 100 visitos a day.

At magespeedtest.com we only get 1.87 trans/sec @ 2.11 secs each with a mere 5 concurrent users. Our magento log files are clean, we have no huge database tables or anything like that.

When we take a look at our server real time stats, we see that the memory usage jumped up from about 34% to 71% and now 82% in just a few days in idle, with no visitors on the site. Our hosting company said that we do not need to worry about that as it`s maybe related to mysql which creates buffers (which are maybe not even actually being used) and what is important is CPU and swap – stats are ok here.

They also said that the low benchmark scores are caused by bad extensions or template modifications on our side. We are not sure if we can trust that statement as we only have 4 plugins installed (all from aheadworks and amasty which are known to be one of the best magento extension developers). Our template modifications are purely html and css, no modifications to the php code. Our pagespeed is ranked with 93/100 in firebug and Magento is properly configured, so the problem really just gets obvious when there are a handful of users on the site at the same time.

Can anyone confirm our hosting`s statement about memory usage and where can I start looking for a solution?

Best Answer

You're going to want to check the server from the shell (terminal) and check out the specs/performance. One of the major things you'll want to check is the used/available RAM. Linux will by default, cache all available memory and use it as needed.

Linux Ate My Ram gives a good and fun breakdown about memory usage on Linux.

In addition to that, I would setup monitoring on the system.. (monit, munin, are a few, but there are plenty of others). You'll want to monitor the base system (CPU, Memory, HDD I/O) as well as the various services running on there (Apache/Nginx, MySQL, etc.) and from that gathered data look for trends.

Lastly, there's a nice site called Pingdom that helps diagnose slow-loading issues with sites that may be of use to see if there's any items on the actual pages causing the spikes.

Ultimately the monitoring and watching the system at a lower level should help to get you going in the right direction.

-Brendan