Created
October 26, 2012 00:19
-
-
Save FrancisVarga/3956279 to your computer and use it in GitHub Desktop.
Benchmark Couchbase-1723
This file contains hidden or 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 | |
/** | |
* Created by JetBrains PhpStorm. | |
* User: hippsterkiller | |
* Date: 10/26/12 | |
* Time: 1:38 AM | |
* To change this template use File | Settings | File Templates. | |
*/ | |
require __DIR__ . "/../src/Processus/Interfaces/NoSQLInterface.php"; | |
require __DIR__ . "/../src/Processus/Memcached/Client.php"; | |
require __DIR__ . "/../src/Processus/Memcached/ClientJson.php"; | |
require __DIR__ . "/../src/Processus/Couchbase/Client.php"; | |
$startTotalTime = microtime(true); | |
$totalIteration = 1; | |
$rawData = array( | |
"firstname" => "Francis", | |
"lastname" => "Varga", | |
"email" => "[email protected]", | |
"fbUrl" => "https://www.facebook.com/francis.varga.87", | |
"github" => "https://www.github.com/FrancisVarga", | |
"blog" => "http://www.varga-multimedia.com", | |
"lang" => array("python", "php", "js", "erlang", "as3"), | |
"gender" => "male", | |
"birthday" => "18.04.1987" | |
); | |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
// Starting CouchbaseSDK | |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
$couchbaseSDK = new \Processus\Couchbase\Client(); | |
$couchbaseSDK->setBucket("test") | |
->setUsername("Administrator") | |
->setPassword("Administrator") | |
->setPort("8091") | |
->initClient(); | |
$startCouchSdk = microtime(true); | |
for($i = 0; $i <= $totalIteration; $i++) | |
{ | |
$key = "couch:" . $i; | |
$couchbaseSDK->insert($key, $rawData, 0); | |
$couchbaseSDK->fetch($key); | |
} | |
$endCouchSdk = microtime(true); | |
$durationCouchSdk = $endCouchSdk - $startCouchSdk; | |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
// End CouchbaseSDK | |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
// Starting MemcachedJson | |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
$memcachedJson = new \Processus\Memcached\ClientJson(); | |
$memcachedJson->setPort("11711") | |
->initClient(); | |
$startMemJson = microtime(true); | |
for($i = 0; $i <= $totalIteration; $i++) | |
{ | |
$key = "memjson:" . $i; | |
$memcachedJson->insert($key, $rawData, 0); | |
$memcachedJson->fetch($key); | |
} | |
$endMemJson = microtime(true); | |
$durationMemJson = $endMemJson - $startMemJson; | |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
// End MemcachedJson | |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
// Starting MemcachedRaw | |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
$memcachedRaw = new \Processus\Memcached\Client(); | |
$memcachedRaw->setPort("11711") | |
->initClient(); | |
$startMemRaw = microtime(true); | |
for($i = 0; $i <= $totalIteration; $i++) | |
{ | |
$key = "memraw:" . $i; | |
$memcachedRaw->insert($key, $rawData, 0); | |
$memcachedRaw->fetch($key); | |
} | |
$endMemRaw = microtime(true); | |
$durationMemRaw = $endMemRaw - $startMemRaw; | |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
// End MemcachedRaw | |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
$endTotalTime = microtime(true); | |
$durationTotal = $endTotalTime - $startTotalTime; | |
echo "====================================================" . PHP_EOL; | |
echo "CouchSdk: " . $durationCouchSdk . " // " . $durationCouchSdk / $totalIteration . " item/sec. => " . $totalIteration . PHP_EOL; | |
echo "Memcached Raw: " . $durationMemRaw . " // " . $durationMemRaw / $totalIteration . " item/sec. => " . $totalIteration . PHP_EOL; | |
echo "Memcached Json: " . $durationMemJson . " // " . $durationMemJson / $totalIteration . " item/sec. => " . $totalIteration . PHP_EOL; | |
echo "====================================================" . PHP_EOL; | |
echo "Total Duration: " . $durationTotal . PHP_EOL; |
This file contains hidden or 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
Model Name: MacBook Air | |
Model Identifier: MacBookAir4,2 | |
Processor Name: Intel Core i5 | |
Processor Speed: 1.7 GHz | |
Number of Processors: 1 | |
Total Number of Cores: 2 | |
L2 Cache (per Core): 256 KB | |
L3 Cache: 3 MB | |
Memory: 4 GB | |
Boot ROM Version: MBA41.0077.B0F | |
SMC Version (system): 1.73f65 | |
Serial Number (system): C02GM045DJWQ | |
Hardware UUID: B6AAFEA6-3093-5982-BCFA-BFB909A205A9 |
This file contains hidden or 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
hippsterterminator:processus-ruhebett hippsterkiller$ php examples/benchmark.php | |
==================================================== | |
CouchSdk: 0.0045859813690186 // 0.00045859813690186 item/sec. => 10 | |
Memcached Raw: 0.024464845657349 // 0.0024464845657349 item/sec. => 10 | |
Memcached Json: 0.0073871612548828 // 0.00073871612548828 item/sec. => 10 | |
==================================================== | |
Total Duration: 0.05079197883606 | |
hippsterterminator:processus-ruhebett hippsterkiller$ php examples/benchmark.php | |
==================================================== | |
CouchSdk: 0.034731149673462 // 0.00034731149673462 item/sec. => 100 | |
Memcached Raw: 0.051259994506836 // 0.00051259994506836 item/sec. => 100 | |
Memcached Json: 0.067415952682495 // 0.00067415952682495 item/sec. => 100 | |
==================================================== | |
Total Duration: 0.16842412948608 | |
hippsterterminator:processus-ruhebett hippsterkiller$ php examples/benchmark.php | |
==================================================== | |
CouchSdk: 0.32469892501831 // 0.00032469892501831 item/sec. => 1000 | |
Memcached Raw: 0.5104820728302 // 0.0005104820728302 item/sec. => 1000 | |
Memcached Json: 0.49018096923828 // 0.00049018096923828 item/sec. => 1000 | |
==================================================== | |
Total Duration: 1.3374600410461 | |
hippsterterminator:processus-ruhebett hippsterkiller$ php examples/benchmark.php | |
==================================================== | |
CouchSdk: 3.302374124527 // 0.0003302374124527 item/sec. => 10000 | |
Memcached Raw: 7.3284850120544 // 0.00073284850120544 item/sec. => 10000 | |
Memcached Json: 7.4660248756409 // 0.00074660248756409 item/sec. => 10000 | |
==================================================== | |
Total Duration: 18.11355304718 | |
hippsterterminator:processus-ruhebett hippsterkiller$ php examples/benchmark.php | |
==================================================== | |
CouchSdk: 46.865927934647 // 0.00046865927934647 item/sec. => 100000 | |
Memcached Raw: 81.587161064148 // 0.00081587161064148 item/sec. => 100000 | |
Memcached Json: 82.284176111221 // 0.00082284176111221 item/sec. => 100000 | |
==================================================== | |
Total Duration: 210.75366902351 | |
hippsterterminator:processus-ruhebett hippsterkiller$ php examples/benchmark.php | |
==================================================== | |
CouchSdk: 0.0015289783477783 // 0.0015289783477783 item/sec. => 1 | |
Memcached Raw: 0.0026650428771973 // 0.0026650428771973 item/sec. => 1 | |
Memcached Json: 0.0016889572143555 // 0.0016889572143555 item/sec. => 1 | |
==================================================== | |
Total Duration: 0.023401021957397 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment