pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Pooling with npgsql does not seem to work
5+ messages / 2 participants
[nested] [flat]

* Pooling with npgsql does not seem to work
@ 2020-10-14 15:31 Raul Kaubi <raulkaubi@gmail.com>
  2020-10-14 15:38 ` Re: Pooling with npgsql does not seem to work David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Raul Kaubi @ 2020-10-14 15:31 UTC (permalink / raw)
  To: pgsql-admin

Hi

We have .NET application (on windows) and postgres 12 database, which sits
on CentOS 7 and we are having difficulties getting connection pooling to
work.

We are using npgsql driver for pooling, so not interested in pgbouncer or
pgbool.

In our appsettings.json file, database connect string is as follows:

ConnectionString":
"Host=nnnnn.domain.com;Port=5432;Database=testdb;Username=app_user;Password=xxxxxxx;Pooling=true;MinPoolSize=17;Maximum
Pool Size=40;Application Name=testapplication"

When I start application, then I can only see 1 or 2 processes inside
database for that specific application. But shouldn't there be minimum of
17 processes created...?

I am checking with the following query, and this *num *is no more than 2
when application starts.

select datname, usename, application_name, client_addr, client_hostname,
count(1) as num
from pg_stat_activity
where usename = 'app_user'
group by datname, usename, application_name, client_addr, client_hostname
order by usename, client_addr, datname;

Any hints..?
There may be possibility that something is wrong with the application code
itself.
But to determine the exact cause, I would first like to know that the
problem isn-t with the connect string etc..

Raul

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Pooling with npgsql does not seem to work
  2020-10-14 15:31 Pooling with npgsql does not seem to work Raul Kaubi <raulkaubi@gmail.com>
@ 2020-10-14 15:38 ` David G. Johnston <david.g.johnston@gmail.com>
  2020-10-14 15:49   ` Re: Pooling with npgsql does not seem to work Raul Kaubi <raulkaubi@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: David G. Johnston @ 2020-10-14 15:38 UTC (permalink / raw)
  To: Raul Kaubi <raulkaubi@gmail.com>; +Cc: pgsql-admin

On Wed, Oct 14, 2020 at 8:31 AM Raul Kaubi <raulkaubi@gmail.com> wrote:

> MinPoolSize=17;Maximum Pool Size=40
>

It seems odd that one of those is spelled out fully while the other is not
- and indeed the documentation says it's "minimum", not "min" (and
supposedly has spaces like "Maximum Pool Size"...)

David J.

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Pooling with npgsql does not seem to work
  2020-10-14 15:31 Pooling with npgsql does not seem to work Raul Kaubi <raulkaubi@gmail.com>
  2020-10-14 15:38 ` Re: Pooling with npgsql does not seem to work David G. Johnston <david.g.johnston@gmail.com>
@ 2020-10-14 15:49   ` Raul Kaubi <raulkaubi@gmail.com>
  2020-10-14 17:06     ` Re: Pooling with npgsql does not seem to work David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Raul Kaubi @ 2020-10-14 15:49 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: pgsql-admin

Actually, I tried both settings
MinPoolSize
Minimum Pool Size

Same for max.
Seems like both are supported. In addition to that, when I deliberately made typo there, the application just won’t start at all.

So seems like these both are fine, since application does indeed start with these, just I do not see theses 17 processes anywhere..

Raul

Sent from my iPhone

> On 14. Oct 2020, at 18:38, David G. Johnston <david.g.johnston@gmail.com> wrote:
> 
> 
>> On Wed, Oct 14, 2020 at 8:31 AM Raul Kaubi <raulkaubi@gmail.com> wrote:
>> MinPoolSize=17;Maximum Pool Size=40
> 
> It seems odd that one of those is spelled out fully while the other is not - and indeed the documentation says it's "minimum", not "min" (and supposedly has spaces like "Maximum Pool Size"...)
> 
> David J.

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Pooling with npgsql does not seem to work
  2020-10-14 15:31 Pooling with npgsql does not seem to work Raul Kaubi <raulkaubi@gmail.com>
  2020-10-14 15:38 ` Re: Pooling with npgsql does not seem to work David G. Johnston <david.g.johnston@gmail.com>
  2020-10-14 15:49   ` Re: Pooling with npgsql does not seem to work Raul Kaubi <raulkaubi@gmail.com>
