RE: PEAR and MSSQL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Chris Boget wrote:
> We are using PEAR as our database abstraction layer for connectivity
> to MSSQL.  It seems that, for some inexplicable reason, that our code
> is losing it's connection to the sql server.

I've had similar problems in the past, only in my situation it was connecting from a
Linux machine to MSSQL via FreeTDS.  However, from your description it seems like
our problems MIGHT have the same root cause.  I would suggest that you try the
following:

(1) Disable persistent connections.  This is just my own personal experience, but
I've never been able to get PHP's persistent connection mechanism to work reliably,
at least with MSSQL.  My experience is that it causes intermittent problems which
all seem to indicate that the connections eventually become unreliable or unusable,
and the persistent connection code doesn't seem to be able to recover from this
situation gracefully.  At least with normal connections you don't have to worry
about a problem with one request persisting to the next.

(2) MSSQL Server seems to have a problem with applications that open many
connections in rapid succession.  Disabling persistent connections will exacerbate
this problem, as a connection will be opened for each request.  It seems these
problems are caused, at least in part, by SQL server limiting the number of incoming
connections it will queue up.  This behavior can be controlled by adjusting MSSQL's
WinsockListenBacklog setting.  The default setting is 5, which means that the server
will queue up a maximum of 5 incoming connections.  The server will then reset any
new connections that come in as long as the queue is full.  In my situation, I
adjusted this value to 10, and this had a HUGE affect.  We still have problems from
time to time, but now they are very rare and they could probably be eliminated
completely by adjusting this number even higher, I just haven't gotten around to
doing that yet.

For more information on how to adjust the WinsockListenBacklog setting, see these MS
knowledgebase articles:

http://support.microsoft.com/default.aspx?kbid=328476
http://support.microsoft.com/kb/154628/EN-US/

The following PHP bug reports seem to be related to this:

http://bugs.php.net/bug.php?id=19541
http://bugs.php.net/bug.php?id=29074

Try disabling persistent connections and adjusting the WinsockListenBacklog to 10
and see what results you get.

HTH

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux