Issues related to queues and multiple queues

Tram Ho

Hello everyone, today I will send you a new topic in the Laravel framwork. But the content today will be a little different, so long my shared articles are often a demo code 1 cool function for you to refer and follow. But today instead of coding, let’s talk about the nature of the problem, or how the function actually works. And today’s article will talk about “Issues related to queues and multiple queues”, let’s start to find out!

Explain the queue

Queue is a queue operation, used to process on different threads, can handle multiple queues at the same time depending on the server configuration that allows the number of threads running simultaneously. Each 1 queue is operated on 1 threads

  • When to use? When a task is not needed immediately, it can be used for later processing, such as sending email, etc. (a typical example of using queue).

How Queue works

Queue usually works under the stack mechanism, when there is a job to handle on the queue, the process will push the job into a container, be it redis, sqllite, sqs, database, … Service queue will listen to the events and always manipulate the container, when there is data in which the queue will pop data out and process logic

How to start the queue

Queue is a separate service that can be written in many different languages. The main task of the queue is to read the database and process the data in it, the data fetch is pop-up. The queue will always run continuously and when retrieving data in the container will create workers processing that data. Often used is supervisord

What is multiple queue?

Handling many different queue threads on one server

When there are many different jobs that you want to handle simultaneously, the nature of this job is to create multiple pipes that contain many jobs. Each service queue will read into each separate pipe in each pipeline can handle multiple queues simultaneously. Ex: Send msg for 100 people in group A and push notify for 100 people in group B, these are two different jobs unrelated to each other so you can use different queue threads.

  • The purpose of creating multiple pipes is to not interfere with the work of sending msg or push notify together.

Queue-related issues

  • Many people are confused about queues and cannot distinguish which queue to use on different processes
  • On the process, the object information in the code will be created as a completely new instance
  • Dangerous while using transactions
  • Setting retry when queue fails
  • The server is not strong enough, the queue configuration is not rational, leading to server overload …

Summary

So I just chatted about the problems of queuing and multiple queues, hope that with these theories can help you be more confident in the chat screen during the interview. 😃

Share the news now

Source : Viblo