Bug #14948 Updated: mssql_pconnect opens connection everytime is called

From: Date: Thu, 20 Jun 2002 16:52:24 +0000
Subject: Bug #14948 Updated: mssql_pconnect opens connection everytime is called
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-11587@lists.php.net to get a copy of this message
ID: 14948 Updated by: sander@php.net Reported By: spilka@adash.cz -Status: Open +Status: Bogus Bug Type: MSSQL related Operating System: NT 4.0 SP5 PHP Version: 4.1.1 New Comment: Not a bug in PHP. Each thread/child gets one connection. Previous Comments: ------------------------------------------------------------------------ [2002-01-14 05:06:56] spilka@adash.cz I've checked PHP source. It's as fjortiz@comunet.es said, hash table of connections is maintained per thread, so there is no persistent connection until reached count of thread pools. ---------------------------------------- I think one should update doc info, this is unwanted side effect behavior. Correctly one must said use of the persistent effect discriminates Apache thread pool implementation. ------------------------------------------- ------------------------------------------------------------------------ [2002-01-14 04:51:51] fjortiz@comunet.es The problem is Apache 1.3.x Win32, that creates 25 or 50 threads right away from the start. It's wiser the 'thread-on-demand' approach of IIS and Apache 2, because you spend only what you need. You must think that Apache under most UNIX doesn't have threads, but processes, so a different connection pool is needed per process. Under Win32, Apache processes become threads, but PHP still has different data structures per thread. So considering it a bug is very subtle here, as it comes from a PHP architecture consideration. Maybe you want start a 'philosophical' discussion with the 'gurus'... of course, not me, not today! ------------------------------------------------------------------------ [2002-01-14 04:41:01] spilka@adash.cz Hmm, it looks logically. Unfortunaltelly, I still thing it's bug. To reach state of persistent connection you need f.e.25 requests, if the mechanism is as you tell. But if you will measure time of openning connection, you will get f.e. 200ms first time and 5ms next time. So, the performance grows up as expected, but off to the resources. But your SQL server need more resources for more connections and here you can get large lack of performance (as in my case). And, documentation tells persistent connection is connection with the same server,uid and pwd. ------------------------------------------------------------------------ [2002-01-14 03:51:11] fjortiz@comunet.es I think this is not a bug, but Apache 1.3.x Win32 default behavior: if you configured Apache to have 25 threads, for example, there will be 25 opened connections, because Apache seems to rotate requests among threads. So the persistent connection pool is PER THREAD, not per process. IIS (and Apache 2 I think) uses a different way: it creates threads as they are needed. Pity this creates some thread-safe issues thanks to the clunky MSSQL DB-library... And beware!, by default MSSQL DB-library only accepts 25 connections per process. ------------------------------------------------------------------------ [2002-01-10 02:22:56] spilka@adash.cz Apache 1.3.22 Win NT SP5 PHP 4.1.1, run as DLL Apache module MSDE SQL server mod_mssql module loaded The web server with PHP module and SQL server are running on the same machine. Problem: When opening connection to MSSQL database with mssql_pconnect, the connections are not persistently used. Instead, new connection is opened everytime. MSSQL sp_who2 clearlz determines this (everytime REFRESH inbrowser is called new connection pops up). Ondra. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/14948 -- Edit this bug report at http://bugs.php.net/?id=14948&edit=1

« previous php.bugs (#11587) next »