I have a question for somebody with experience in using PHP for background jobs. I have a software (PHP) that people use to translate articles. There can be (sometimes) 50 article submissions in 5 seconds. I have a cron running every 5 seconds checking to see if there are translations in the mysql database, and if they are, it takes 15 at a time, and translates (curl get calling a translate script) them 1 by 1 in a for.
It's pretty slow, and I want some kind of multi threading. I cannot (and don't think it's necessary) to use pthreads. I was thinking if maybe I should make the cron job run every second
OR
Making 1 cron job run every 5 seconds, but from the cron job, start 10 different processes with exec, that each will take a translation. IS that wise? What do you recommend?
And if my idea is good (of spawning processes using exec), how can I spawn a process and not wait for it to finish (so simply start 15 processes and let them do it's job, in the background)?
I tried: exec('php index.php smallCron > /dev/null &');
But it does not work.
IF I replace /dev/null with a filename (let's say aaa.txt) then the script gets called, but "exec" hangs and waits for it to finish. IF I leave /dev/null there, nothing happens, the index.php is never called.
Thank you!