V
V
Valentine2015-12-24 11:06:34
Asterisk
Valentine, 2015-12-24 11:06:34

Nodejs - and yet how is the problem with multithreading solved?

I’ll make a reservation right away, I didn’t work with NodeJS at all.
As an example: the task is to organize a telephony service on asterisk (work via AGI).
Outgoing and incoming calls.
I still have a strong understanding of the principles of building applications using NodeJS. I read several articles, words about blocking operations, single-threading settled in my head.
As I understand it, you should not work with relational databases on NodeJS at all.
Question: Can NodeJS process multiple calls in parallel?
A more general question is whether or not to use NodeJS if you need to handle long running operations. How long can they be?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Anton Zhukov, 2015-12-24
@Tpona

Multithreading is solved like this - a cluster of several Node.js containers is raised, and a balancer is placed in front of it.
Almost everything is coded on asynchronous functions without
database locks, you can connect almost any. Asynchronous libs are written for them without blocking
NodeJS can do everything (and what it can’t can be done through external programs)
Duration of operations any

A
Alexander Litvinenko, 2015-12-24
@edli007

You have read heavily outdated articles (very much so)
https://nodejs.org/api/cluster.html

A
Alexander Leonovich, 2015-12-24
@atlantech

The node copes well with network / file operations, is sharpened to maintain a large number of connections and gets along well with relationals. Just make sure when developing that your code doesn't block the main thread. Don't try to take a "synchronous" approach like php. NodeJS is a callback-oriented architecture, so to speak.

D
Dmitry Chervonobab, 2015-12-24
@maddimons

Look towards FastAGI + Twisted. Fast unload your power, and Twisted will solve the problem of blocking.
Why are you looking at Nodejs?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question