Luis D Urraca
Luis D Urraca

Reputation: 2084

PHP-FPM using a lot memory

I'm using PHP-FPM to serve dynamic content to nginx through fastcgi. Everything is working fine except that the PHP-FPM proccesses are using so much memory. According to new relic process monitor PHP-FPM have 6 processes running and combined they are using 220+ MB. Doesn't seem normal to me? What could be the problem?

Upvotes: 0

Views: 1427

Answers (1)

kornstar11
kornstar11

Reputation: 114

A couple things to check are/ tips to debug in a development environment:

  • Could you set the php memory_limit to 35M and see where PHP errors out?
  • Are there any large database queries being ran?
  • Are you using APC with PHP, what is your shared memory size (shm)?
  • If you are familiar with xDebug (http://xdebug.org/). You could use the xDebug profiler (http://xdebug.org/docs/profiler), to see what is using memory. That is your best bet IMO.
  • PHP-FPM allows you to set a max request parameter (pm.max_requests) that will restart a child process after a certain amount of requests. Watch out setting that to low might result in poor performance, and odd behavior under load.

To be honest 37M per process is high, however I have seen applications like Magento get close to that, so there may be no problem. Hope that helps.

Upvotes: 1

Related Questions