大网数据广告活动
服务器运维问答

Why is my request queueing time so high?

· 52CE 我爱测

I am running a Rails application server. My setup is: Apache 2, using mod_ssl for both https and ssl client certificates Phusion Passenger 5 Rails 4 Ruby 2.1 I use NewRelic to monitor the running application. I recently enabled m…

问题原文

原帖链接 · YWCA Hello · CC BY-SA 3.0

I am running a Rails application server. My setup is:

  • Apache 2, using mod_ssl for both https and ssl client certificates
  • Phusion Passenger 5
  • Rails 4
  • Ruby 2.1

I use NewRelic to monitor the running application. I recently enabled monitoring for request queueing delay, mainly out of curiosity. I was surprised to find that the delay in the request queue is often as long or longer than the actual ruby code and database execution time. ~200 ms seems high, right?

Most online information indicates that this happens when the request queue is waiting for a worker to become available, but that isn't the case. As seen below, we're barely using our provisioned instances. During peaks, we rarely go above 30% utilization.

A few other notes:

  • Apache and Passenger reside on the same server, so there is not a false timing issue due to system clocks being out of sync.
  • Regarding SSL processing, Apache grabs the client SSL certificate and attaches it as a header in the request. The rails application then handles the rest of the processing.

What could be the issue here?

已采纳解答

原帖链接 · Antonius Bloch · CC BY-SA 3.0

200ms doesn't seem that terrible. The 'request queuing' metric is the measure of time between your web server logs the request and the moment the New Relic agent loads (after before_filters). The way this is measured can make it seem like there is a problem, when one doesn't exist. Your latency is nice and even, with no spikes that would indicate you are running out of workers or starving for resources/CPU. You can use watch passenger-status to check this. You can also double check the server's resource usage locally using Linux utilities:

top, iotop, vmstat, sar (systat)

Still want to hunt for optimizations? Check out anything that executes before the New Relic agent. Possible pain points:

It will take some digging. Good luck!

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-08-17)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。