出于某种原因,我的 ::Application#call
非常慢。在一种情况下,它花了 3,840ms
根据 New Relic 的仪器。
文档只是将此方法描述为:Implements call according to the Rack API. It simply dispatches the request to the underlying middleware stack.
连到ActionDispatch::Routing::RouteSet#call
都需要5秒多的时间,更不用说我的 Controller 的方法了。
为什么这会这么慢?我可以在哪里尝试进一步深入研究?
我的中间件看起来都不是特别奇怪,要么:
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
最佳答案
不要过分依赖 NewRelic 指标。我最近遇到了同样的问题,页面 NR 估计加载时间约为 3 秒。关闭几个应用程序并重新启动 firefox NR 后显示不到 300 毫秒
关于ruby-on-rails-4 - 为什么 Application#call 会很慢?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27552776/