gorush icon indicating copy to clipboard operation
gorush copied to clipboard

Question: What is a recommended way of keeping the push queue under optimal load?

Open serg472 opened this issue 9 years ago • 3 comments

Can you please describe what would be a reliable way of sending millions of notifications, so I never exceed any internal queue limits or server resources. Am I supposed to monitor api/stat/app and make sure to not add any new pushes if queue_usage is near queue_usage?

I tried setting config queue_num=1 and worker_num=1 and still send 1000 notifications in a loop (I even added 1 sec sleep inside PushToIOS()) while queue_usage was full. How to make sure that I keep some healthy amount of pushes in a queue without it starting throwing errors that queue is exhausted or overloading the server?

Thanks.

serg472 avatar Oct 26 '16 00:10 serg472

My plan is to manage the queue in a separate system, and then I can control and diagnose each send. Use something like kafka or other system to queue up the required messages and then send the messages N at a time where N is the maximum possible concurrent load of the gorush server.

mikepc avatar Feb 10 '17 05:02 mikepc

@mikepc Sure, but how to figure out "maximum possible concurrent load of the gorush server" part, that's the question. There should be some queue management on gorush side with certain amount of parallel workers. Kafka would be just sending you 100k/sec messages, you can't just spawn new goroutine for every message as it will kill the server, and you can't process them without parallel workers as it will take forever. You need to maintain some queue and go through it with fixed number of workers to manage the load. So the question is, how to organize this internal queue in the most optimal way.

serg472 avatar Feb 11 '17 00:02 serg472