LittleLebowski
LittleLebowski

Reputation: 7941

PHP-FPM listen queue getting filled, what's wrong with my config?

I get good amount of traffic on my blog (2000 users realtime on average days, 5000+ on good days, pageviews per minute varies from 300 to 700+).

But I feel I'm missing out on traffic due to bad configuration of my Wordpress nginx setup. I'm using New Relic to monitor performance and I've noticed that site becomes unresponsive at random intervals (mostly when I get more traffic and have not restarted php-fpm for quite some time).

When it becomes unresponsive, nginx status page shows

listen queue: 500+ (this number varies)
max listen queue: 500+ (this number varies)

So I was wondering why nginx is not able to accept connections, since my server is quite capable:

DigitalOcean 48GB Memory
16 Core Processor
480GB SSD Disk

So I must have got some setting terribly wrong.

nginx.conf

worker_processes  24;
worker_rlimit_nofile 20000;
events {
    worker_connections  40000;
    use epoll;
    multi_accept on;
}
keepalive_timeout  65;
client_header_timeout 180;
client_body_timeout 180;
fastcgi_read_timeout 180;

php pool config

pm = static
pm.max_children = 100
pm.max_requests = 500

PHP-FPM status page shows now (I've restarted both php5-fpm and nginx recently)

pool:                 www
process manager:      static
start time:           29/Dec/2016:07:12:38 -0500
start since:          18854
accepted conn:        492343
listen queue:         0
max listen queue:     199
listen queue len:     40000
idle processes:       98
active processes:     2
total processes:      100
max active processes: 100
max children reached: 0
slow requests:        0

What am i missing? Is the worker connections config not correct? Please guide me.

Upvotes: 2

Views: 4854

Answers (1)

Woody
Woody

Reputation: 1491

Ran into similar issue last year. I cannot recall exact values used to solved (client's server and no longer have access) but learned that tweaking PHP-FPM config to match the sysctl.conf settings helped tremendously.

Do recall having to spend a few days monitoring to get perfect values. The site I learned from is:

https://easyengine.io/tutorials/php/fpm-sysctl-tweaking/

Maybe that will get you back on track...

Upvotes: 2

Related Questions