@ 2020-10-14 17:06     ` David G. Johnston <david.g.johnston@gmail.com>
  2020-10-14 17:34       ` Re: Pooling with npgsql does not seem to work Raul Kaubi <raulkaubi@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: David G. Johnston @ 2020-10-14 17:06 UTC (permalink / raw)
  To: Raul Kaubi <raulkaubi@gmail.com>; +Cc: pgsql-admin

On Wed, Oct 14, 2020 at 8:49 AM Raul Kaubi <raulkaubi@gmail.com> wrote:

> Actually, I tried both settings
> MinPoolSize
> Minimum Pool Size
>
> Same for max.
> Seems like both are supported. In addition to that, when I deliberately
> made typo there, the application just won’t start at all.
>
> So seems like these both are fine, since application does indeed start
> with these, just I do not see theses 17 processes anywhere..
>

The npgsql project has its own support channels, this question doesn't meet
the point of this mailing list nor the PostgreSQL server lists generally,
but I was curious and took a look around their documentation (not helpful)
and code.  I don't see where the driver, upon initial connection with a
pool, forces open a number of connections equal to the minimum specified.
The minimum behaves such that once exceeded the number of open connections
will then not decrease below that number.  It doesn't proactively open
connections to obtain the minimum - not an unreasonable choice.

David J.

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Pooling with npgsql does not seem to work
  2020-10-14 15:31 Pooling with npgsql does not seem to work Raul Kaubi <raulkaubi@gmail.com>
  2020-10-14 15:38 ` Re: Pooling with npgsql does not seem to work David G. Johnston <david.g.johnston@gmail.com>
  2020-10-14 15:49   ` Re: Pooling with npgsql does not seem to work Raul Kaubi <raulkaubi@gmail.com>
  2020-10-14 17:06     ` Re: Pooling with npgsql does not seem to work David G. Johnston <david.g.johnston@gmail.com>
@ 2020-10-14 17:34       ` Raul Kaubi <raulkaubi@gmail.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Raul Kaubi @ 2020-10-14 17:34 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: pgsql-admin

Kontakt David G. Johnston (<david.g.johnston@gmail.com>) kirjutas kuupäeval
K, 14. oktoober 2020 kell 20:07:

> On Wed, Oct 14, 2020 at 8:49 AM Raul Kaubi <raulkaubi@gmail.com> wrote:
>
>> Actually, I tried both settings
>> MinPoolSize
>> Minimum Pool Size
>>
>> Same for max.
>> Seems like both are supported. In addition to that, when I deliberately
>> made typo there, the application just won’t start at all.
>>
>> So seems like these both are fine, since application does indeed start
>> with these, just I do not see theses 17 processes anywhere..
>>
>
> The npgsql project has its own support channels, this question doesn't
> meet the point of this mailing list nor the PostgreSQL server lists
> generally, but I was curious and took a look around their documentation
> (not helpful) and code.  I don't see where the driver, upon initial
> connection with a pool, forces open a number of connections equal to the
> minimum specified.  The minimum behaves such that once exceeded the number
> of open connections will then not decrease below that number.  It doesn't
> proactively open connections to obtain the minimum - not an unreasonable
> choice.
>
> David J.
>
>
Oh, yeah, it makes sense - this looks like is working as intended then.
Thanks.

Raul

^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2020-10-14 17:34 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-10-14 15:31 Pooling with npgsql does not seem to work Raul Kaubi <raulkaubi@gmail.com>
2020-10-14 15:38 ` David G. Johnston <david.g.johnston@gmail.com>
2020-10-14 15:49   ` Raul Kaubi <raulkaubi@gmail.com>
2020-10-14 17:06     ` David G. Johnston <david.g.johnston@gmail.com>
2020-10-14 17:34       ` Raul Kaubi <raulkaubi@gmail.com>

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