Message Queue

  1. Why do we need Message Queue?
  2. What is Message Queue?
  3. How would you use Message Queue to reduce response time?
  4. Message queue services

Why do we need Message Queue?

Synchronous (Request Response Model)

Looking at the basic Request Response Architecture, the client app sends the request to the backend regardless of the Communication Protocol (TCP, gRPC, etc.). Backend accepts and executes the request. For example, import all employee information or update the booking system. These systems wait until the server finishes processing and the client app returns the requested information back to the user after processing. For example, small systems such as Validating a few fields and saving to a small database work very well. However, if the system gets bigger and clients send time-conferencing task requests instead of simple API and additional API requests, the client spends a long time responding to the request and the additional request is delayed according to the principle of initial response, which requires a solution.

So what’s coming out of it is Asynchronous (Publish Subscribe Model).

In this model we need Message Queue.

What is Message Queue?

The queue is just a line of things waiting to be published. And the message is the data posted by the publisher and the system is taken by the subscriber. Therefore, message queues can be called sequential data blocks.

How would you use Message Queue to reduce response time?

When the user sends a request to the Client App, the Client App posts the content in the message queue. And immediately send an ok response from the user. Also, the task that takes a long time to process the task is treated with Decouple to reduce the response time. In addition, the advantage is a network failure, etc., and the message is processed to re-handle some tasks when they are not completed.

  • Writing to store data in message queues is usually very fast. (BigO is 1)

Message queue services

RabbitMQ, ActiveMQ, Kafka

RabbitMQKafka, and ActiveMQ are all messaging technologies used to provide asynchronous communication and decouple processes (detaching the sender and receiver of a message).

Leave a Reply

Your email address will not be published.

ANOTE.DEV