在Heroku dyno上运行多个进程是否可行? [英] Is it feasible to run multiple processeses on a Heroku dyno?

查看:111
本文介绍了在Heroku dyno上运行多个进程是否可行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道Heroku平台的内存限制,并且我知道将应用程序分为web和worker dynos的可扩展性要高得多。但是,我仍然希望与Web进程一起运行异步任务以进行测试。 Dynos代价高昂,我想在Heroku提供的免费实例上创建原型。

在同一个测试版中是否有任何产生新工作作为进程或子进程的问题作为一个web进程?

解决方案

在更新的Cedar堆栈中,产生多个进程没有问题。每个dyno都是一台虚拟机,除了内存和CPU使用率(我认为大约有512 MB内存,以及1个CPU内核)之外,没有特别的限制。遵循针对某些堆栈(例如Python)的较新安装说明将导致配置中包含多个(Web服务器)进程。



安装在Web dynos上的软件可能会有所不同取决于你使用的是什么buildpack;如果你的子过程需要特殊的软件,那么你可能必须将它与你的应用程序捆绑在一起,或者(更好地)推出你自己的buildpack。



在这一点上,我通常会提醒你强烈建议在工作dynos而不是web dynos上运行异步任务,并且使用适当的任务队列系统,但听起来您已经知道了。请记住,只有一个网络动态账户(通常这意味着免费账户)的账户会在没有收到任何网络请求一个小时左右后停止,并且在该动态网站上运行的任何后台进程时间必然会被杀死。具有多个网页打印机的帐户不受此限制。


I am aware of the memory limitations of the Heroku platform, and I know that it is far more scalable to separate an app into web and worker dynos. However, I still would like to run asynchronous tasks alongside the web process for testing purposes. Dynos are costly and I would like to prototype on the free instance that Heroku provides.

Are there any issues with spawning a new job as a process or subprocess in the same dyno as a web process?

解决方案

On the newer Cedar stack, there are no issues with spawning multiple processes. Each dyno is a virtual machine and has no particular limitations except in memory and CPU usage (about 512 MB of memory, I think, and 1 CPU core). Following the newer installation instructions for some stacks such as Python will result in a configuration with multiple (web server) processes out of the box.

Software installed on web dynos may vary depending on what buildpack you are using; if your subprocesses need special software then you may have to either bundle it with your application or (better) roll your own buildpack.

At this point I would normally remind you that running asynchronous tasks on worker dynos instead of web dynos, with a proper task queue system, is strongly encouraged, but it sounds like you know that already. Do keep in mind that accounts with only one web dyno (typically this means, "free" accounts) will have that dyno spun down after an hour or so of not receiving any web requests, and that any background processes running on the dyno at that time will necessarily be killed. Accounts with multiple web dynos are not subject to this restriction.

这篇关于在Heroku dyno上运行多个进程是否可行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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