Heroku上的网页加载速度较慢 [英] Slow Page load on heroku

查看:384
本文介绍了Heroku上的网页加载速度较慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在heroku上有一个rails 4应用程序。我相对比较新。



我加载的每个页面或执行的ajax都需要1分钟。总是不管什么时候。



我认为这与ajax调用有关,因为我可以直观地看到DOM何时加载完全更好,但它确实是任何页面,我从heroku抓取



为了测试这个,我制作了一个测试页面,其中包含

 < H2>试验< / H2> 
a测试页

没有布局,没有CSS没有别的东西 ,没有html或body标签,只有一个H2标签和一些文本,就是所有服务的完整内容。

所以,在我将URL放入浏览器之后,点击进入。我看到了heroku日志-t跳转到了生活,并且看到了正在处理的请求。

  2014-07-12T21:07:36.149964 +00:00 heroku [router]:at = info method = GET path =/ pages / testhost = myapp.herokuapp.com request_id = 490be219-e72b-4df3-879b-9060b2b5140a fwd =my.ip.add。 ressdyno = 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 2014-07-12 21:07:36 +0000
2014-07-12T21:07:36.141517 + 00:00 app [web.1]:渲染页面/测试.html.erb(0.4ms)
2014-07-12T21:07:36.139697 + 00:00 app [web.1]:通过PagesController处理#test as HTML
2014-07-12T21:07 :36.141690 + 00:00 app [web.1]:在2ms内完成200 OK(查看:1.5ms | ActiveRecord:0.0ms)

到目前为止,所有的处理都已经完成,并且准备时间为2ms。但该页面并未完全加载。我可以在屏幕上看到文字。但是浏览器的等待微调仍在继续。

lockquote
5.32s(onload:1m 5s)
/ blockquote>

最后加载。 1分钟后。它对所有页面都这样做。这真的会影响到AJAX,因为重绘不会发生,直到页面完全加载。



发生了什么,我该如何阻止它?谢谢

解决方案

我在Twitter上找到了相关信息。与websockets有关。禁用它似乎可以解决问题。

  heroku labs:禁用websockets -a myapp -p制作

这使得它可以像以前一样工作,但日志现在看起来不同:)

编辑



Heroku显示这是一个解决问题,但回答适用以防再次发生。



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


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

解决方案

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

这篇关于Heroku上的网页加载速度较慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