I have a scenario in PHP, i need a smart way:
1. I run one process on background forever, scheduler.php - done
2. User on the web submit their task in DB to be processed by the above process(scheduler.php) - done
3. scheduler.php read the db after every 1 sec, looking for user's task.
Problem:
Ideally, if it founds like 10 or more tasks it should process them concurently(in parallel)..i.e it should not wait one task to be fully executed so as to run the next one as one task might take a very long time to be fullu executed.
I would do like exec("nohup php <path>/file_name.php >> /dev/null 2>&1 &"), but if i have alot of tasks this will create zombie processes.
Any smart way to do this will be highly appreciated!