Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
613 views
in Technique[技术] by (71.8m points)

ruby on rails - Slow Page load on heroku

I have a rails 4 app on heroku. I'm relatively new to both.

Every page I load or ajax I execute takes 1 minute. Always no matter when.

I thought it had to do with ajax calls because I an visually see when the DOM is loaded fully better, but it really is any page that I grab from heroku

To test this I made a test page, which consists of

<h2>test</h2>
a test page

No layout, No CSS no anything else, no html or body tag, just an H2 tag and some text, thats the entirety of what is served.

So, right after i put the URL in the browser and hit enter. I see the heroku logs -t jump to life and I see the request being processed

2014-07-12T21:07:36.149964+00:00 heroku[router]: at=info method=GET path="/pages/test" host=myapp.herokuapp.com request_id=490be219-e72b-4df3-879b-9060b2b5140a fwd="my.ip.add.ress" dyno=web.1 connect=12 service=11 status=200 bytes=1049
2014-07-12T21:07:36.136011+00:00 app[web.1]: Started GET "/pages/test" for my.ip.add.ress at 2014-07-12 21:07:36 +0000
2014-07-12T21:07:36.141517+00:00 app[web.1]:   Rendered pages/test.html.erb (0.4ms)
2014-07-12T21:07:36.139697+00:00 app[web.1]: Processing by PagesController#test as HTML
2014-07-12T21:07:36.141690+00:00 app[web.1]: Completed 200 OK in 2ms (Views: 1.5ms | ActiveRecord: 0.0ms)

All, good so far, everything processed and ready in 2ms. But the page does not load entirely. I can see the text on the screen already. But the browsers "waiting" spinner is still going.

5.32s (onload: 1m 5s)

Finally it loads. 1 minute later. It does this with all pages. Which really affects AJAX since the redraws wont happen until the pages is fully loaded.

What is going on and how do I stop it? Thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I found information on Twitter.

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 :)

EDIT:

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...