Blocking code in a non-blocking http server

For example, I have an http server, which is node.js, so it does not block.

For each request, a database operation will be performed.

what I can’t understand is what is the difference between a blocking DB operation and a non-blocking DB operation?

Since the web server is not blocked, so the DB lock operation inside the query does not matter?

+2
source share
2 answers

Here is an analogy that can help you understand. Suppose you are selling, and today you have 50 phone calls.

, , , , , , . , , , , , . , , , , - , , , .

, , , , . . , , - , , , , . , - . , , , - , , .

node.js - . , , , .

, node.js, , , , - node.js . , , , , , . node.js, node.js .

node.js HTTP-. , . , , , . node.js HTTP- (, HTTP-). , , , . nodejs , . , , , - .

+2

, . nodejs, , , , , nodejs DB , , HTTP , .

: , , .

+4

Source: https://habr.com/ru/post/1610344/


All Articles