Обсуждение: Connection pool

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

Connection pool

От
Mark Paylaga
Дата:
Hi sorry if this has been asked already.
Is there any mechanism to do connection pooling for libpqxx already?
Or any new developments for this?

Our one dbwriter service instance recieves requests simultaneously to write to the database. We need separate db
connectionsfor each request. The simple way to do it is to hardcode and create x number of connections. Is there a way
tojust use connection pooling? 

 Can anyone point me to the right direction? Thanks.

Mark



Re: Connection pool

От
Sergey Konoplev
Дата:
Hi,

On 6 September 2010 10:34, Mark Paylaga <mpaylaga@gmail.com> wrote:
> Hi sorry if this has been asked already.
> Is there any mechanism to do connection pooling for libpqxx already?
> Or any new developments for this?
>
> Our one dbwriter service instance recieves requests simultaneously to write to the database. We need separate db
connectionsfor each request. The simple way to do it is to hardcode and create x number of connections. Is there a way
tojust use connection pooling? 

There are two programs implementing connection pulling for PG. No need
to implement it in your application.

- pgbouncer (http://wiki.postgresql.org/wiki/PgBouncer)
- pgpool (http://pgpool.projects.postgresql.org/)


>
>  Can anyone point me to the right direction? Thanks.
>
> Mark
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>



--
Sergey Konoplev

Blog: http://gray-hemp.blogspot.com /
Linkedin: http://ru.linkedin.com/in/grayhemp /
JID/GTalk: gray.ru@gmail.com / Skype: gray-hemp / ICQ: 29353802

Re: Connection pool

От
Mark Gabriel Paylaga
Дата:
Thanks! I'll look into it.

On Mon, Sep 6, 2010 at 2:54 PM, Sergey Konoplev <gray.ru@gmail.com> wrote:
> Hi,
>
> On 6 September 2010 10:34, Mark Paylaga <mpaylaga@gmail.com> wrote:
>> Hi sorry if this has been asked already.
>> Is there any mechanism to do connection pooling for libpqxx already?
>> Or any new developments for this?
>>
>> Our one dbwriter service instance recieves requests simultaneously to write to the database. We need separate db
connectionsfor each request. The simple way to do it is to hardcode and create x number of connections. Is there a way
tojust use connection pooling? 
>
> There are two programs implementing connection pulling for PG. No need
> to implement it in your application.
>
> - pgbouncer (http://wiki.postgresql.org/wiki/PgBouncer)
> - pgpool (http://pgpool.projects.postgresql.org/)
>
>
>>
>>  Can anyone point me to the right direction? Thanks.
>>
>> Mark
>>
>>
>>
>> --
>> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-general
>>
>
>
>
> --
> Sergey Konoplev
>
> Blog: http://gray-hemp.blogspot.com /
> Linkedin: http://ru.linkedin.com/in/grayhemp /
> JID/GTalk: gray.ru@gmail.com / Skype: gray-hemp / ICQ: 29353802
>

Re: Connection pool

От
Mark Gabriel Paylaga
Дата:
Hi,
Regarding connection pooling...
I may actually not need connection pooling...

I have one service to write to db. The service receives one or more requests at the same time from different modules.

When two requests are received at the same time, both of the requests  will use the same db connection resulting in an error:
Started transaction<READ COMMITTED> while transaction<READ COMMITTED> still active

So what I did was to have dedicated db connections for each type of request.  All of these requests are also put in a queue for their respective types so that they will wait for the previous request to finish. 

Is this an acceptable solution?  Because I tried pgbouncer and it actually does not solve the scenario above....


On Mon, Sep 6, 2010 at 10:12 PM, Mark Gabriel Paylaga <mpaylaga@gmail.com> wrote:
Thanks! I'll look into it.

On Mon, Sep 6, 2010 at 2:54 PM, Sergey Konoplev <gray.ru@gmail.com> wrote:
> Hi,
>
> On 6 September 2010 10:34, Mark Paylaga <mpaylaga@gmail.com> wrote:
>> Hi sorry if this has been asked already.
>> Is there any mechanism to do connection pooling for libpqxx already?
>> Or any new developments for this?
>>
>> Our one dbwriter service instance recieves requests simultaneously to write to the database. We need separate db connections for each request. The simple way to do it is to hardcode and create x number of connections. Is there a way to just use connection pooling?
>
> There are two programs implementing connection pulling for PG. No need
> to implement it in your application.
>
> - pgbouncer (http://wiki.postgresql.org/wiki/PgBouncer)
> - pgpool (http://pgpool.projects.postgresql.org/)
>
>
>>
>>  Can anyone point me to the right direction? Thanks.
>>
>> Mark
>>
>>
>>
>> --
>> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-general
>>
>
>
>
> --
> Sergey Konoplev
>
> Blog: http://gray-hemp.blogspot.com /
> Linkedin: http://ru.linkedin.com/in/grayhemp /
> JID/GTalk: gray.ru@gmail.com / Skype: gray-hemp / ICQ: 29353802
>

Re: Connection pool

От
Vick Khera
Дата:
On Tue, Nov 23, 2010 at 4:42 AM, Mark Gabriel Paylaga
<mpaylaga@gmail.com> wrote:
> When two requests are received at the same time, both of the requests  will
> use the same db connection resulting in an error:
> Started transaction<READ COMMITTED> while transaction<READ COMMITTED> still
> active
>
>

You have multiple threads sharing the same connection?  You can't do that.