With this simple code:
<?php $key=123456798;
$record = array(
"hello" => "world",
);
$db=new \Aerospike(array(
"hosts" => array( array(
"addr" => 'xx.xx.xx.xx',
"port" => '1234',
)
)),false);
$asKey = $db->initKey('my_namespace', 'my_set', (string)$key); // Convert key into string => var type is important
// read selected bins from a record
$option = array( \Aerospike::OPT_POLICY_KEY => \Aerospike::POLICY_KEY_SEND );
$return = $db->put($asKey, $record, 0, $option);
if ( \Aerospike::OK == $return )
var_dump('record saved!');
else
var_dump($db->errorno(),$db->error());
we got this result in time with xdebug:
version: 1
creator: xdebug 2.5.5 (PHP 5.6.31-1~ubuntu14.04.1+deb.sury.org+1)
cmd: /var/www/html/test_aerospike.php
part: 1
positions: line
events: Time
fl=(1) php:internal
fn=(1) php::Aerospike->__construct
89 3151863
fl=(1)
fn=(2) php::Aerospike->initKey
91 10
fl=(1)
fn=(3) php::Aerospike->put
95 26779
fl=(1)
fn=(4) php::var_dump
98 47
fl=(2) /var/www/html/test_aerospike.php
fn=(5) {main}
summary: 3179787
-1076408928 1086
cfl=(1)
cfn=(1)
calls=1 0 0
89 3151863
cfl=(1)
cfn=(2)
calls=1 0 0
91 10
cfl=(1)
cfn=(3)
calls=1 0 0
95 26779
cfl=(1)
cfn=(4)
calls=1 0 0
98 47
Human readable format:
{main} : 0,001sec php::Aerospike->__construct : 3,1sec php::Aerospike->put : 0,026sec var_dump() : 0.000047sec php::Aerospike->initKey : 0.00001sec
Conclusion
As you can see the Aerospike PHP extension take 3,1 seconds to load! (initiate connection?) the put process is faster (only 0,026sec).
Environment
PHP 5.6.31-1 aerospike-client-php-3.4.14 ubuntu14.04.1 Apache/2.4.7 (Ubuntu)
Does anyone got this performance issue too? Any ideas?
Thanks for your help!