Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it feasible to run multiple processeses on a Heroku dyno?

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?

like image 279
okw Avatar asked Jul 01 '12 04:07

okw


People also ask

How many requests can a Heroku Dyno handle?

Heroku Routers limit the number of active requests per dyno to 50. There is no coordination between routers, however, so this request limit is per router.

How many API requests can Heroku handle?

Users are limited to a rolling window of 75 requests to Heroku Git repos per hour, per app, per user.

How many requests per second can Heroku handle?

These may be conducted without any need for approval from Heroku, so long as they're limited to 10,000 requests/second for any given application. This applies to all regions for the Common Runtime.

How do I get unlimited Dyno in Heroku?

In addition to these base hours, accounts which verify with a credit card will receive an additional 450 hours added to the monthly free dyno quota. This means you can receive a total of 1000 free dyno hours per month, if you verify your account with a credit card. Used free dyno hours are non-transferable.


1 Answers

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.

like image 181
Andrew Gorcester Avatar answered Oct 14 '22 08:10

Andrew Gorcester