You are here: Excessive socket usage using MS-SQL server via ADO COMobject « PHP Programming Language « IT news, forums, messages
Excessive socket usage using MS-SQL server via ADO COMobject

Posted by Cornald Kruyt on 11/25/05 15:29

Hi,

I've an database import script written in PHP which used ADO via COM.
It makes thousands of queries to a MS-SQL server. The problem is that
the process runs out of sockets.
The MSSQL server is used in the following way:

// In the beginning of the script, the connection is set up
$dbc=new COM("ADODB.Connection");
$dbc->ConnectionString="Provider=sqloledb;Network
Library=DBMSSOCN;Data Source=FOO;Database=BAR;User ID=FOO;Password=BAR";
$dbc->Open();

// Typical query
$rs=$dbc->execute("SELECT ... FROM ...");
// process the result set here

// Close and free the resultset object:
$rs->Close();
unset($rs);

The script executes many queries in rapid succession. When I inspect
the output of 'netstat -an' during execution, I see thousands of open
sockets:

...
TCP 192.168.1.210:3960 192.168.1.13:1433 TIME_WAIT
TCP 192.168.1.210:3961 192.168.1.13:1433 TIME_WAIT
TCP 192.168.1.210:3964 192.168.1.13:1433 TIME_WAIT
....

Sometimes the script even dies with a COM exception error, that it can't
make a connection to the MSSQL server anymore. This happens when +/-
4000 sockets are in the TIME_WAIT state. After two minutes these
sockets are automatically closed by Windows and MSSQL connections are
possible again.

Is this a known problem? I couldn't find it in Google.

is there a way to make ADO (or PHP) reuse the existing socket, instead
of opening a new one for each Execute?

Greetings,

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация