0

We are running magento on VPS, which is facing a Numproc issue. According to our hosting provider, our server is exceeding the limit of numproc "400" & memory usage is also high. Because of this memory shortage our website faces "Memory Allocation" issues. We are using nginx & php-fpm handlers. They have also changed the MPM from worker to event.

Now my question is that, how can we control our memory. Is there any way through which before reaching the limit of "400" or memory of "90%" our services re-start automatically thus free up the resource that is occupied with unused processes. Restarting which service(apache, mysql or nginx) can help us gather back resources. Any tweak in config file that can help us distribute resources in better way.

BTW, memory usage on server status(on WHM) is always under 40%. Isn't this fishy.

I hope, i am able to describe my point over here. Please help us optimize the resources for better use.

Regards

Mek
  • 1

1 Answers1

1

As someone who works for a hosting company, I've seen this particular issue with our OpenVZ containers. Some hosting providers will use OpenVZ because of the ability to oversell nodes, creating what we call the "bad neighbor effect".

Basically, containers will share all resources on the node. Yes, you are allocated a certain amount of memory, numprocs, disk space etc. However, if other containers are exceeding their limits in any of the resource categories, your VPS's resources may be squeezed (e.g. disk space may suddenly shrink or memory shortages occur).

Your hosting company is most likely looking at failcounts for numproc and memory. If you exceed the numproc limit multiple times, failcounts will start to add up. If your magento site is exceeding the 400 numproc limit, there are a couple of solutions.

Restarting services before hitting your resource limits is not a viable solution. I'm sure your goal is to keep your site running with optimal uptime. If there is no way to optimize your site to use less resources then I would have your hosting company inspect the traffic (if you are a managed client) to see if it is legitimate. Sometimes traffic can be malicious and attempt brute force attacks driving up process counts.

Regarding memory usage, I would take a look at your php.ini file for the parameter memory_limit=64M. I would recommend setting the limit to no higher than 96M (64M is ideal) with a server running 4GB of RAM or less. Sometimes people will set it to 256M or higher on a server running 2GB of memory and wonder why memory maxes out all the time. I am not familiar with your magento site, so I'm not sure what the ideal php.ini setting should be. For the VPS environment you are describing, it appears the limit should be no higher than 96M.

From the sound of it, it seems you exceed your numproc limit on a regular basis, which most likely is the cause of a site with heavy traffic or un-optimized coding. I would HIGHLY suggest moving to a hardware virtualized environment (see if they offer KVM or XEN virtualization). Hardware virtualization will eliminate the "bad neighbor" effect and give you DEDICATED resources. 400 numproc is around the highest limit our company offers for VPS servers on an OpenVZ node.

If moving to a hardware virtualized environment is not an option with your hosting company, try looking into their entry level dedicated servers.

  • Thanks user2864981, for the response. That means the resource shortage could be because of some other user using the VPS i am on. How can i make sure it is "Bad Neighbor Effect". There is quite a lot of sleeping process, that might have held up the resources. If you were in place, what would you do first. – Mek Feb 24 '16 at 21:17