0

I am trying to figure out, why Apache sometimes processes request very slow. The most time, the "Time To First Byte" is adequate (~ 90ms), but sometimes there are peaks greater than a second.

I am monitoring three PHP pages:

  • start page
  • gallery page
  • detail page

and as reference

  • a static HTML page

While the PHP pages have sometimes (not periodically) values up to one or more seconds, the static HTML page is not affected by slow response times. Also remarkable is, that the peaks in processing time for all three PHP pages are almost congruent.

For monitoring I run curl in the same network and send requests to the webserver directly (hostname). The request does not pass any caches. The monitored processing time is calculated as follows:

Time from start required to send the requestminus time from start until the first answer byte was received from the server.

The three PHP pages use memcached (127.0.0.1) and content from a MySQL (host: hostname) database. Apache is configured with PHP-FPM (socket).

The LOAD, CPU-, MEMORY-, DISK-utilization and the time for name resolution seem not to be problematic.

A little stress test for memcached statet out, that it continiously responds quickly. I think, the problems scope could be the database. In another Post here in Server Fault I've read, that some system or kernel paramters could cause this behavier. Unfortunally, I do not know, which parameters are typically for this situation.

I could strace apache and/or xdebug php - but the slow time to first byte is every few hours. So I could try to debug for hours and there will not happen a slow processing.

So my question results in: Do you have any hint, how could I concrete investigate the problem? And in relation to the other post: Are there typical system/kernel parameter, I should have a clooser look to?

Thanks,
sdev

3
  • You should first identify whether it's your app, php-fpm or the webserver that is the primary cause for delay - check how many requests in parallel your setup will handle before queueing them, i.e. the value of MaxClients in apache and pm.max_children in php fpm - are you hitting that? Check your log files ;).
    – AD7six
    Nov 5, 2014 at 10:37
  • @AD7six: The values for MaxClients and pm.max_children are equal and not reached. In the next step, I try to make tests on the combi apache/php-fpm.
    – sdev
    Nov 5, 2014 at 11:53
  • Showing some evidence of that would be helpful, but anyway that means the problem is your php application (and makes it off topic for here) check for e.g. attempted concurrent session access - the first request that opens a session will block the others.
    – AD7six
    Nov 5, 2014 at 12:59

0

You must log in to answer this question.

Browse other questions tagged .