pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Frank Joerdens <frank@joerdens.de>
To: Roberto Mello <rmello@cc.usu.edu>
Cc: Mathijs Brands <mathijs@ilse.nl>
Cc: pgsql-php@postgresql.org
Subject: persistent connections, AOLserver (Was: [SQL] maybe Offtopic : PostgreSQL & PHP ?)
Date: Wed, 18 Apr 2001 17:37:27 +0200
Message-ID: <20010418173727.A5021@rakete.joerdens.de> (raw)
In-Reply-To: <20010418085424.A13383@cc.usu.edu>
References: <B5CDCF382265D311BF33009027A8FE9401E6F3BC@pmrmsg.edsn.com>
	<5.0.2.1.0.20010418223233.00a68170@mail.e-magine.com.au>
	<20010418073430.B12408@cc.usu.edu>
	<20010418164436.A41431@ilse.nl>
	<20010418085424.A13383@cc.usu.edu>

Roberto Mello wrote:
[ . . . ]
>         I am using PHP 4 under AOLserver/OpenNSD, which has been fully
> threaded from scratch (1994) so I hope this won't be much of an issue
(but
> then PHP 4 still has threading problems AFAIK).

Ah, very interesting indeed! I've been meaning to look into this for
quite a while but never had the time to really play with it. Are you
using PHP/AOLserver in a production environment? Did you have any
problems, crashes, etc.? And, most importantly, how _does_ it work with
persistent connections? Does AOLserver open a connection for each
request/thread it creates? 

I think the real issue with PHP/PostgreSQL and persistent connections
was to do with transactions. AFAIK the too-many-connections issue was
easy to fix through some fiddling with appropriaty parameters
(max_connections or something, I forget) in php.ini - it's not too well
documented, you'd best just play with it and try some different options
(I don't have the problem, I _am_ using persistent connections, and I
can send you what I put in my php.ini if you want).

The transaction issue with persistent connections was discussed a couple
of weeks back here or on the php list, I am not sure. It kinda boils
down to the situtation where a persistent connection is being re-used by
a different apache child to the one which opened a transaction that has
not yet completed, or was not completed through some error. PostgreSQL
would then assume that the same client is issuing further SQL statements
within the pending transaction block. This would mess things up since
presumably a COMMIT WORK would be missing to complete the transactions .
. . I am actually not sure what would be likely to happen, nor what the
worst-case scenario might be, but it's clear that it'd be messy. I think
the PHP people are working on it. 

The workaround was to issue a COMMIT WORK at the end of each script to
close any transaction that might be pending. There was a thread about
this too, a little while back. What puzzles me a little is that I've
never noticed any of these issues and I am using persistent connections
and transaction quite a bit. I am not using the COMMIT WORK workaround.
I don't have a sense of how serious this issue might be, if it came up.

AFAIK the problem is somehow rooted in the fact that PHP folks up until
very recently used to have a strong MySQL bias, which doesn't (or
didn't, until very recently) have proper transaction support. Hence they
didn't really consider this scenario.

However, what this means for the combination  PHP/AOLserver/PostgreSQL
is completely unclear to me, as I have no idea of what a PHP persistent
connection does under AOLserver.

Regards, Frank

NB: I've replied to pgsql-php and not pgsql-sql because this thread
seems more appropriate there.



view thread (5+ messages)  latest in thread

Message-ID: <20010418173727.A5021@rakete.joerdens.de>
Permalink:  ../20010418173727.A5021@rakete.joerdens.de/
Also on:    postgresql.org/message-id/20010418173727.A5021@rakete.joerdens.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: frank@joerdens.de, rmello@cc.usu.edu, mathijs@ilse.nl, pgsql-php@postgresql.org
  Subject: Re: persistent connections, AOLserver (Was: [SQL] maybe Offtopic : PostgreSQL & PHP ?)
  In-Reply-To: <20010418173727.A5021@rakete.joerdens.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox