Prasad, PutAll more effective in many cases, because transaction obtains locks for keysSet in the batch. Each put will be produced a call for obtain lock for the appropriate key, in general, it more slowly.
On Mon, May 14, 2018 at 4:47 PM, Prasad Bhalerao < prasadbhalerao1...@gmail.com> wrote: > Hi, > > Does putAll perform better than put method if the data being pushed to the > cache is going to land up on same node from where it is being pushed? > > 1) try (Transaction transaction = transactions.txStart()) { > for (Data data : datas) { > ipv4DataCache.put(data.getKey(), data); > } > transaction.commit(); > } > > > > 2) try (Transaction transaction = transactions.txStart()) { > ipv4DataCache.putAll(map); > transaction.commit(); > } > > Does code 2 performs better than code 1? > > > Thanks, > Prasad >