How can I track performance bottlenecks in my Rails application?

I want to determine where the delay time is in my application. I am trying to collect why my requests take much longer than the declared time. I gave an example from a magazine. Between views and ActiveRecord, the time is only 150 ms, but the whole response took 1483 ms. This is more than a whole second lost somewhere that is not monitoring.

Started POST "/contacts" for 80.171.62.199 at 2012-05-14 09:51:33 +0000 Processing by ContactsController#create as HTML Parameters: {"developer_api_key"=>"foo", "user_api_key"=>"bar", "contact"=>{"name"=>"Cors Test"}} HTTP Logger Request ID: 4fb0d5a583098e0014000002 Completed 201 Created in 1483ms (Views: 133.2ms | ActiveRecord: 24.0ms) 

I use New Relic RPM to monitor application performance, which only shows me: ContactsController#index: 426ms . There is still a ton of time and code that is unaccounted for.

What is the best way for me to figure out where the code is wasting time? Should I invest in distributing new RPM relics or use something like ruby-prof?

+4
source share
2 answers

Is it in production? If yes, yes, invest in a new relic or try them with your free β€œthing” upgrade, which they usually have. I think you get it within a week, usually. See if they have such deals right now.

Also, do you have before_filters, api calls for third-party services, some weird initializers, and this is the first time POST has been called after a server reboot?

You have a developer_api_key that is probably checking somewhere (possibly locally) or a third-party service.

A lot of factors, but it's just a second. Most standard applications would be fine with POST. If this is not a new Relic clone that accepts POSTS and only POSTS, i.e. This is your bread and butter.

Also, is there a pointer to an api key? just in case.

+1
source

The new Relic is the best tool for this:

http://newrelic.com/

I'm not a fan of promotional products here, but I used it, and it really helps.

0
source

Source: https://habr.com/ru/post/1412354/


All Articles