Forum: Synchronous notification landed on cvs!

Posted by: Francisco Figueiredo jr.
Date: 2006-03-26 19:52
Summary:Synchronous notification landed on cvs!
Project:Npgsql .Net Data Provider for Postgresql

Hi all,

I finally could get synchronous notification done. It is in cvs now.

What is synchronous notification?
Up to now, in order to get notifications from postgresql, Npgsql clients would need to call empty commands. If application didn't do that, only on next NpgsqlCommand.Execute* call notification would be delivered.
Now with synchronous notification, client applications are notified as soon as message arrives, hence the name synchronous notification.

On current code, it is disabled by default. To enable it, you have to put syncnotification=true in your connection string.

How it works?

When you enable synchronous notification, Npgsql will create another thread to check is data arrived in socket. To do that, it uses Socket.Poll method. When Npgsql is idle, this thread is running. It is stopped as soon as any NpgsqlCommand.Execute* method is called and resumed when this call returns.

Side effects:

Because of synchronization of threads, there is performance drop when using synchronous notification. So, if you want max performance, don't use it. Synchronous notification is more valuable on desktop applications where they have more idle cycles and need more "real time" notifications.

Please, give it a try and let me know if you find any problems.

Sponsors Ads

Latest News

Npgsql code repository changed to git

Francisco Figueiredo jr. - 2013-06-28 22:35 -

Npgsql 2.0.12 beta2 released!

Francisco Figueiredo jr. - 2011-09-29 02:30 -

Npgsql receives donation of an MSDN subscription!!

Francisco Figueiredo jr. - 2010-08-23 22:13 -

Entity Framework Sample posted

Francisco Figueiredo jr. - 2009-11-12 20:48 -

Npgsql 2.0.6 released!

Francisco Figueiredo jr. - 2009-07-21 14:35 -
Monitor Forum | Start New Thread Start New Thread
Powered By FusionForge