PHP - activating multiple process instances

I am building a system that monitors the queue and activates a set of tasks on a regular interval.

I am interested in starting multiple instances of my processing of "bots" depending on the number of items in the queue. So, if there are 5 items, I launched two bots, and if there are 10, I will launch four.

I know how to run multiple instances from the CLI (manually), but how do I do this as a function of my application? And how would I correctly track the creation and destruction of these bots?

+3
source share
2 answers

It seems that cron (* nix) or task scheduler (windows) will be needed. http://en.wikipedia.org/wiki/Cron http://msdn.microsoft.com/en-us/library/aa383614%28VS.85%29.aspx

They can run a PHP script that determines how many "bots" need to be performed, calculations, etc. Everything PHP is capable of.

In addition, to run several bots in the background (after the main script controller is completed), you can look at the PHP formatting process.

+2
source

You might also want to look at gearman ( http://gearman.org/ )

+1
source

Source: https://habr.com/ru/post/1732059/


All Articles