开发者

PHP - Running exec multiple php files

开发者 https://www.devze.com 2023-02-03 18:44 出处:网络
I\'m running a curl script that does data mining; for it to run through all date it takes approx 600 seconds.So I figured, If I split the load with two or three or etc... threads, I could then split t

I'm running a curl script that does data mining; for it to run through all date it takes approx 600 seconds. So I figured, If I split the load with two or three or etc... threads, I could then split that 600 seconds.

Any suggestions?

I know one way to do this is via windows scheduler, I can have it execut开发者_运维百科e multiple files; but ideally I'd like to have windows scheduler execute (i.e. php-cgi thefilename.php) one single file and have that one exec multiple others.

Any suggestions? THanks,


If you're stuck on windows, i.e. you don't have the pcntl extension, what I would recommend is to use curl_multi_* to execute multiple requests asynchronously. This is a good way to get more performance if your bottleneck is the server delays.


Not really answering your question but a solution nevertheless. You could create a batch file like this:

start php-cgi thefilename.php
start php-cgi thefilename.php
start php-cgi thefilename.php

This will create three independent threads.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号