How to define time intervals in a Rails application?

I have a Rails application running on 4.1.6 and Ruby 2.1.3. Several times, according to some requests, they take so much time, but this does not always happen. When I check newrelic, I still cannot identify or trace the slowness lines.

enter image description hereenter image description here

+4
source share
2 answers

check perftools - you can use googles perftools or ruby specific implementation . There is a good entry about it here.

, , . :

Total: 23 samples
18  78.3%  78.3%      18  78.3% BigDecimal#div
4   17.4%  95.7%       4  17.4% BigDecimal#*
1   4.3%  100.0%      23 100.0% BigMath#PI
0   0.0%  100.0%      23 100.0% BigMath.PI

div BigDecimal

+1

API.

Doorkeeper::TokensController#create

module Doorkeeper
  class TokensController < Doorkeeper::ApplicationMetalController
    def create
      response = strategy.authorize
      self.headers.merge! response.headers
      self.response_body = response.body.to_json
      self.status        = response.status
    rescue Errors::DoorkeeperError => e
      handle_token_exception e
    end

  # ...snip...

    private

    def strategy
      @strategy ||= server.token_request params[:grant_type]
    end
  end
end

.


. " " , .

- .

-1

All Articles