nginx的$request_time和$upstream_response_time监控

来源:互联网 发布:游族网络怎么样 编辑:程序博客网 时间:2024/06/05 17:06

前言

今天老师在trello上给我提了个任务,就是修改nginx的日志格式,对nginx进行监控,因此又接触了两个nginx常用参数,这里记录一下

$request_time&&$upstream_response_time

首先,解释一下这两个参数
  • $request_time:nginx处理请求的时间
  • $upstream_response_time:php-cgi的响应时间

日志格式



测试

代码

<?phpsleep(5);echo "hello world!<br>";?>

日志



作用

我们可以通过代码分析日志,根据$request_time和$upstream_response_time排序获取最耗时的请求,改进代码提高用户体验!
原创粉丝点击