vpoulain
vpoulain

Reputation: 740

50 seconds to get my response from heroku rails server

Almost 2 years ago I wrote web application and deployed it on heroku. Since, I've just maintained it a bit so I am not very up-to-date with Rails.

I have serious production problems I need to solve asap. It's a restful API.

 curl  http://myserver.com/users/1

take 50 sec now. It's not cached. However :

 curl  http://myserver.com/users

take 100 ms, it's cached.

Maybe a DB access problem ? Nop ! I did:

> app.get 'users/1'

I got a response in 60 ms.

Maybe a rendering problem ? Nop, I rewrite a controller method like this:

 def show
    render json: 'foo'
 end

It was the same, it took 50 seconds to got response : 'foo' Then, I plugged NewRelic plugin: no latence has been spotted.

My only log is:

2014-07-12T17:04:44.650173+00:00 heroku[router]: at=info method=GET path="/users/1" host=www.-----.net request_id=323db6cf-73c0-459f-928a-dd88e1229779 fwd="89.156.00.00" dyno=web.1 connect=1 service=182 status=200 bytes=342 (got before getting response in client :/)

I don't ask for solution. I'm asking about: what/where can I investigate ?

Upvotes: 0

Views: 68

Answers (2)

ruby_newbie
ruby_newbie

Reputation: 3285

it is only after the server hasn't been hit in a while? Heroku will spin down the servers if they are not in use and it takes a while for them to spin up.

Upvotes: 1

Chris Valentine
Chris Valentine

Reputation: 1637

I found information on Twitter since I had the same issue.

this seems to be related to websockets. Disabling it seems to cure the issues.

heroku labs:disable websockets -a myapp -p production

this makes it work as it used to, though the logs now look different :)

thanks to @dwaynemac @stephane_tavera on twitter.

EDIT:

Heroku shows this as a resolve issue, but answer applies in case it happens again.

https://status.heroku.com/incidents/649#update-2163

Upvotes: 0

Related Questions