Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your understanding of exec is roughly correct, my concern is that you are using it when you do not need to do so... In your question you only mention I/O types of oeprations, which node handles very efficiently within it's single threaded event model of doing things. Despite being single threaded, the event model allows code to run without blocking the main event loop(unless you're doing VERY CPU intensive operations..., of which Database requests, and file processing are not included) That being said, you should not need to launch an additional dyno to do what you want.</p> <p>Think of a dyno as a single processor computer. Whatever you can do on a machine that has a single processor you can do on your dyno, with no extra charges or created dynos. Though, a dyno does have considerably less memory than a single core processor computer could take advantage of. So, any subprocesses you wish to spawn do not need another dyno to run on. Every master process you wish to run, will need its own dyno.</p> <pre><code>var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('An amount of data that will take 1 second to send');//This will not block the event loop }).listen(1337, '127.0.0.1'); var http = require('http'); http.createServer(function (req, res) { while(true) { break after 1 second; //this will block the event loop for 1 second } res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World\n'); }).listen(1337, '127.0.0.1'); </code></pre> <p>Consider the two servers in the code above. Both servers have roughly one second of work to do. The first example can service thousands of requests per second, the second example only 1. Sending data, database requests, server requests, file IO, etc... all would behave as the first example... very few things in Node behave like the second example. If you have something that fits under the second example, you are likely better off picking a different language, than trying to force node to work for a use case it is very poorly designed for.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload