What is nginx's $request_time and why is it a lot more than php-fpm execution time?

Viewed 2910

Background: It is the objective of my project is to create a very fast responding website. There are only very few pages, many of them are simply 302 redirects.

In Nginx, I'm logging here $request_time.

In PHP, I'm logging the microtime of the start of the request and just before it exits.

php-fpm (php 5.3.27) and nginx (1.4.4) run on the same machine, there is no database (just writing to a Beanstalkd queue), there are no complicated nginx configurations.

Problem: There is a massive discrepancy between the PHP execution time and Nginx's $request_time. The $request_time is generally 0.5 seconds but during some hours it's more like 3 seconds on average. PHP's execution time is always between 0.008 seconds and 0.02 seconds (using PhalconPHP).

Question: Why could there be such a big discrepancy? Perhaps I don't fully understand what $request_time is, or maybe my webservers have some problematic configuration? I'd be happy to provide more information about the environment.

1 Answers
Related