basho / riak-php-client

PHP clients for Riak
Apache License 2.0
160 stars 69 forks source link

Stream keys in getAllKeys() (and possibly 2i) #66

Closed Addeventure closed 9 years ago

Addeventure commented 10 years ago

The current implementation of list keys does not stream the result, making Riak angry if there are more than a couple of thousand keys.

The following code allows for streaming keys using another curl writefunction. I'll gladly make a pull request if you guys want it in the official repo https://github.com/ShareMyWorld/riak-php-client/commit/98060209cdfa8884c2ca2b4cb6b5cf16f7832400

Testing the operation on a bucket containing 100000 keys gives the following result on m1.small EC2 instance, running php 5.4, Riak 1.3.2 with leveldb:

Num keys: 100000 Execution time: 11.900022983551 s PHP Memory peak usage: 19.75 MB

indexSearch() could also easily be modified to use the same curl write function to allow streaming of index searches though it might not be necessary now that there is pagination support in Riak.

christophermancini commented 9 years ago

Hey Andreas, I am not going to adjust the old client, but this is something I can implement within the rewritten client that we are releasing in the next few days. For now, since this is so old, I am going to close it. If this is a feature you would like in the new client, please just reopen this ticket and I will get it queued up.