Decide which queue to put work into by trying to get the work done quickly. If you fail at the quick solution, give up and then start over with a longer time limit.
Incoming tasks enter a queue on a system. Tasks get a finite amount of time to execute. If they succeed, yay! You have completed some work. If the task fails to complete in that time, you delete it and requeue it to the next system.
“Task Assignment with Unknown Duration”, Mor Harchol-Balter, CMU-CS-99-162, August 1999.