为什么我的基本Heroku应用程序需要两秒钟才能加载? [英] Why are my basic Heroku apps taking two seconds to load?

查看:113
本文介绍了为什么我的基本Heroku应用程序需要两秒钟才能加载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了两个非常简单的Heroku应用程序来测试该服务,但是当我第一次访问它时,通常需要几秒钟来加载页面:


  • 裁剪 - 基本Sinatra应用程式( on github

  • Textile2HTML
  • a> - 更基本的Sinatra应用程序( on github
    ul>

    我所做的只是创建一个简单的Sinatra应用程序并部署它。我没有做任何事情来搞乱或测试Heroku服务器。我能做些什么来缩短响应时间?现在速度很慢,我不确定从哪里开始。如果有帮助的话,这些项目的代码在github上。 如果您的应用程序未被使用一会儿它被卸载(从服务器内存中)。

  • 在第一次点击时,它会被加载并保持加载状态,直到有一段时间没有任何人访问它。



这样做是为了节省服务器资源。如果没有人使用您的应用程序为什么要保持资源的繁忙,而不是让真正需要的人使用它们?

如果您的应用程序有很多持续的流量,它将永远不会被卸载。



有关官方说明。 / p>

I created two very simple Heroku apps to test out the service, but it's often taking several seconds to load the page when I first visit them:

All I did was create a simple Sinatra app and deploy it. I haven't done anything to mess with or test the Heroku servers. What can I do to improve response time? It's very slow right now and I'm not sure where to start. The code for the projects are on github if that helps.

解决方案

  • If your application is unused for a while it gets unloaded (from the server memory).
  • On the first hit it gets loaded and stays loaded until some time passes without anyone accessing it.

This is done to save server resources. If no one uses your app why keep resources busy and not let someone who really needs use them ?
If your app has a lot of continous traffic it will never be unloaded.

There is an official note about this.

这篇关于为什么我的基本Heroku应用程序需要两秒钟才能加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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