Connection close slows down on multiple requests

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
raposa
Posts: 2
Joined: Tue 21 Jun 2011 13:09

Connection close slows down on multiple requests

Post by raposa » Wed 22 Jun 2011 09:47

hi,

I'm using V4.65 with standard db-pool settings.

My problem is that the closing of my connections takes about 20-40 ms each time. If I execute multiple sql-queries within a too short time period (even from different pages) the closing can slow down up to 100-400ms for each close.

Could anyone help me with this? As I have some permanent db-requests (1-2 per second, 24/7) it slows down my whole application.

Thanx a lot

Shalex
Devart Team
Posts: 8032
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Thu 23 Jun 2011 10:42

1. Are you using the dotConnect for PostgreSQL connection pooling implementation (the Pooling=true; connection string parameter) or any separate tool that creates and manages connection pool for your PostgreSQL server? Try setting Pooling=true/false in your connection string. Does it make any difference?
2. Can the delay be caused by your environment? Have you tried any other providers? Which results have you obtained?
3.
raposa wrote:closing of my connections takes about 20-40 ms each time
How much time does opening connection take in your environment?

raposa
Posts: 2
Joined: Tue 21 Jun 2011 13:09

Post by raposa » Wed 29 Jun 2011 06:11

hi,

1) I'm using the dotConnect Pooling - if I deactive the pooling things get worse.
2) How can my environment cause the delay? The Application runs on a MS Server 2008 Standard Edition 32bit.

3) opening is pretty fast - it costs nothing.

Its just the closing, which takes so long. I check the connectionState bevore I close the connection but that can't take that long.

Shalex
Devart Team
Posts: 8032
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 29 Jun 2011 10:21

raposa wrote:1) I'm using the dotConnect Pooling - if I deactive the pooling things get worse.
PgSqlConnection.Close() should work faster with "Pooling=false;". We cannot explain your results at the moment.
rapose wrote:2) How can my environment cause the delay? The Application runs on a MS Server 2008 Standard Edition 32bit.
3) opening is pretty fast - it costs nothing.
Please create console application and try this code:

Code: Select all

    using (PgSqlConnection conn = new PgSqlConnection()) {
        conn.ConnectionString = "server=***;port=***;database=***;uid=***;pwd=***;schema=***;Pooling=true;";
        DateTime dt;
        for (int i = 0; i < 100; i++) {
            conn.Open();
            dt = DateTime.Now;
            conn.Close();
            Console.WriteLine(DateTime.Now - dt);
        }
    }
    Console.ReadKey();
How much time (mean value) does conn.Close() take in your environment?

Post Reply