ActionDispatch::Routing::RouteSet#call Rails 4.1 really slow

会有一股神秘感。 提交于 2019-11-28 21:19:07

问题


I've searched for days but can't find any relevant answers to this question.

In my Rails 4.1 app hosted on Heroku, when the load goes up, some PUT requests get REALLY slow. The slowest one today was 53 seconds. All without the database (MongoDB) registering any slow queries. Normally this request takes 0.3ms so pretty fast. The request is slow no matter what the payload is.

Upon installing New Relic it shed some more light on the situation, but I still don't know where to fix this problem.

The code in the controller is fast, but according to New Relic, the thing that is slow is ActionDispatch::Routing::RouteSet#call

Here's a dump of what New Relic reports:

Slowest components                      Count   Duration    %
ActionDispatch::Routing::RouteSet#call  1   53,000 ms   100%
Plugin::FetchablesController#update     1   38 ms       0%
Rails::Rack::Logger#call                1   1 ms        0%
ActionDispatch::Cookies#call            1   1 ms        0%
ActiveSupport::Cache::Strategy::LocalCache::Middleware#call 1   0 ms    0%
Rack::Runtime#call                      1   0 ms        0%
Total                                       53,000 ms   100%

Some other info that might help or could perhaps have something to do with this. I have an alias for the routes, but I can't see why that should matter.

namespace :plugin do
   resources :fetchables, path: :minables
end

Any ideas on what might be going on and what I could do to fix it would be greatly appreciated.

Update So it seems that this is memory related. When we upgraded to Performance Dynos we've stopped seeing these errors. But this is something that seems to be seriously badly configured at Heroku.


回答1:


The slowdown is an indicator that it's Heroku-specific. Probably why you saw the problem disappear when you upgraded to Performance Dynos.




回答2:


You could use rack-mini-profiler to check where the real problem is.



来源:https://stackoverflow.com/questions/28351527/actiondispatchroutingroutesetcall-rails-4-1-really-slow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!