PHP Client Performance

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

PHP Client Performance

Blake Schwendiman
I created 1,000 random keys and values and inserted them in a bucket. On the first run, it took 2 seconds. On the second run, 4. On the third 6, and so forth. Is it normal for Riak's write time to degrade like this (takes more time per write when there's more data)? Or am I doing something wrong?

This is the insert code:

  global $start;

  $client = new RiakClient(HOST, PORT);
  $bucket = $client->bucket('test_bucket');

  print("Writing 1,000 objects\n");
  for ($i = 0; $i < 1000; $i++) {
    $rand = rand();
    $obj = $bucket->newObject('foo_' . $rand, 'AAAAAAAAJbbbbbbbbbkdjskdjfkdlsjfkalsfejfsklejlsfejkl' . $rand);
    $obj->store();
  }
  $elapsed = microtime(true) - $start;
  print("  completed in $elapsed ms\n");


As you can see, I'm using the simple PHP rand() function to generate keys/values, so there's definitely a possibility of name collision on the keys. 

The run time seems to be increasing each time I run, though it's not exactly linear. I just ran it again and the run time was 11 seconds for 1,000 inserts. 

BTW, this is a single-node cluster on a decent Linux machine (N, W, R are all default values). I am using innostore on the back-end.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Blake Schwendiman

Blog: http://www.thewhyandthehow.com/
Facebook: http://www.facebook.com/blake.schwendiman

_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Reply | Threaded
Open this post in threaded view
|

Re: PHP Client Performance

Sean Cribbs-2
Blake,

I tried your code with a minor modification and consistently got around 2 seconds.  Can you post your app.config and vm.args files?

Sean Cribbs <[hidden email]>
Developer Advocate
Basho Technologies, Inc.

On Apr 6, 2010, at 2:57 PM, Blake Schwendiman wrote:

I created 1,000 random keys and values and inserted them in a bucket. On the first run, it took 2 seconds. On the second run, 4. On the third 6, and so forth. Is it normal for Riak's write time to degrade like this (takes more time per write when there's more data)? Or am I doing something wrong?

This is the insert code:

  global $start;

  $client = new RiakClient(HOST, PORT);
  $bucket = $client->bucket('test_bucket');

  print("Writing 1,000 objects\n");
  for ($i = 0; $i < 1000; $i++) {
    $rand = rand();
    $obj = $bucket->newObject('foo_' . $rand, 'AAAAAAAAJbbbbbbbbbkdjskdjfkdlsjfkalsfejfsklejlsfejkl' . $rand);
    $obj->store();
  }
  $elapsed = microtime(true) - $start;
  print("  completed in $elapsed ms\n");


As you can see, I'm using the simple PHP rand() function to generate keys/values, so there's definitely a possibility of name collision on the keys. 

The run time seems to be increasing each time I run, though it's not exactly linear. I just ran it again and the run time was 11 seconds for 1,000 inserts. 

BTW, this is a single-node cluster on a decent Linux machine (N, W, R are all default values). I am using innostore on the back-end.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Blake Schwendiman

Blog: http://www.thewhyandthehow.com/
Facebook: http://www.facebook.com/blake.schwendiman
_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com