为什么我的基本 Heroku 应用程序需要两秒钟才能加载? [英] Why are my basic Heroku apps taking two seconds to load?
问题描述
我创建了两个非常简单的 Heroku 应用程序来测试该服务,但是当我第一次访问它们时通常需要几秒钟来加载页面:
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 - 基本的 Sinatra 应用程序 (在 github 上)
- Textile2HTML - 更基本的 Sinatra 应用程序 (在github上)
- Cropify - Basic Sinatra App (on github)
- Textile2HTML - Even more basic Sinatra App (on github)
我所做的只是创建一个简单的 Sinatra 应用程序并进行部署.我没有做过任何干扰或测试 Heroku 服务器的事情.我可以做些什么来改善响应时间?现在很慢,我不知道从哪里开始.如果有帮助,项目代码在 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.
推荐答案
- 如果您的应用程序有一段时间未使用,它会被卸载(从服务器内存中).
- 在第一次点击时,它被加载并保持加载状态,直到一段时间没有人访问它.
这样做是为了节省服务器资源.如果没有人使用你的应用,为什么要让资源忙碌而不让真正需要它们的人使用它们?
如果您的应用有大量持续的流量,它将永远不会被卸载.
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.
有关于此的官方说明.
这篇关于为什么我的基本 Heroku 应用程序需要两秒钟才能加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!