ObjectDB ObjectDB

Multithreading Test and Deadlock


I move on to testing the multi threaded part of ObjectDB. From the same code (MyMain.java), I set the thread count from 1 to 4 and not only do I found it's slower overall (each thread only needs to insert 250K entities) but the threads are stuck with a deadlock.

All threads share the same EntityManagerFactory but they have their own EntityManager.

The stack trace and the test are attached.


Thank you for the deadlock report. Please try build 2.2.3_05 that should fix it.

Regarding multithreading speed - currently in ObjectDB embedded mode multithreading improves performance in reading but not in writing. You can see this in the JPAB benchmark (compare 1 thread to 5 threads). ObjectDB is faster than the alternatives also when using multithreading in writing but the gap becomes smaller, so there may be a place for improvement here.

Your test shows that multithreading is even slower, but I found that using smaller transactions (2,000 instead of 10,000 entity objects per transaction) brings 1-thread and 4-threads runs to equivalent results, so maybe in this test 4 threads are slower because of higher memory usage (4 x 10,000 x 100 strings x attribute length => many MBs).

ObjectDB Support

Thanks. It solved the dead lock.



To post on this website please sign in.