2

On one of our app hosted on Heroku we do a backend call (in Ruby) to generate access token:

require "uri"
require "net/http"

parameters = {
    code: params[:code],
    client_id: "my_client_id",
    client_secret: "my_client_secret",
    redirect_uri: "http://#{YAML.load_file("config/domains.yml")[Rails.env]['domain']}/oauth2callback",
    grant_type: "authorization_code"
}
response = Net::HTTP.post_form(URI.parse('https://accounts.google.com/o/oauth2/token'), parameters)

But each time Newrelic reports a response time always (90%) above 800 ms (and up to 3sec).

You can see that in Newrelic report graph

On the other hand, refreshing the access_token is consistently below 250ms.

Is there something wrong in the code, on Google side or should I blame heroku DNS?

Julien Hobeika
  • 323
  • 2
  • 7
  • I'm also seeing this, but from my local machine. My heroku instances POST quickly. I've also tried Curb, a Curl binding for Ruby. It is slow too - I don't think it's DNS related. – Jimmie Tyrrell Dec 06 '14 at 00:05

0 Answers0