2

Let's start with saying that I am new to Web development.

I am working on a project which I chose Node.js as my server runtime environment.

From what I understand Node.js is single threaded event-based . So for dealing with many small tasks it is great, but dealing intensive tasks might cause some blocking.

How should I implement intensive tasks handlers which will work without blocking the server?

I thought about implementing another application on the server which will deal the intensive tasks whenever my node.js application asks for. (This can be implemented even in PHP or ASP or Other instance of Node.js), Is this reasonable?

1 Answer 1

1

Child_process

It allows you to create proccess instances.

More information can be found on the node.js documentation:

Sign up to request clarification or add additional context in comments.

6 Comments

So this is basically a way of creating "Threads" in Node.js? So whenever I want to create an intensive task I will create a child process.
+Matan You should try not to create intensive tasks (while / for loops). Instead you should use recursive loops with help of proccess.nextTick(). Otherwise, yes, child proccess is the way to go.
Are you sure? While / For loops in a normal programming world are always more efficient then recursive loops, if it's an iteration.
+Matan But they're non-blocking.
But it's ok, for each intensive task I will use a child process which will work in the background without effecting the server dramatically.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.