This discussion is archived
2 Replies Latest reply: Feb 13, 2012 7:17 AM by 900576 RSS

Concurrent writing to a model

900576 Newbie
Currently Being Moderated
Hello,

We are trying to find the best solution to write concurrently to the same semantic model. We have at times more than 20+ threads requesting to update triples in the semantic model. We are currently creating a synchronized block around the operation that all of the threads use to only allow one of the threads access to the editable model. When we did not use the syncronized block the INS and DEL triggers on the Application Table creating deadlocks.

Is there a best practice for writing to the same model at the same time? Any guidence would be helpful.

Thanks
-MichaelB

Edited by: MichaelB on Feb 8, 2012 9:55 AM
  • 1. Re: Concurrent writing to a model
    sdas Journeyer
    Currently Being Moderated
    The scenario that causes the deadlock is exactly the same as what occurs during concurrent DML into a relational table with a unique constraint.

    Underneath, the semantic store too has a uniqueness constraint defined to prevent duplicate RDF triples in the same RDF model. So, suppose one transaction T1 inserts triple (a,b,c), a second trans T2 inserts triple (d,e,f). Then the first transaction T1 tries to insert the triples (d,e,f), but it blocks because this triple has already been inserted by the yet-to-be-committed transaction T2. Now, when the second transaction T2 tries to insert triple (a,b,c), it blocks as well because this triple has already been inserted by the yet-to-be-uncommitted transaction T1. So, this circularity brings us to a deadlock and Oracle would raise ORA-00060: deadlock detected while waiting for resource.

    Since this is exactly how deadlock may occur in any relational table with unique constraints defined on it, the best practice for avoiding deadlock would be the same for concurrent inserts into the same RDF model.

    Hope this helps.
  • 2. Re: Concurrent writing to a model
    900576 Newbie
    Currently Being Moderated
    This is what I assumed.

    Is there any benifit from breaking the data into different Models or Named Graphs (since all of the link data is stored in the same table)?

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points