[Mono-list] Data access delay using Npgsql

Francisco Figueiredo Jr. fxjrlists@yahoo.com.br
Sat, 14 Aug 2004 15:19:13 -0300


Francisco Figueiredo Jr. wrote:
> Reilly, Andrew wrote:
> 
>> Hi all,
>>
> 
> Hi Reilly.
> 
>> I've been experimenting with accessing a PostgreSQL database using 
>> Npgsql,
>> but have come across a problem.
>>
>> Whenever I open a new NpgsqlConnection under the MS .NET runtime there is
>> always a short delay of a few seconds, presumably while the client
>> authenticates with the server. However, when the same program is run 
>> under
>> mono the delay is almost imperceptible. This is frustrating because I 
>> tend
>> to develop under VS.NET then distribute using mono.
>>
>> I'm running mono 1.0.1 with Npgsql 0.6 and the server is PostgreSQL 
>> 7.4.3.
>> I've tried turning on logging support in Npgsql but it doesn't report
>> anything relevant: the log starts from when the connection is actually
>> established any everything works quickly after that. I've also tried
>> relaxing the authentication settings of the database but this has no 
>> effect.
>>
>> Does anyone have any suggestions as to what the cause of the problem 
>> might
>> be?
>>
> 

Hi Reilly.

Mikko Korkalo sent me a message saying he is having the same problem as 
you are.
He said me one interesting information: the 0.5 doesn't have this problem.
I checked cvs and could see that there was a slightly change in the code 
which establishes the connection. In 0.5 I was checking the server 
address to see if it was in dot ip format and so I didn't do the name 
resolution.
In 0.6, I incorrectly changed this code and was doing the connection 
using directly the server address. So, when you pass the server name as 
ip address, you may be getting the delay because of the time spent 
trying to resolve this address.

Could you try the 0.5 version and check if it is faster for you?
If so, I will patch the current version with this fix.

Thanks in advance.

Regards,

Francisco Figueiredo Jr.