php-fpm tuning

726 views
Skip to first unread message

Sudheer M

unread,
May 17, 2019, 1:02:44 PM5/17/19
to highload-php-en
 I have 2 web servers with 16GB RAM and 8 Core CPU each. where as Database Server separate with 32 GB RAM and 8 Core CPU.

Below is the average used for php-fpm

pgrep -f php-fpm | xargs -r ps --no-headers -o "rss,cmd" | awk '{ sum+=$1 } END

{ printf ("%d%s\n", sum/NR/1024,"M") }'


87M


--> Am using below configurations method to tuneup php-fpm service


pm = dynamic

pm.max_children (total RAM - (DB etc) / process size)

pm.start_servers (cpu cores * 4)

pm.min_spare_servers (cpu cores * 2)

pm.max_spare_servers (cpu cores * 4)

pm.max_requests 1000


Below is the error am getting in php logs


WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers)


And Nginx error as below


connect() to unix:/var/run/php/php7.2-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 127.0.0.1

Could you please help me in setting up php parameters and resolving this issue.

Nikola Filipović

unread,
May 17, 2019, 7:14:50 PM5/17/19
to highloa...@googlegroups.com
Hi,

Might be your MySQL server not being able to respond quickly to all the queries, I’ve seen that happen too.

Also, considering the resources you have available, I think you might be better off setting the process manager to static which will allocate all the resources on startup. Here are a couple of articles that helped me when I was configuring a PHP-FPM stack for high load. 


Nikola
--

---
You received this message because you are subscribed to the Google Groups "highload-php-en" group.
To unsubscribe from this group and stop receiving emails from it, send an email to highload-php-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/highload-php-en/a386cd23-835c-4de5-baeb-600fdce0eb37%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sudheer M

unread,
May 19, 2019, 10:56:05 AM5/19/19
to highloa...@googlegroups.com

Hello Nikola,

 

Thanks a lot for your response. As you mentioned “Mysql Server not being able to respond quickly” could you please suggest where should I check this because I don’t see any mysql error logs in the server.

 

 

Description: Description: Description: cid:image001.jpg@01D3FE4C.5C240370

 

Sudheer M

Sr. DevOps Engineer

US: 877.536.7486   India: +91 8142645618

Read Ecommerce & ERP Insights Here

 

image001.jpg
Reply all
Reply to author
Forward
0 new messages