Slow performance on getting via 2i

Paul Barry paul.barry at temetra.com
Mon Mar 19 07:33:16 EDT 2012


One workaround for no-phases is to use Erlang identity reducer which is much quicker than js equivalent - for example 

    IndexQuery query=new IntValueQuery(IntIndex.named(resetIndexName),next,0);
    MapReduceResult result=source.mapReduce(query)
            .addReducePhase(new NamedErlangFunction("riak_kv_mapreduce","reduce_identity"))
            .timeout(240000)
            .execute();

Returns bucket/key pairs.

On 19 Mar 2012, at 11:00, Russell Brown wrote:

> 
> On 19 Mar 2012, at 10:34, ivenhov wrote:
> 
>> Hi Russell
>> 
>> Thanks for reply.
>> I tried to use your example but I could not find class BinIndexQuery in riak
>> client (I'm using 1.0.4, is there any newer version?)
> No, you are correct, I replied from memory rather than checking the API first, sorry.
> 
>> I gave it a try with:
>> 
>> IndexQuery indexQuery = new BinValueQuery(BinIndex.named(BUCKET_NAME),
>> BUCKET_NAME, bucketFilter.toString());
>> MapReduceResult res = _iclient.mapReduce(indexQuery).execute();           
>> Collection<String> resS = res.getResult(String.class);
>> 
>> which is probably something completely different since I got:
>> com.basho.riak.client.query.NoPhasesException
>> 	at com.basho.riak.client.query.MapReduce.validate(MapReduce.java:90)
>> 	at com.basho.riak.client.query.MapReduce.execute(MapReduce.java:74)
> 
> Hmmm. I believe that validation should have been removed since Riak 1.1 MapReduce can be executed without phases. I've raised an issue for that[1]. Until it is fixed you can't try the example I suggested.
> 
> Well you can. Just use the raw client and provide a JSON string to it
> 
>     String jsonString = "{\"inputs\":{\"bucket\":\"mybucket\", \"index\":\"myindex_bin\", \"key\":\"mykey\"}, \"query\": []}";
>     rawClient.mapReduce(new MapReduceSpec(jsonString));
> 
> If that is much faster then the reduce phases are to blame. Try adding back one, then the other. I have a suspicion that the JS reduce is the problem.
> 
> Cheers
> 
> Russell
> 
> [1] https://github.com/basho/riak-java-client/issues/113
> 
>> 
>> I checked the github repository but could not find anything about
>> BinIndexQuery.
>> Daniel.
>> 
>> 
>> --
>> View this message in context: http://riak-users.197444.n3.nabble.com/Slow-performance-on-getting-via-2i-tp3812664p3838662.html
>> Sent from the Riak Users mailing list archive at Nabble.com.
>> 
>> _______________________________________________
>> riak-users mailing list
>> riak-users at lists.basho.com
>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
> 
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com





More information about the riak-users mailing list