[infinispan-dev] putAll, getAll and optimization fruits

Emmanuel Bernard emmanuel at hibernate.org
Tue Sep 23 10:06:35 EDT 2014


We have had a short discussion on putAll, getAll. I’m pushing the info here


>>>  getAll and putAll and nothing more than a glorified sequential call to get / put in a for loop.
>>> The execution of gets and puts in parallel for it costs o(n) network trip in latency rather than o(1).
>>> How could we improve it ?
>> Historically getall and putall were not intended as hotrod operations and were actually implemented only to honor the map interface.
>> The most we can do RPC wise to optimize these operations is to group all keys mapping to the same server node into a single request. That would reduce the number of RPCs, but in big O talk it would still be O(numKeys). Executing them in parallel sounds like a good idea to me. Curious to hear other thoughts on this. Galder?
> 
> So there are actually three improvements:
> 
> * getall and putall as hotrod operations (no matter how that will be implemented by the server itself)
> Galder, is it possible in current HR design to execute requests in parallel, without consuming one thread for each node? That was something my async client should solve, but afaik it's not possible without substantial changes, and we were rather targetting that for future JDK 8 only client.

Doing that it’s 1/2 of the story, because as I’ve already explained in Wolf’s efforts around putAll, the Netty server implementation just calls to Infinispan synchronous cache operations, which often block. So, using an async client will get you 1/2 of the job done. The way to limit the blocking is by limiting that blocking, e.g. splitting keys and sending gets to nodes that own it would mean the gets get resolved locally, similar thing with puts but as Bela/Pedro found out, there could be some blocking still.

> Anyway, we could route the HR request to the node with most matching keys.

I don’t think that’s a good idea.

The best option is to take all keys, divide them by server according to hashing and send paralell native Hot Rod getAll operations contain N keys requested to each server. The same thing for putAll.

I’ve create a JIRA to get getAll/putAll implemented in the Hot Rod 2.0 timeframe: https://issues.jboss.org/browse/ISPN-4752
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/infinispan-dev/attachments/20140923/bff88c11/attachment.html 


More information about the infinispan-dev mailing list