We have end-user API to perform some long (30s-1h) CPU-bound operation. User can create task, poll task status many times and finally get result.
Internally we have queue for tasks and some workers who can handle those tasks.
Problem occurs when User1 create a lot of large tasks, and right after that User2 create one small task. User2 is expecting to get result quickly, but all workers are handling tasks from User1. Task from User1 is at the end of queue.
Expectation is handling tasks from both users in round-robin manner.
Is there some production-ready solution for solve such kind of problem?
(UPDATE) Found the same question: What are some queuing mechanisms for implementing round-robin queues?