How to detect and log long time taking requests and connection timeout requests

Viewed 500

question is pretty simple even if not so obvious.

I managing a website that's showing issues with connection timeout, making the web service unaccessible and not working properly when it happens.

The actual environment is WooCommerce on a self-managed secured VPS.

php7, php-fpm, wordpress 5.+, apache2, mysql, cPanel, centOs

For a couple of time the site became unreachable showing Connection Timeout error, even if all services was up and running.

How to track or log requests originating the connection timeout error?

For example, with an application ran on the server that:

  • log every requests that occurs with more than 30 seconds execution time
  • the moment of the request
  • the request URL.

Any software, wordpress, cPanel extension or service in order to detect the issue?

1 Answers

I get the solution in matter of detecting the situation when it happens.

The key information can be found in PHP-FPM log (deducted that by the fact that restarting PHP-FPM and not Apache2 was solving the problem, due to a probable PHP-FPM thread appended).

i.e., in a cPanel enviroment you would find the log at the path:

/opt/cpanel/ea-php$$/root/usr/var/log/php-fpm/error.log

In the file the following lines are noteful:

[Tue Jul 16 09:55:30.677693 2019] [proxy_fcgi:error] [pid 17283] (70007)The timeout specified has expired: [client 162.158.91.192:16946] AH01075: Error dispatching request to : (polling), referer: https://www.example.com/my-resource.php
[Tue Jul 16 10:00:30.738947 2019] [proxy_fcgi:error] [pid 17283] (70007)The timeout specified has expired: [client 162.158.91.192:16946] AH01075: Error dispatching request to : (polling), referer: https://www.example.com/my-resource.php

So I've been able to inspect the shown resource and replicate and solve the issue.

Related