Starts in:
1 DAY
19 HRS
15 MIN
1 SEC
Starts in:
1 D
19 H
15 M
1 S
Open Closed

Connection Pooling #633


User avatar
0
RonaldR created

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)
  • User Avatar
    0
    alper created
    Support Team Director

    hi,

    In the *.EntityFrameworkCore, there's *EntityFrameworkCoreModule.cs And there'll be options.UseNpgsql() or options.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

  • User Avatar
    0
    RonaldR created

    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;

  • User Avatar
    0
    alper created
    Support Team Director

    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 after DbContextOptionsBuilder

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06