Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.
- ABP Framework version: v3.3.1
- UI type: MVC
- Tiered (MVC) or Identity Server Seperated (Angular): no
- Exception message and stack trace:
- Steps to reproduce the issue:
- How do we configure connection pooling? we are running against postgres. we have the website and the api backend and a hangfire server running asd part of this project. the connection to our database and the hangfire database. we have 4 developers working on the same postgres server but we are constantly running in to PostgresException: 53300: sorry, too many clients already.
- My thought was connection pooling would handle this. in EF core, i know you are supposed to use AddDbContextPool instead of AddDbContext, but i do not see where AddDbContext is even being called in our code, so i am guessing it is handled in your code instead. Can you shed some light on the best practices for handling these connection pooling issues?
3 Answer(s)
-
0
hi,
In the
*.EntityFrameworkCore
, there's*EntityFrameworkCoreModule.cs
And there'll beoptions.UseNpgsql()
oroptions.UsePostgreSql()
you can pass options to this method see https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsPostgreSqlExtensions.cs#L11
-
0
maybe i just dont kow ef core well enough but i didnt see the answer to my question in that link. would adding this to the connection string solve the issue? ;Pooling=true;MinPoolSize=0;MaxPoolSize=10;
-
0
try adding pooling parameter to the connection string.
https://docs.abp.io/en/abp/latest/Entity-Framework-Core-PostgreSQL#usenpgsql also you can use DbContextOptionsBuilder for adding
AddDbContextPool
afterDbContextOptionsBuilder