Reputation: 51
In our project we are testing how transactions work in distributed environment. As a part of the project we are testing opensource edition of GridGain 6.5.5.
We have faced lots of problems in the following testcase:
The issues are:
Our hardware:
8x Dell M620 blades, 256GB RAM, 2x8 core Xeon E2650v2, 10GbE network.
Attaches:
Upvotes: 0
Views: 255
Reputation: 2292
I have looked at the logs and am seeing the following JVM parameters
-Xms64m -Xmx512m -XX:MaxPermSize=256m
With high degree of probability you are running into long GC pauses, and that is the likely reason why you are getting lock timeout exceptions. With memory settings like this, JVM can go into GC pauses for as much as 5 minutes, during which the world is locked and nothing can be done. To confirm this, you can collect GC logs using the following JVM options:
-Xloggc:/opt/server/logs/gc.log \
-verbose:gc \
-XX:+PrintGC \
-XX:+PrintGCTimeStamps \
-XX:+PrintGCDetails
My recommendation is to allocate about 10GB maximum per JVM and start more JVM instances. You can also try using off-heap memory feature of GridGain and allocate large memory space outside of the main Java heap - http://doc.gridgain.org/latest/Off-Heap+Memory. Also, please take a look at GC tuning parameters here: http://doc.gridgain.org/latest/Performance+Tips#PerformanceTips-TuneGarbageCollection
Another big suggestion is that you should not do individual get(...) operations in your transaction, but do a one getAll(...) call instead:
try (GridCacheTx tx = balanceCache.txStart()) {
/*
* ==============================================
* This while loop calls get(...) many times and acquires one lock at a time.
* It should be replaced with one getAll(...) call.
* ===============================================
*/
while (changes.hasNext()) {
Map.Entry<String, BigDecimal> ent = changes.next();
BigDecimal oldBalance = balanceCache.get(ent.getKey());
balanceCache.putx(ent.getKey(), oldBalance.add(ent.getValue()));
}
tx.commit();
} catch (GridException ex) {
throw new Exception("transaction failed", ex);
}
Upvotes: 2
Reputation: 406
(Moving from the comment)
In order to avoid deadlocks you need to make sure that you acquire locks in the same order. This must be done when working with transactions in any system of records, be that Oracle database or GridGain data grid.
As for the performance, it should be very fast. Most likely it is a matter of configuration. Can I ask you to provide a reproducible example? (you can use pastbin.com to share your code)
Upvotes: 0