Opening and closing RDF store connections in Flask app

28 views
Skip to first unread message

scossu

unread,
Dec 28, 2017, 1:14:57 PM12/28/17
to rdflib-dev
Hello,
I am writing a Flask app that uses RDFLib to interact with a back end RDF store. I am testing with two different setups, one using the SPARQLUpdateStore connector  and one using the Sleepycat one.

At the moment I am initiating the store connection in the Flask app initialization phase; which means that the connection stays open across requests, as long as the application is not restarted.

with the SPARQL/HTTP connector this seems to have no negative effect; with the Sleepycat connector performance degrades visibly after each request. I don't notice that with the SPARQL connector.

If I open and close the Sleepycat connection with each request, even a very simple operation operation on a small database takes more than 1 second.

I have two questions: 1) Is it best to open and close the Sleepycat connector after each request, or leave it open? And 2) Shall I use different strategies if I want to use the Sleepycat and SPARQL connectors interchangeably?

Thanks.

scossu

unread,
Dec 29, 2017, 10:07:51 PM12/29/17
to rdflib-dev
It turns out that the performance degradation was caused by a flaw in my application logic which was felt more acutely with the Sleepycat store.

Looking at the timing results, it seems like leaving the connection open is the way to go.

Thanks.
Reply all
Reply to author
Forward
0 new messages