Why are my basic Heroku apps taking two seconds to load?

后端 未结 5 1262
耶瑟儿~
耶瑟儿~ 2020-11-30 17:50

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
5条回答
  •  攒了一身酷
    2020-11-30 18:35

    You should check out Tom Robinson's answer to "Scalability: How Does Heroku Work?" on Quora: http://www.quora.com/Scalability/How-does-Heroku-work

    Heroku divides up server resources among many different customers/applications. Your app is allotted blocks of computing power. Heroku partitions based on resource demand. When you have a popular application that demands more power, you can pay for more 'dynos' (application containers) and then get a larger chunk of the pie in return.

    In your case though, you are running a free app that few people--if any outside of you--are visiting/using. Therefore, Heroku cuts down on the resources you're getting by unloading your app--putting it in hibernation essentially--until there is a request made to your address. When that happens, and your app has been idling for a long time, it takes time to reload.

    Add 1 extra dyno to keep your app from falling asleep, if that reload time is important.

提交回复
热议问题