php and connection

Поиск
Список
Период
Сортировка
Искать

php and connection

От:
Szymon Guz <mabewlun@gmail.com>
Дата:
Hi,
in a PHP application working on Postgres normally the new connection to the database is made per request. 

This can potentially cause too big overhead, so I've got some questions:

- is the overhead really noticeable?
- could this be solved using persistent connections, or the persistent connections in php and postgres don't work properly?
- could this be solved using something like pgpool?

regards
Szymon

Re: php and connection

От:
"Joshua D. Drake" <jd@commandprompt.com>
Дата:
On Wed, 2010-06-30 at 20:42 +0200, Szymon Guz wrote:
> Hi,
> in a PHP application working on Postgres normally the new connection
> to the database is made per request. 
> 
> 
> This can potentially cause too big overhead, so I've got some
> questions:
> 
> 
> - is the overhead really noticeable?

It can be.

> - could this be solved using persistent connections, or the persistent
> connections in php and postgres don't work properly?

Don't use them.

> - could this be solved using something like pgpool?
> 
Yes, using a connection pooler will solve the problem. I prefer
pgbouncer.

Joshua D. Drake


> 
> regards
> Szymon

-- 
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 509.416.6579
Consulting, Training, Support, Custom Development, Engineering

Re: php and connection

От:
Thom Brown <thombrown@gmail.com>
Дата:
On 30 June 2010 19:43, Joshua D. Drake  wrote:
> On Wed, 2010-06-30 at 20:42 +0200, Szymon Guz wrote:
>> Hi,
>> in a PHP application working on Postgres normally the new connection
>> to the database is made per request.
>>
>>
>> This can potentially cause too big overhead, so I've got some
>> questions:
>>
>>
>> - is the overhead really noticeable?
>
> It can be.
>
>> - could this be solved using persistent connections, or the persistent
>> connections in php and postgres don't work properly?
>
> Don't use them.
>
>> - could this be solved using something like pgpool?
>>
> Yes, using a connection pooler will solve the problem. I prefer
> pgbouncer.
>

+1

I can't really add to that.

Thom

Re: php and connection

От:
Szymon Guz <mabewlun@gmail.com>
Дата:


2010/6/30 Thom Brown <thombrown@gmail.com>
On 30 June 2010 19:43, Joshua D. Drake <jd@commandprompt.com> wrote:
> On Wed, 2010-06-30 at 20:42 +0200, Szymon Guz wrote:
>> Hi,
>> in a PHP application working on Postgres normally the new connection
>> to the database is made per request.
>>
>>
>> This can potentially cause too big overhead, so I've got some
>> questions:
>>
>>
>> - is the overhead really noticeable?
>
> It can be.
>
>> - could this be solved using persistent connections, or the persistent
>> connections in php and postgres don't work properly?
>
> Don't use them.
>
>> - could this be solved using something like pgpool?
>>
> Yes, using a connection pooler will solve the problem. I prefer
> pgbouncer.
>

+1

I can't really add to that.

Thom

Thanks for the answers that ensured me in what I was thinking about.

regards
Szymon

Re: php and connection

От:
"Joshua D. Drake" <jd@commandprompt.com>
Дата:
On Wed, 2010-06-30 at 20:42 +0200, Szymon Guz wrote:
> Hi,
> in a PHP application working on Postgres normally the new connection
> to the database is made per request. 
> 
> 
> This can potentially cause too big overhead, so I've got some
> questions:
> 
> 
> - is the overhead really noticeable?

It can be.

> - could this be solved using persistent connections, or the persistent
> connections in php and postgres don't work properly?

Don't use them.

> - could this be solved using something like pgpool?
> 
Yes, using a connection pooler will solve the problem. I prefer
pgbouncer.

Joshua D. Drake


> 
> regards
> Szymon

-- 
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 509.416.6579
Consulting, Training, Support, Custom Development, Engineering

FAQ