Situation: A company’s servers can be highly geographically distributed. For example, if the head office is in Moscow, the branches are in Novosibirsk and Vladivostok. And between these servers, you need to exchange messages – for example, send data from clients from a regional database to a common one.
What happens without queues? Due to the remoteness, there is always a risk that the message will not reach:
The communication channel will break.
The transmission will take too long.
Something will go wrong.
As a result, you can lose essential data. Or save them on the regional server but not update on the main one.
How Queues Can Help
Queuing systems are installed on all servers participating in the exchange of messages. When one server wants to send something, it does not send a request to another server but puts it in its private queue. And after that, it considers that the request has been sent. And already, the queue “knocks” to another server and sends a message until the sending is successful.
As a result, the server’s capacity is not occupied by constant sending and checking – it works in normal mode, believing that it has already sent a message. And the personal queue will hold the news until it is successfully sent and will not lose anything.
Sending Notifications To Clients
Situation. It happens that users or customers need to send notifications. For example:
An online store needs to send a message about the promotion not by mail, but in the application, in a push notification. Or notify the user that the order made yesterday is collected and sent to his city.
You have several branches, with different working hours for employees. A common task has appeared, and it needs to be sent out to everyone – but strictly during working hours.
What happens without queues? The default notification goes away immediately after the formation. But this is not always convenient: sometimes the building can occur at night or after hours. As a result, there is a risk that the user will miss the notification, or it will annoy him.
How queues can help
After being formed on the server, the message does not go anywhere but is placed in a queue. And it waits there until the user goes online, morning comes, or work hours begin.
For example, this is what the social network Odnoklassniki does. At 00:00 of the new day, they collect a database of everyone who has a birthday today. Then they select a list of best friends and put a birthday notification in the queue. But they send it only at the moment when the person has the maximum activity in the profile – so that he doesn’t miss anything same time is not distracted by the notification at another time.
Briefly About The Most Important: Why Do Companies Need Queues
- Handle user requests at peak times. Do not overload servers; avoid errors and failures.
- Reduce the risk of failures and data loss due to server failure or slowness.
- Handle essential but not urgent requests when the servers are least loaded.
- Create a reliable connection between servers in different branches. Do not lose data, even if the communication channel between branches is unstable.
- Send notifications to users not at the time of formation but at a convenient time.
Also Read: Wondering Where To Invest? Your Answers To These Questions Might Help!