How to use connection pool on a web app

In all the examples that I found on the documentation or on blog articles, connection pools are closed after we are done with them. I have to use Stardog to develop an API, so basically my app will never be stopped. Should I use only one pool and get connections when needed ? If so, when should I close this pool sometimes ? Or should I create a new pool every time I need a connection and close it afterwards ?

I’m quite of a newbie, so excuse me if this question seems dumb or trivial .

Nothing is forever. Eventually all things must come to an end. It's just not your preferred state. :wink:

In general, yes. You may want to establish separate connection pools for reasoning and non-reasoning connections as suggested in the documentation. [quote="Orval, post:1, topic:378"]
If so, when should I close this pool sometimes

You should close the connection pool right before your application exits.

That would defeat the purpose of using a connection pool and would probably be worse than not using one at all. Connection pools aren't really specific to Stardog and you aren't required to use one. There is a overhead associated with establishing a connection so rather than paying that cost every time you need to use a connection you pay the price once and then return the connection to the shared pool where it will be reused and avoid the cost of establishing the connection.

No worries. A journey of a thousand miles begins with a single step. Feel free to ask questions and be sure to share the cool things you end up doing with Stardog.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.