-
1. Re: Infinispan put operation very slow
rvansa Jan 21, 2015 10:37 AM (in response to execretor)1 of 1 people found this helpfulSeems like you're using HotRod protocol to access the cache, right? Although the cache itself is async according to your configuration, the call (RPC) to server is synchronous, so you have to wait until one write finishes before starting another one.
If you care about total throughput, use many (hundreds) concurrent connections to the server, and distributed those 100k entries between the threads writing to the cache. You can do that ~automatically using putAsync, but the threadpool has only about 20 threads by default.
-
2. Re: Infinispan put operation very slow
execretor Jan 22, 2015 4:29 PM (in response to rvansa)Thanks for your help,
with your method and using the default thread pool configuration, insert of 300k entries with 2 nodes finish in 24 seconds. Very good.
But there is another problem using putAsync method. This is my code:
TransactionMamager tman = db.getTransactionManager();
for(int i = 0; i < 300000; i++) {
try {
tman.begin();
db.putAsync(i, i);
tman.commit();
} catch(....) {
....
}
}
The execution of tman.commit() infinispan raise an exception with the information of an invalid state of the transaction(Probably because with putAsync i cannot determine the correct moment when the data is written).
So, how can i use transactions with the putAsync method?
Regards,
Lorenzo