Connection close slows down on multiple requests

Connection close slows down on multiple requests

Postby 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
raposa
 
Posts: 2
Joined: Tue 21 Jun 2011 13:09

Postby 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?
Shalex
Devart Team
 
Posts: 7774
Joined: Thu 14 Aug 2008 12:44

Postby 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.
raposa
 
Posts: 2
Joined: Tue 21 Jun 2011 13:09

Postby 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?
Shalex
Devart Team
 
Posts: 7774
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for PostgreSQL