为什么我的基本Heroku应用程序需要两秒钟才能加载? [英] Why are my basic Heroku apps taking two seconds to load?
问题描述
我创建了两个非常简单的Heroku应用程序来测试该服务,但是当我第一次访问它时,通常需要几秒钟来加载页面: 我所做的只是创建一个简单的Sinatra应用程序并部署它。我没有做任何事情来搞乱或测试Heroku服务器。我能做些什么来缩短响应时间?现在速度很慢,我不确定从哪里开始。如果有帮助的话,这些项目的代码在github上。 如果您的应用程序未被使用一会儿它被卸载(从服务器内存中)。
ul>
这样做是为了节省服务器资源。如果没有人使用您的应用程序为什么要保持资源的繁忙,而不是让真正需要的人使用它们?
如果您的应用程序有很多持续的流量,它将永远不会被卸载。
有关官方说明。 / 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:
- Cropify - Basic Sinatra App (on github)
- Textile2HTML - Even more basic Sinatra App (on github)
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屋!