Is PgBouncer needed for .NET Core applications with Entity Framework (Npgsql)?

1.4k Views Asked by At

EF registers as scoped service, which means it creates many short connections to database. One http request - one connection. PostgreSQL doesn't handle a lot of concurrent connections very well. Like a maximum of 100. Is PgBouncer needed for .NET Core applications with Entity Framework (Npgsql)? PgBouncer manages the connection pool. Or can Npgsql manage the connection pool correctly? Or is this only relevant for Python and PHP? Thanks!

1

There are 1 best solutions below

2
On BEST ANSWER

Npgsql includes its own in-process connection pool (as is common with .NET database drivers), so using an external connection pool such as PgBouncer isn't mandatory (though it can still make sense in some scenarios for pooling connections across several client machines, etc.).