You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by Mario Ds Briggs <ma...@in.ibm.com> on 2012/11/05 13:45:30 UTC

Fuseki - RDBMS backed stores, handling database connection

Laurent's question on SDB usage reminded me of another question i had for a
while...

 What is the pattern for handling obtaining/releasing the connection for
each request that comes into FUSEKI in the case of DB backed stores ?

  From what we have seen, the same Dataset instance is used for each
request and therefore if the connection is tied to the Dataset, there is a
problem when there is concurrently running requests. What we have done with
DB2  in case of Fuseki is that we create a dummy Dataset and in the
   -  begin() method of the dummy Dataset, create the real dataset by
giving it its own separate connection. It also ties the real dataset to the
current threadID
   - all other methods first obtain the real dataset using the current
threadID and delegate to the real dataset
   - end() method, releases the connection

Mario



Re: Fuseki - RDBMS backed stores, handling database connection

Posted by Andy Seaborne <an...@apache.org>.
On 05/11/12 12:45, Mario Ds Briggs wrote:
> Laurent's question on SDB usage reminded me of another question i had for a
> while...
>
>   What is the pattern for handling obtaining/releasing the connection for
> each request that comes into FUSEKI in the case of DB backed stores ?
>
>    From what we have seen, the same Dataset instance is used for each
> request and therefore if the connection is tied to the Dataset, there is a
> problem when there is concurrently running requests. What we have done with
> DB2  in case of Fuseki is that we create a dummy Dataset and in the
>     -  begin() method of the dummy Dataset, create the real dataset by
> giving it its own separate connection. It also ties the real dataset to the
> current threadID
>     - all other methods first obtain the real dataset using the current
> threadID and delegate to the real dataset
>     - end() method, releases the connection

Roughly, that is what TDB does.  See DatasetGraphTransaction.

There is a real-one-transaction datasetgraph switched by thread.  Its 
all within TDB - Fuseki does not need to do anything special - it just 
gets the top datasetgraph calls DatasetGraph operations all on thread 
per HTTP request inside one transaction.

(I would not do it as a Dataset - use the DatasetGraph)

	Andy

>
> Mario
>
>