Difference between a blocking language and a non-blocking language


In practice, what is the difference between a blocking language and a non-blocking language?

What differences can we see on both the front end and the backend?

Using an example, let's imagine an endpoint of an API where something is written to a database and a response is returned to the client.

If multiple requests are made at the same time for this endpoint, in practice how would a system with a blocking and a non-blocking architecture behave?

asked by anonymous 11.04.2016 / 00:03

1 answer



In a blocking system the requisitions would be queued and after that would be processed one by one, that way it would not be possible to process several of them at the same time. In other words, the client that has the newest request will only have its request processed after the older requests have been processed in full.

And in non-blockers we will have to request that the newest client be processed (or at least a part of it) before all requests that the server received before it are processed.


Assuming that the example is a PetShop system, and that the request is intended to add an Animal belonging to a Owner to the Database and add that Owner if it is not in the Database.


The Client who sent the oldest request will only have the Animal and Owner in the Database after all other requests have already been processed. In the worst case we will have an I / O operation that takes hours, so the newest client will not have your response to your request any time soon.


The Client that sent the oldest request may have at least the Animal registered in the Database even though it still has older requests being processed. In this case, even if I / O is delayed, the system will still respond to other requests.

11.04.2016 / 03:26