可以绕过Heroku的免费计划的“闲置30分钟后进入睡眠状态".与console.logs? [英] Possible to bypass Heroku's free plan's "Sleeps after 30 mins of inactivity" with console.logs?

查看:2132
本文介绍了可以绕过Heroku的免费计划的“闲置30分钟后进入睡眠状态".与console.logs?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Heroku的免费计划如下所示: https://www.heroku.com/pricing

Heroku has a free plan, as outlined here: https://www.heroku.com/pricing

免费计划的缺点之一是服务器在闲置30分钟后进入睡眠状态.如果我每20分钟有一次console.log("stay awake");发生,是否可以绕过此操作?

One of the drawbacks of the free plan is that the server goes to sleep after 30 minutes of inactivity. Is it possible to bypass this if I have a console.log("stay awake"); occur every 20 minutes?

谢谢.

推荐答案

无法绕过该限制-从某种意义上说,您的所有服务都可能在月底之前关闭30分钟以上如果您一直都这样做-但您可以保持流程正常运行,例如定期访问某个端点,但您很快就会用完这种空闲时间:

It is not possible to bypass that limit - in a sense that all your services will likely get shut down before the end of the month for much longer than 30 minutes if you do that all the time - but you can keep your process alive e.g. by hitting some endpoint periodically but you will quickly exhaust your free hours that way:

经过验证的帐户每月可免费使用1000 dyno小时;未验证的帐户将收到550.只要您的月度池中还剩下dyno小时,您的免费应用程序就可以运行.

Verified accounts come with a monthly pool of 1000 Free dyno hours; unverified accounts receive 550. When a Free dyno is active, it draws from the pool; your free apps can run as long as there are dyno hours left in your monthly pool.

如果您需要确保API在短时间内(例如在演示或演示过程中)能够响应,这可能会很有用.

It may be useful if you need to make sure that you API is responsive for short periods of time like during a demo or a presentation.

无论您做什么,都要确保它不违反TOC.如有疑问,请咨询客户服务.他们非常有帮助.

Whatever you do make sure that it is not against the TOC. When in doubt ask the customer service. They are very helpful.

如果您想要不间断的服务,但是Heroku太贵了,那么您应该使用Digital Ocean或Vultr等VPS.它们便宜得多,可以24/7全天候工作,并且您可以免费使用促销链接几个月(数字海洋 Vultr ),但是缺点是您必须自己动手做更多的事情,例如安装Node,部署应用程序,保持操作系统,Node和所有服务的正确更新和配置等.这并非难事,但您需要知道自己在做什么,没有人会为您修复系统.要了解如何在VPS上安装Node,请参见:

If you want an uninterrupted service but Heroku is too expensive then you should probably use a VPS like Digital Ocean or Vultr. They are much cheaper, work 24/7 and you can have few months for free with promo links (Digital Ocean, Vultr) but the drawback is that you will have to make more things yourself - like install Node, deploy the application, keep the OS, Node and all services updated and configured properly etc. It's not that hard to do but you need to know what you're doing and no one will fix your system for you. To see how to install Node on a VPS see:

  • NodeJS API with external deps in other language
  • Run npm as superuser, it isn't a good idea?
  • NPM and NODE command not found when using NVM
  • How to host website in NodeJS and MongoDB? And what will be the cost?
  • Simple node.js app deployment on DigitalOcean from GitHub
  • Install Node.js with downloaded binary on Ubuntu Desktop.. Where do the files go?

这篇关于可以绕过Heroku的免费计划的“闲置30分钟后进入睡眠状态".与console.logs?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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