Skip to content

Cache DatabaseInfo on host/port/database instead of on the entire connection string #3069

@dsalla

Description

@dsalla

When the connection string is dynamic, the memory allocation is 100%

Attached is the diagnosis and the simulation project

The red frame of the image is with the static connection string, normal memory usage
Server=YOUR_SERVER;Port=YOUR_PORT;Database=YOUR_DATABASE;User Id=YOUR_USERID;Password=YOUR_PASSWORD;Pooling=false;Application Name=localhost;

The green frame of the image is with the dynamic connection string, abnormal memory usage
Server=YOUR_SERVER;Port=YOUR_PORT;Database=YOUR_DATABASE;User Id=YOUR_USERID;Password=YOUR_PASSWORD;Pooling=false;Application Name={Guid.NewGuid()};

In my application besides the Application Name I also dynamically use the Server, Port, Database, User Id and Password

It is a single application (multi-tenant) with several databases

With .NET CORE 2.0 the problem does not occur
It emerged from CORE 2.1 and we abandoned the migration of the framework
We have now resumed CORE 3.1 and found this to be the cause of excessive memory usage

Npgsql version: 4.1.3.1
PostgreSQL version: 11.5
Operating system: CentOS 7 / Windows 10

NpgsqlMemory.zip
NpgsqlMemory

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions