Bug #14948 Updated: mssql_pconnect opens connection everytime is called

From: Date: Fri, 21 Jun 2002 05:07:09 +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-11638@lists.php.net to get a copy of this message
ID: 14948 Updated by: spilka@adash.cz Reported By: spilka@adash.cz Status: Bogus Bug Type: MSSQL related Operating System: NT 4.0 SP5 PHP Version: 4.1.1 New Comment: Yes, right, each thread/child gets one connection. But it's not a persistence, generally, each request gets it's own thread in the Apache, is it right? It is not possible by design to maintain any type of persistence in the thread local storage in the NT Apache. I think here is philosphical contradiction in the grasp of the persistence connection. Previous Comments: ------------------------------------------------------------------------ [2002-06-20 12:52:24] sander@php.net Not a bug in PHP. Each thread/child gets one connection. ------------------------------------------------------------------------ [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. ------------------------------------------------------------------------ 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 (#11638) next »