(1) Contrast: blocking and non-blocking, synchronous and asynchronous

Blocking and non-blocking

Blocking: A invokes program B, A wait for its return, the waiting thread A is occupied, without further action.

Non-blocking: A program calls program B, A thread is not occupied.

Blocking - "non-blocking most common solution: buffer , A buffer was charged sequentially requests, A and B regardless of whether the execution is completed, and then sequentially processed by B, returns to A.

 

Synchronous and asynchronous

Sync: A thread in order to perform all tasks

Asynchronous: multiple threads execute in parallel tasks

Synchronization - "Asynchronous most common solution: multi-threading , turn starts multiple threads to perform tasks, while the introduction of the thread pool, the thread continues to reduce distribution costs and destruction caused.

 

 

Many people have heard the message queue, messaging middleware MQ, ESB enterprise service bus and so on.

Is simply an Enterprise Service Bus ESB is to take up a pipeline, all instructions can be thrown to the request, along the pipeline flows to the destination. Message Queue MQ technology is used, such as RabbitMQ, ActiveMQ, Kafka like.

In the soft test architect of the time, the case study before I had a problem to talk about the advantages of the ESB, the SOA comparison. In the paper I have been elaborated to use the ESB, technical framework is RabbitMQ.

I remember, I say the answer is " asynchronous call ," a few months later I realized it was wrong, should be " non-blocking ", because there is no relationship and multi-threading, but the end of the call. " do not wait, non-blocking ", just to throw a message bus which do not have control, to achieve high availability and eventual consistency, CAP in the AP.

Case Studies exam result is checked five points, did not pass the exam.

 

The above message queue, distributed, like the CAP subsequent talk.

 

Guess you like

Origin www.cnblogs.com/hongwei918/p/11305669.html