I'm having some trouble with my Rails app being very slow on my staging server. What is most confusing is that the final line of the log output for each request.
It seems the View and Database times aren't even close to the entire render time. On one page it is as bad as ~1000ms for Completion, ~450ms for the View and ~20ms Database.
Where does the rest of the time required to render the page come from?
When things are mysterious.... profilers are your friend!
a profiler will draw up statistics of which methods are being called the most and how long is being spent in each method call.
ruby-prof does the trick for me when I'm in RubyLand, and it will produce a nice call-graph (in html format if you want), that makes it nice and easy to see which methods are slowing up your request.
I've found a large proportion of the render time can be spent on Rails creating and preparing Active Record objects. After the query and before the view. Depending on how many records are returned from a 'find', for example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With