Sray
Sray

Reputation: 685

php-fpm memory consumption

I have php5-fpm (with apc) and nginx installed on ubuntu-powered vps server (2000MHz/512MB). Hosting reported there's abnormal memory consumption on my server. top shows that there're some php-fpm processes using up to 1gb of memory.

I tried to adjust pm.max_requests and pm.max_children but the issue remains.

Any advice will be appreciated greatly.

Here are my configs:

php.ini
php-conf
nginx.conf:

Upvotes: 1

Views: 8224

Answers (1)

Ankit Gujarati
Ankit Gujarati

Reputation: 855

you have to much server in php-fpm. you can configure your php-fpm pool server using this below calculator.

Now we can decide how many processes the server is allowed to spin up.

Total Max Processes = (Total Ram - (Used Ram + Buffer)) / (Memory per php process) This server is has about 512MB of ram. Let's say PHP(your request) uses about 30mb of ram per request.

We can start with: 521 / 30 = 17.06 Let's just go with 17 max servers. if your request consume 100MB per request then 512/100 = 5.12 so you have to configure 5/4 max server for php-fpm pool.

now your apache/nginx take some ram so i suggest to set 10 server only.

Upvotes: 1

Related Questions