How to speed up mssql_connect ()

I am working on a project in which the PHP dialog system interacts with Microsoft SQL Server 2008, and I need more speed on the PHP side.

After profiling my PHP scripts, I found that it took about 200 milliseconds on this particular system to call mssql_connect (). For some simple dialogs, this is about 60% of the entire script execution time. Therefore, I could get a huge performance boost by speeding up this call.

I have already assured that for each request to my PHP scripts, only one connection descriptor is created.

Is there a way to speed up the initial connection to SQL Server? However, there are some limitations:

  • I can not use PDO (there is a lot of legacy code here that will not work with it)
  • I do not have access to SQL Server configuration, so I need a solution on the PHP side
  • I cannot upgrade to PHP 5.3.X, again due to crappy legacy code.
+3
source share
3 answers

Hm. I don't know much about MS SQL, but optimizing this single call can be tough.

One thing that comes to mind is trying mssql_pconnect () , of course:

Firstly, when connecting, the function will first try to find a (permanent) link that is already open with the same host, username and password. If it is found, the identifier for it will be returned instead of opening a new connection.

But you probably already thought about it.

-, , MS SQL , PHP, , , ? ping ? , . 200 , .

mssql_connect() talk PHP MS SQL. , "" , .

, , :

, ... IIS6 β†’ SQL Server 2000. CGI ISAPI , - 10 , .

, IP- HOST , . , - DNS- .

, .

+3

php 5.3, FreeTDS mssql. , , , .

  • mssql_pconnect() mssql_connect() " ". , , , . , php 20 60 db .
  • IP- freetds.conf .
+3

, , - ip- sql, dns. , .

+1

Source: https://habr.com/ru/post/1733205/


All Articles