apache 启用apache响应时间日志指令的性能影响

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1644839/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 18:20:13  来源:igfitidea点击:

Performance effect of enabling apache response time log directive

performanceapachemonitoringloggingresponse-time

提问by makeyourownmaker

What affect will enabling the response time (%D) LogFormat directive have on apache performance?

启用响应时间 (%D) LogFormat 指令对 apache 性能有什么影响?

The response time is the time taken to serve a request in microseconds.

响应时间是为请求提供服务所花费的时间(以微秒为单位)。

Response time can be enabled like so:

可以像这样启用响应时间:

#LogFormat "%h %l %u %t \"%r\" %>s %b"    # Default LogFormat
LogFormat "%h %l %u %t \"%r\" %>s %b %D"  # LogFormat including response time

I have written a tool for monitoring and analysing backend script performance, apache-response-time, which requires response time data. I would like to warn potential users how enabling this directive will affect apache server performance.

我编写了一个用于监控和分析后端脚本性能的工具 apache-response-time,它需要响应时间数据。我想警告潜在用户启用此指令将如何影响 apache 服务器性能。

回答by covener

Probably not worth considering in terms of HTTP responses -- only the overhead of 1 addl gettimeofday() call (and a few function calls) so something on the order of a few microseconds. Apache already notes the same thing when the request arrives.

在 HTTP 响应方面可能不值得考虑——只有 1 addl gettimeofday() 调用(和一些函数调用)的开销,所以大约几微秒。当请求到达时,Apache 已经注意到了同样的事情。

http://www.atl.lmco.com/projects/QoS/POSIX_html/index.htmllists some old microbenchmarks of gettimeofday() itself.

http://www.atl.lmco.com/projects/QoS/POSIX_html/index.html列出了 gettimeofday() 本身的一些旧微基准测试。