Skip to content

Performance issue #57

Description

@rlakis

I have compiled the old php extension for PHP-8 and did a small test; the result was that the old extension is faster than the new one by about 100%

the PHP test code

namespace Aerospike;
$socket = "/tmp/asld_grpc.sock";
$client = Client::connect($socket);

$startTime = microtime(true); // true returns a float
$rp = new ReadPolicy();
$key = new Key("user", "profiles", "facebook-id");
$key1 = new Key("user", "devices", "device-is");

$brp = new BatchReadPolicy();
$br = new BatchRead($brp, $key, []);
$br1 = new BatchRead($brp, $key1, []);

$bp = new BatchPolicy();
for ($i=0;$i<10000;$i++) {
$recs = $client->batch($bp, [$br, $br1]);
}

$endTime = microtime(true);
$elapsedTime = ($endTime - $startTime)*1000.0;
echo "Elapsed time: " . $elapsedTime . " ms\n\n";

$hosts = ["hosts" => [["addr"=>"h1", "port"=>3000], ["addr"=>"h2", "port"=>3000], ["addr"=>"h3", "port"=>3000]]];
$options = [\Aerospike::OPT_POLICY_KEY => \Aerospike::POLICY_KEY_SEND,
\Aerospike::OPT_POLICY_EXISTS => \Aerospike::POLICY_EXISTS_IGNORE,
\Aerospike::OPT_MAX_RETRIES => 3
];

$cluster = new \Aerospike($hosts, true, $options);
$startTime = microtime(true); // true returns a float

$pk=$cluster->initKey("user", "profiles", "facebook-id");
$pk1=$cluster->initKey("user", "devices", "device-id");
for ($i=0;$i<10000;$i++) {
$cluster->getMany([$pk, $pk1], $recs);
}

$endTime = microtime(true);
$elapsedTime = ($endTime - $startTime)*1000.0;
echo "Elapsed time: " . $elapsedTime . " ms\n\n";

Rust Elapsed time: 18366.338968277 ms
Old Elapsed time: 10984.447956085 ms

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions