I am using Grape on top of Rails 4.2.1 to provide an API for our application.
But when I test Newrelic for performance today, I find that RackApp Proc#call and Grape API::Root#call are time consuming. (See screenshot)

Then I tried to record the time spent on the middleware using rack_timer and found that ActionDispatch::Routing::RouteSet takes up most of the time:
Rack Timer (Application Action) -- ActionDispatch::Routing::RouteSet: 67.12579727172852 ms Rack Timer (Application Action) -- ActionDispatch::Routing::RouteSet: 101.51457786560059 ms Rack Timer (Application Action) -- ActionDispatch::Routing::RouteSet: 84.18059349060059 ms Rack Timer (Application Action) -- ActionDispatch::Routing::RouteSet: 1236.2565994262695 ms Rack Timer (Application Action) -- ActionDispatch::Routing::RouteSet: 8.124351501464844 ms Rack Timer (Application Action) -- ActionDispatch::Routing::RouteSet: 55.65309524536133 ms
There are even cases that take 500 ms - 1000 ms in ActionDispatch::Routing::RouteSet . How could I track this issue and how do I know what I did wrong in Rails routes?
Thank you for help.
performance ruby-on-rails ruby-on-rails-4 newrelic grape
larryzhao
source share