Skip to content

Instantly share code, notes, and snippets.

@pushpesh4u
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pushpesh4u/d6c475313dc4dd9c33e0 to your computer and use it in GitHub Desktop.
Save pushpesh4u/d6c475313dc4dd9c33e0 to your computer and use it in GitHub Desktop.
Benchmark script
<?php
$time = microtime( true );
for( $i = 0; $i < $numRequests; $i++ ) {
$obj = new Base\Aerospike( 'test', 'mytest', 1 );
$ldt = $obj->createLDT( 'List', 'sbin' );
if( $ldt->isLDT( 'List' ) ) {
$find = array( 'key' => $searchKey );
$status = $ldt->find( $find );
if( gettype( $status ) == 'array' ) {
$logger[] = '<li class="success">Successfully got the key in the LDT :: ' . $searchKey . '.</li>';
} else {
header("HTTP/1.0 404 Not Found");
header("Reason: Key not found in aerospike");
$logger[] = '<li class="error">No bin with such key in the LDT.</li>';
}
} else {
header("HTTP/1.0 404 Not Found");
header("Reason: Aerospike reports that bin is not an LDT yet!");
$logger[] = "<li class=\"error\">Aerospike connection failed! Request #" . $i . "</li>";
}
}
$logger[] = "<li class=\"notice\">Time taken : " . ( microtime( true ) - $time ) . " seconds</li>";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment