we are using Embeded objectDB 2.4.4_06 in a highly multithreaded concurrent manner and we have noticed a performance problem in our application that seems to be attributed to ObjectDb's internal locking.
When profiling our app in JVisualVm we notice a large number of threads are blocked and when doing a threaddump we notice that they are all blocked in the same place:
java.lang.Thread.State: BLOCKED at com.objectdb.o.MST.Vb(MST.java:1293) - waiting to lock <3a678c0> (a com.objectdb.o.LKM) owned by "ODB-FileWriter" t@16 at com.objectdb.o.WRA.Vb(WRA.java:370) at com.objectdb.o.WSM.Vb(WSM.java:174) at com.objectdb.o.OBM.bL(OBM.java:922) at com.objectdb.o.OBM.bJ(OBM.java:827) at com.objectdb.o.OBM.bH(OBM.java:733) at com.objectdb.jpa.EMImpl.commit(EMImpl.java:276) "ODB-FileWriter" - Thread t@16 java.lang.Thread.State: RUNNABLE at java.io.RandomAccessFile.setLength(Native Method) at com.objectdb.o.LFL.R(LFL.java:996) at com.objectdb.o.SFL.ah(SFL.java:998) - locked <67fc75bc> (a com.objectdb.o.LFL) at com.objectdb.o.MST.ah(MST.java:1746) at com.objectdb.o.SFL.ag(SFL.java:958) at com.objectdb.o.SFL.run(SFL.java:918) - locked <62633b0e> (a com.objectdb.o.PGC) - locked <3a678c0> (a com.objectdb.o.LKM) at java.lang.Thread.run(Thread.java:662) Locked ownable synchronizers: - None
this seems to take a considerable lenght of time ( approx 4-10 seconds). do you have any suggestions as to how we can improve / elviate this? our database files are between 100 and 500 meg when this occurs. It doesnt happen all the time but periodically. We do alot of inserts, queries and remove as we use objectdb to drive a persistent queue.