Connections not being re-used with pooling enabled?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Connections not being re-used with pooling enabled?

Kris Powell
Hi folks

I'm hoping you can help me understand a problem I'm having with unixodbc connection pooling. (I'm using unixodbc with freetds sitting under a python django app running under apache with pyodbc/ django-pyodbc-azure.)

I've enable pooling with the following settings:

[ODBC]
Trace = no
TraceFile = /tmp/odbc.log
Pooling = Yes

[SQL Server]
Description = FreeTDS driver for SQL Server
Driver = /usr/lib/i386-linux-gnu/odbc/libtdsodbc.so
Setup = /usr/lib/i386-linux-gnu/odbc/libtdsS.so
CPTimeout                   = 1000
CPTimeToLive        = 100
CPProbe             = SELECT USER
FileUsage                   = 1
DontDLCLose                 = 1

If I have Pooling = No, then as expected a new connection is established to the SQL Server with each request. After the request is complete, in netstat I see a bunch of connections to the sql server go from ESTABLISHED to TIME_WAIT and then close. Each new request establishes new connections which are then closed at the end of the request.

But if I set Pooling = Yes, I see new connections being established with each request, and stay on ESTABLISHED. When I issue a second request, I see a bunch new connections being set up, which also stay established. This continues until I have several dozen connections established, at which point I restart apache to clear them.

I would have expected the prior established connections to start being re-used by subsequent requests.

I'm using unixodbc 2.2.14 and freetds 0.91-1 / 0.91-5 (default packages on ubuntu 12.04 and 14.04, respectively.)

I've spent the morning googling, reading and poking around the source but am not much wiser. Any pointers/ ideas? Under what circumstances would I expect the connections to be re-used? Has anyone seen behaviour like this? I'm I doing something fundamentally wrong/ dumb? Am I poking around the wrong layer maybe? Do I need to be down in freetds?

Any help much appreciated!

Thanks
Kris
_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support
Reply | Threaded
Open this post in threaded view
|

Re: Connections not being re-used with pooling enabled?

Nick Gorham-2
On 28/12/16 10:03, Kris Powell wrote:
Hi folks

I'm hoping you can help me understand a problem I'm having with unixodbc connection pooling. (I'm using unixodbc with freetds sitting under a python django app running under apache with pyodbc/ django-pyodbc-azure.)

I've enable pooling with the following settings:

hi,

Some driver manager logging may help to see what the app is doing.

--
Nick
_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support