Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 621
Anders Fredriksson Avatar asked Feb 05 '15 18:02

Anders Fredriksson


1 Answers

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

like image 176
wurde Avatar answered Nov 12 '22 17:11

wurde