0

We have a project running in nginx/php-fpm which is basically a multi-site setup build on Symfony 2.7 and we're working on the next version of the site which is basically adding an another site to the project with some additional features. Just before going live, we needs to make sure everything works fine. So the site was hosted on subdomain.site.com with only internal access.

Basically there are 2 file servers and 2 load balancers with nginx. Load balancers receive the request and direct it to the web servers (where the php-fpm is installed) based on the load.

Now, the problem is the site is very slow, but the same website hosted on the test server is much faster which is having less configuration with multiple projects than the live server. This is what I see from the logs.

Web Server (PHP-FPM):

x.x.x.x - [08/Jan/2019:14:40:33 +0000] GET /app_dev.php/a-sample-url/ 200 Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 took:14.856s

Load Balancer:

x.x.x.x - [08/Jan/2019:14:40:48 +0000] "GET /app_dev.php/a-sample-url/ HTTP/1.1" 200 38386 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36"

Here you can see that the php-fpm alone is taking 14.856s to execute also I'm unsure about how the logging is happening on the load balancer which is having the later time (not sure if it's the time when it returned response).

The live website is also located on the same server. So I'm doubting if the php-fpm is having a separate configuration for the sub domains.

Hereby I've attached the copy of my php-fpm configuration (excluded default values due to the size).

[www]
user = apache
group = apache
listen = 192.168.x.x:3456
listen.allowed_clients = 127.0.0.1,192.168.102.101,192.168.102.23
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
access.log = /var/log/php-fpm/$pool.access.log
access.format = "%{REMOTE_ADDR}e - [%t] %m %{REQUEST_URI}e %s %{HTTP_USER_AGENT}e took:%ds"
slowlog = /var/log/php-fpm/www-slow.log
php_admin_value[error_log] = /var/log/php-fpm/www-error.log
php_admin_flag[log_errors] = on
php_value[session.save_handler] = redis
php_value[session.save_path]    = "tcp://192.168.x.x:1234/1"

Any help on this would be highly appreciated.

  • 1
    What's in the slow log? – Michael Hampton Jan 8 at 16:46
  • php-fpm slow log is a kinda vague, it contains all the requests exceeds the the time we set – Stranger Jan 9 at 3:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.