$ php worker.php &
$ php worker.php &
$ php worker.php &
$ php worker.php &
$ php worker.php &
$ php client.php
-
-
Save cloneko/67f4faadc57a2940728e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$client = new GearmanClient(); | |
$client->addServer(); | |
// Data Generator | |
$queue = []; | |
for($i = 0;$i < 100000;$i++){ | |
$client->doBackground("send",$i) . "\n"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$worker = new GearmanWorker(); | |
$worker->addSErver(); | |
$worker->addFunction('send','send_function'); | |
while ($worker->work()); | |
function send_function($job){ | |
sleep(1); | |
echo $job->workload(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment