...

/

Introduction to Distributed Messaging Queue [backup]

Introduction to Distributed Messaging Queue [backup]

Understand the functional and non-functional requirements of a distributed messaging queue.

What is a messaging queue?

Messaging queue is an intermediate component between the interacting entities known as producers and consumers. The producer produces messages and places them in the queue, while the consumer’s task is to retrieve the messages from the queue and process them. There might be multiple producers and consumers interacting with the queue at a time.

Following is an illustration of two applications interacting via a single messaging queue.

Motivation

A messaging queue has several advantages and use-cases discussed below.

  • Improved performance: Messaging queue enables asynchronous communication between interacting entities (producers and consumers) and eliminates their relative speed difference. A producer puts messages in the queue without waiting for the consumers; similarly, a consumer processes the messages when they become available. Moreover, queues are often used to separate out slower operations from the critical path and hence help reduce client-perceived latency. For example, instead of waiting for a specific task that is taking a long time to complete, the producer process sends a message (which is kept in a queue if there are multiple requests) for the required task and continues its operations. The consumer can inform about the fate of the processing (success or failure) by using another queue.

  • Better reliability: The separation of interacting entities via messaging queue makes the system more fault-tolerant. For example, either a producer or consumer can fail independently (without affecting the others) and restart later. Moreover, replicating the ...

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy