Hi all,

This is my first post to this list, so please bear with me ;)

Anyway, I've been running/developing a PHP application (fairly simple
content management system) for some time now and it has been running
pretty well. I'm using Apache 1.3.14, PHP 3.0.16 and PostgreSQL 6.5.3.

The problem is that the increasing number of requests the application
needs to service requires me to increase the number of Apache processes,
which sometimes causes database problems. Originally I had about 10-20
running processes, but now I sometimes reach 75-100 or more. Since I'm
using persistant db connections, this means I can have 100 (or more)
open db connections; this is not something PostgreSQL really likes. 

If I use normal db connections, everything works ok, but the performance
is no longer acceptable. I suspect that I only need 2-3 db connections
for every 10 running processes.

On another server we're running several PHP/PostgreSQL and PHP/MySQL
based website, also using Apache 1.3. In this case I'm having similar
problems. In order to handle the amount of traffic this webserver needs
about 80-150 processes (I've seen up to 230 running httpd's). Some scripts
get quite a lot faster if I use persistant connections, but if I do, I
can be pretty sure that both MySQL (hangs after a while) and PostgreSQL
(dreadful performance, sometimes crashes) get into trouble. I currently
have 2 MySQL and 3 PostgreSQL databases, so if I have 150 running processes,
I could have 300 open MySQL and 450 open PostgreSQL connections. It's like
tinkering with explosives, since this is sure to cause a lot of trouble.

What I'd like is a way to have a small pool of database connections with
a fixed (configurable) size. When you request a persistant connection in
a PHP script, you would either get a connection from the pool or a new,
normal connection (if there are no more free connections in the pool).
Upon closing the connection moves back to the pool or is closed in case
of a normal connection.

I've done some searching in the mailinglist archives and on the net and I
haven't found a usable answer yet, so I'll probably look into implementing
something myself (using PHP 4.0.x and PostgreSQL 7.0/MySQL 3.23). I haven't
really looked at how complex this would be, but I am aware of the fact that
something like this is much easier to implement for a threaded webserver.

Any comments or suggestions would be really welcome,

Btw. Something I'll probably do until I come up with a solution is moving
all scripts requiring db access to another webserver (running on the same
machine) with a much lower number of Apache processes. It solves the
database problem, but introduces a whole range of new problems.

TIA,

Mathijs
-- 
ilse Technology B.V. - Postbus 542 5600 AM Eindhoven
Telefoon: 040 750 31 00 - Fax: 040 750 31 99        
Web: http://www.ilse.nl/ - E-mail: [EMAIL PROTECTED]

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to