Hi,
I tried to access a sliced database with multiple threads, each thread using
its own entity manager.
However, that gained almost no speed advantage at all, because each thread
reading from the sliced db seems to block the other threads(I have not
specifically tested to make them explicitly read from different slices, but it
should occur aswell, and yet I hardly see more than one thread running at the
same time).
Now, as JDBC can read the data quite a bit faster than OpenJPA, the database
itself could handle a higher load and OpenJPA adds overhead in Java - which
currently does seem to scale badly across multiple Threads, at least with
slice, unless I'm missing something. Here's a lock trace:
at java.util.concurrent.locks.LockSupport.park(Unknown Source)
at
java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(Unknown
Source)
at
java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(Unknown
Source)
at
java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(Unknown Source)
at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(Unknown
Source)
at java.util.concurrent.locks.ReentrantLock.lock(Unknown Source)
at
org.apache.openjpa.slice.ReentrantSliceLock.lock(ReentrantSliceLock.java:46)
at
org.apache.openjpa.slice.DistributedBrokerImpl.lock(DistributedBrokerImpl.java:141)
at
org.apache.openjpa.kernel.BrokerImpl.getCachePreparedQuery(BrokerImpl.java:5075)
at
org.apache.openjpa.kernel.DelegatingBroker.getCachePreparedQuery(DelegatingBroker.java:1445)
at
org.apache.openjpa.persistence.EntityManagerImpl.getPreparedQueryCache(EntityManagerImpl.java:1083)
at
org.apache.openjpa.persistence.QueryImpl.preExecute(QueryImpl.java:564)
at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:314)
at
org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:331)
Openjpa.multithreaded is not enabled, LockManager set to None,
ConnectionRetainMode is set to "always".
I have not yet tested this scenario without slice, so the problem may not be
slice related.
So, can't each entity manager have its own sliced connection or is there
another way to get around these locks?
Michael
___________________________________________________
SMA Solar Technology AG
Aufsichtsrat: Guenther Cramer (Vorsitzender)
Vorstand: Juergen Dolle, Roland Grebe, Uwe Hertel, Pierre-Pascal Urbon, Marko
Werner
Handelsregister: Amtsgericht Kassel HRB 3972
Sitz der Gesellschaft: 34266 Niestetal
USt-ID-Nr. DE 113 08 59 54
WEEE-Reg.-Nr. DE 95881150
___________________________________________________