Pooling with npgsql does not seem to work

From: Raul Kaubi <raulkaubi(at)gmail(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Pooling with npgsql does not seem to work
Date: 2020-10-14 15:31:04
Message-ID: CAO_+3-AimodPArUsQ1K7tfzgJyWnQFOJrV01mtdj1LrzDoNb_A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message David G. Johnston 2020-10-14 15:38:24 Re: Pooling with npgsql does not seem to work
Previous Message Thomas SIMON 2020-10-12 17:47:19 Re: Weird behavior with unique constraint not respected, and random results on same queries