Skip to Content.
Sympa Menu

freetds - Re: php pconnect

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Brian Bruns" <camber AT ais.org>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Re: php pconnect
  • Date: Wed, 16 Jan 2002 13:02:27 -0500


> > Brian,
> > what does then www.php.net mean with its documentation of
> > the "sybase_pconnect()" function:
> > -->
> > First, when connecting, the function would first try to find a
> > (persistent) link that's already open with the same host, username
> > and password. If one is found, an identifier for it will be returned
> > instead of opening a new connection.
> >
> > Second, the connection to the SQL server will not be closed when the
> > execution of the script ends. Instead, the link will remain open for
> > future use (sybase_close() will not close links established by
> > sybase_pconnect()()).
> > <--
> > Thus, if there's NO (persistant)connection ONE will be established.
> > If there's ONE, no additional will be opened.
> > So how would you establish more than ONE connection, only using
> > sybase_pconnect()??
>
>
> As someone mentioned already, I think this is per Apache process. If I do
> "ps -ef | grep httpd" I see (right now) 14 Apache processes running. Each
> can have one connection per host/user/password.
>
>
> - Darryl

Exactly, thus if MaxServers was set to 20 in the httpd.conf file you'd see
the behaviour as described.

The only alternatives to this would be a) threaded apache (ie 2.0) should
be capable of storing this type of stuff globally, however php would need
to support it and since 2.0 is not yet solid (haven't been tracking it in
a while, i may be a bit pessimistic) it'd be a while. b) a connection
pool of some sort, well not of some sort, of a very particular sort
actually. The connection pool would have to run as its own process. The
FreeTDS connection pool is just such a beast, although it is arduous to
configure and only support TDS 4.2 currently. The other possiblity I can
think of is SQLRelay, it is a bit more generic in that it supports more
that just FreeTDS and could be an option. The performance effect of
converting protocols is unknown (theoretically the FreeTDS connection
pooling should be faster, since it merely acts as a switch, whereas
SQLRelay as I understand it has to be propagated to the daemon and then
marshalled/demarshalled) but it is most likely not an issue for most
applications.

Incidently, both FreeTDS pool and SQLRelay allow multiple machines to
share a connection pool.

Brian




Archive powered by MHonArc 2.6.24.

Top of Page