Hi André
Dr. André Lanka wrote:
Hi Paolo,
On 27.10.2011 12:31, Paolo Castagna wrote:
the concurrency documentation on TDB could certainly be improved! :-)
http://openjena.org/wiki/TDB/JavaAPI#Concurrency
Can you try to get a lock from a DatasetGraphTDB and let us know if
you still have problems?
As expected the problems vanish, yet this blocks the complete store
(containing up to 1000 named graphs) whenever someone wants to write to
it. This brings me back to my initial question:
Is there any possibility to permit parallel write access to different
graphs?
Which TDB version are you using?
What is the average execution time of your write|read requests?
How many write|read request per second you have?
If you want to try a SNAPSHOT (be warned: it's a SNAPSHOT and it might have
problems!), you could use TDB 0.9.0-incubating-SNAPSHOT here:
https://repository.apache.org/content/repositories/snapshots/org/apache/jena/jena-tdb/
Then you can try:
Location location = ...
StoreConnection sConn = StoreConnection.make(location);
DatasetGraphTxn dsgTx = null;
try {
dsgTx = sConn.begin(ReadWrite.WRITE);
...
} catch (Exception e) {
dsgTx.abort();
...
} finally {
dsgTx.commit();
}
try {
dsgTx = sConn.begin(ReadWrite.READ);
} catch (Exception e) {
dsgTx.abort();
} finally {
dsgTx.commit();
}
Another warning: these are APIs which might or might not change again in future.
See also:
- https://issues.apache.org/jira/browse/JENA-41 (now closed)
- https://cwiki.apache.org/confluence/display/JENA/TxTDB-design
- https://cwiki.apache.org/confluence/display/JENA/TxTDB
If you are interested in low level details, a good starting point to look at is
the test suite, here:
http://svn.apache.org/repos/asf/incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/transaction/
A test using multiple threads to run read/write transactions is this one:
http://svn.apache.org/repos/asf/incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/transaction/T_TransSystem.java
If you are curious and you want to have a look at the implementation,
start from the com.hp.hpl.jena.tdb.transaction package, here:
http://svn.apache.org/repos/asf/incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/
Paolo
Thanks
André