I’m investigating some performance issues in our product. We have several threads (order of tens) that are each doing some form of polling every couple of seconds, and every time we do that we are opening a connection to the DB, querying, then disposing.
So I’m wondering, would it be more efficient for each thread to keep an open connection to the DB so we don’t have to go through the overhead of opening a connection every 2 seconds? Or is it better to stick with the textbook using blocks?
First thing to learn about is Connection pooling. You’re already using it, don’t change your code.
The question becomes: how many connections to claim in my config file?
And that’s easy to change and measure.