Forked from juriansluiman/benchmark-beanstalkd.pull.php
Last active
August 29, 2015 14:15
-
-
Save koryonik/53222fad34358dd2e8b5 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 | |
include 'vendor/autoload.php'; | |
$pheanstalk = new Pheanstalk_Pheanstalk('127.0.0.1'); | |
$pheanstalk->useTube('default'); | |
$n = 1000000; | |
$start = microtime(true); | |
for ($i = 0; $i <= $n; $i++) { | |
$job = $pheanstalk->reserve(); | |
} | |
$end = microtime(true); | |
$time = ($end - $start); | |
$ops = $n / $time; | |
echo sprintf("%d operations in %.2f seconds\n", $n, $time); | |
echo sprintf("Meaning %d ops per second\n", $ops); |
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 | |
include 'vendor/autoload.php'; | |
$pheanstalk = new Pheanstalk_Pheanstalk('127.0.0.1'); | |
$pheanstalk->useTube('default'); | |
$n = 1000000; | |
$start = microtime(true); | |
for ($i = 0; $i <= $n; $i++) { | |
$pheanstalk->put('Foo Bar Baz'); | |
} | |
$end = microtime(true); | |
$time = ($end - $start); | |
$ops = $n / $time; | |
echo sprintf("%d operations in %.2f seconds\n", $n, $time); | |
echo sprintf("Meaning %d ops per second\n", $ops); |
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 | |
include 'vendor/autoload.php'; | |
$worker = new GearmanWorker; | |
$worker->addServer(); | |
$worker->addFunction('test', function($job) {}); | |
$n = 1000000; | |
$start = microtime(true); | |
for ($i=0; $i <= $n; $i++) { | |
$worker->work(); | |
} | |
$end = microtime(true); | |
$time = ($end - $start); | |
$ops = $n / $time; | |
echo sprintf("%d operations in %.2f seconds\n", $n, $time); | |
echo sprintf("Meaning %d ops per second\n", $ops); |
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 | |
include 'vendor/autoload.php'; | |
$client = new GearmanClient; | |
$client->addServer(); | |
$n = 1000000; | |
$start = microtime(true); | |
for ($i = 0; $i <= $n; $i++) { | |
$client->doBackground('test', 'This is a test'); | |
} | |
$end = microtime(true); | |
$time = ($end - $start); | |
$ops = $n / $time; | |
echo sprintf("%d operations in %.2f seconds\n", $n, $time); | |
echo sprintf("Meaning %d ops per second\n", $ops); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment