Answer the question
In order to leave comments, you need to log in
What is the best way to organize work with worker servers so that they themselves take work from the pool or the master server gives them work?
There is a server pool of 15-20 servers, one of them is dedicated to the front, the rest are for hard work .
by hard work I mean long tasks that use almost all the power of the processor and RAM, tasks can be run in parallel on the same server i.e. 4-8 tasks can work simultaneously, the number depends on the load overage of the server.
So, the task pool is stored on the front server that accepts requests from users. How best to organize the distribution of tasks between servers, I still see 2 options and I can’t decide which one is better: (further on, the master server is the front server)
Answer the question
In order to leave comments, you need to log in
The downside of the first approach is that collisions can occur and 2 servers can take over the task at the same time and will do double work
yes, in general it is the same. Organize a task lock while someone picks it up - and pull will work correctly. If you don't want to, push.
or something in between - the worker periodically says "I'm ready to take the next", the master shoves the task at him.
And the master does not hammer the worker with requests "how are you?" and the worker will not receive an already running task.
those. the queue is managed by the master, the status report is created by the worker
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question