为什么Application#call会很慢?

Jos*_*ith 5 rack ruby-on-rails-4

出于某种原因,我::Application#call的速度非常慢.在一个案例中,3,840ms根据New Relic的仪器进行了测试.

文档只是将此方法描述为: Implements call according to the Rack API. It simply dispatches the request to the underlying middleware stack.

它甚至需要超过5秒钟ActionDispatch::Routing::RouteSet#call,更不用说我的控制器的方法了.

为什么这会这么慢?我可以在哪里尝试进一步深入研究这个问题?

我的中间件看起来都不是特别奇怪:

use Raven::Rack
use #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x007fd836083e08>
use Rack::Runtime
use ActionDispatch::RequestId
use Rails::Rack::Logger
use Rack::Cors
use ActionDispatch::ShowExceptions
use ActionDispatch::DebugExceptions
use ActionDispatch::RemoteIp
use ActionDispatch::Callbacks
use ActiveRecord::ConnectionAdapters::ConnectionManagement
use ActiveRecord::QueryCache
use ActionDispatch::ParamsParser
use Clearance::RackSession
use Rack::Head
use Rack::ConditionalGet
use Rack::ETag
use ActionDispatch::Flash
use Rack::SslEnforcer
run CookacademyApi::Application.routes
Run Code Online (Sandbox Code Playgroud)

use*_*685 0

不要过度依赖 NewRelic 指标。我最近遇到了同样的问题,页面 NR 估计需要 3 秒才能加载。关闭几个应用程序并重新启动 Firefox 后,NR 显示不到 300 毫秒