Re: passing resource id's through functions

From: Andrew McMillan <andrew(at)catalyst(dot)net(dot)nz>
To: Culley Harrelson <Culley_Harrelson(at)pgn(dot)com>
Cc: cmr(at)shell(dot)gis(dot)net, pgsql-php(at)postgresql(dot)org
Subject: Re: passing resource id's through functions
Date: 2002-01-15 00:23:46
Message-ID: 1011054226.26843.25.camel@kant.mcmillan.net.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

On Tue, 2002-01-15 at 06:27, Culley Harrelson wrote:
> DBBalancer looks interesting. Looks like you are part of the development
> team with this project?

I am packaging it for Debian, and I am using it. All the C++ coding is
being done by Daniel Varela.

> What sort of performance difference to you see?

For most things the performance is roughly equivalent to using
persistent connections. If your resultsets are very large you will see
a performance impact because of the extra layer.

When I first started using it I benchmarked one of the applications I
use and decided it was around 5-10% faster than persistent connections,
but that was with small recordsets.

The main performance advantage for me is that I can have fewer database
connections than apache processes. Each page served on my sites usually
has a mix of database content and static (image) content, and apache
doesn't need to have a database operating for the static stuff, so I
only need around 30% database clients vs apache clients. Persistent
connections would have a 1 for 1 match, after they have been running for
a while. This means less memory pressure on the system, which is the
big win for me.

> When I made the decision to go with php/postgres as my primary
> development technologies I never even started using persistant
> connections because of all the mixed reviews. The database is local
> to the web server and performance is fine. I would be interested in
> hearing more about this connection pooling though...

There are some things you have to watch out for:
- use of temp tables
- transactions that you forgot to commit / rollback

That's the price you pay :-)

The biggest advantage of DBBalancer is probably that it doesn't require
you to make any changes to your PHP, other than in the pg_connect
statement - it's just as if you were connecting to a different database
server, because it supports the PostgreSQL interface natively. Other
connection pooling approaches may want you to load a different module
into PHP, or use a different set of PHP functions. This means that the
layer is very thin, as well.

Cheers,
Andrew.
--
--------------------------------------------------------------------
Andrew @ Catalyst .Net.NZ Ltd, PO Box 11-053, Manners St, Wellington
WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St
DDI: +64(4)916-7201 MOB: +64(21)635-694 OFFICE: +64(4)499-2267
Are you enrolled at http://schoolreunions.co.nz/ yet?

In response to

Browse pgsql-php by date

  From Date Subject
Next Message Andrew McMillan 2002-01-15 00:41:41 Re: passing resource id's through functions
Previous Message Chadwick Rolfs 2002-01-14 22:15:14 Re: passing resource id's through functions