Answer the question
In order to leave comments, you need to log in
How to notify a large number of clients about events?
Hello.
I have about 500 clients [application on go] (their number is growing very quickly, in a week it will already be 1000, and according to analytics forecasts in six months > 50,000). For each of them, an action is created from the outside by the user, or the client itself does something without the knowledge of the user and passes the result to the queue server, and the worker gives the result to the end user. The problem is at the stage of efficient transfer of the task from the worker to the client. . At the moment, all workers are connected via TCP to clients. And when a worker sees a job in the queue server, it sends the job to the client.
The frequency of events is from once per second to complete stagnation within a month. That is absolutely unpredictable and independent.
Question:how to notify so many clients about new events?
What options are there?
1. TCP in ACCEPT mode, like in Push notifications? How to balance the load there?
2. Use Redis as storage and give access to all clients initially? (too many resources are required and not all clients need to have access to all tasks)
3. Create an own sqlite file with tasks for each client. Allow worker to write jobs inside? connect the client periodically once a second - check if a new task has appeared? (some kind of Mesozoic era, but this is the leader No. 1 for the first time until complete kapets)
4. Procreate worker. Roughly speaking, 1000 clients should be assigned to each worker, and let him be responsible for this thousand? (this is leader #2)
5..?
Which one would you choose and why?
Answer the question
In order to leave comments, you need to log in
4 - start the worker to check tasks, when a new / new one appears, this worker starts itself with a specific task (if there are a lot of tasks, it starts several workers with several tasks at once) - waits. then repeats the process again.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question