Parallel processing in PHP - How do you do it?

后端 未结 8 2159
礼貌的吻别
礼貌的吻别 2020-12-01 00:00

I am currently trying to implement a job queue in php. The queue will then be processed as a batch job and should be able to process some jobs in parallel.

I already

8条回答
  •  臣服心动
    2020-12-01 00:34

    I use PHP's pnctl - it is good as long as you know what you do. I understand you situation but I don't think it's something difficult to understand our code, we just have to be little more conscious than ever when implementing JOB queue or Parallel process.

    I feel as long as you code it perfectly and make sure the flow is perfect off-course you should keep PARALLEL PROCESS in mind when you implement.

    Where you could do mistakes:

    1. Loops - should be able to handle by GLOBAL vars.
    2. Processing some set of transactions - again as long as you define the sets proper, you should be able to get it done.

    Take a look at this example - https://github.com/rakesh-sankar/Tools/blob/master/PHP/fork-parallel-process.php.

    Hope it helps.

提交回复
热议问题