I used Node.js for some time, and I just realized that it could be a lock. I just can't wrap my brain around the conditions under which Node.js becomes blocking.
Thus, I / O tasks are not blocked due to asynchronous callbacks, but one thread can be blocked because it is synchronous and because the event loop can be stuck because many complex requests appear at the same time?
.
-, : node.js . Node libuv, , (, - ), - (, zlib). , crypto ( ) / ( crypto.randomBytes()).
crypto
crypto.randomBytes()
v8 , , , ..
Node .
, :
, javascript- , Node. , Node - (I/O) concurrency, () parallelism. Node , cluster, , / , Node - - / ..
cluster
, , , Node.
Node , , - -, - , .
script (, pi /), , , Node (, ffmpeg , javascript ++ Node Node). , (, HTTP-). , Node , I/O concurrency . script, , / js css script, .
ffmpeg
, script TCP HTTP-, , , , Node , , , , /HTTP- () , .
JSON - . , JavaScript. json 20 , CSV (), 20 . - , , / - , "JSON.stringify()".
, - , JSON.stringify, , . .
, JSON 1) . 5 . 5 , . , .
Node , , , Google. , - , Node.js .
, .
Node.js , , - . javascript. , I/O .
Node.js ...... , ."", , . -/ , : c.query( 'SELECT SLEEP(20);', .... - "sleep" , - - ( )
Node.js ...... , .
"", , . -
/ , : c.query( 'SELECT SLEEP(20);', .... - "sleep" , - - ( )
c.query( 'SELECT SLEEP(20);', ....
, Node " ".
- ", ". , / , Node.js . / Node.js. , . ( )
, I/O , Node - , -.
, Node .
, , -, Event Loop Event Loop, , . ( )
( , )
( "" ), , . , - , JavaScript , . () ( )
, , , , , .
, . , , 1 , 10000 , . Node, . , , , , .
, . , Node , , . ,
Node , champ, , , .
Node , , . I/O , , , . 5 , .
, , Amazon
... , S3 ( )
( "" ), , . , - , JavaScript , . () ..... - - , . 1 , , , , (, ).
I do not know if I understood this correctly. Please feel free to point out my mistakes and help me get it right.
thank