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.
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.
Comments
Thanks!
Also, I fixed link. Good catch!
I would like to tell everyone I know about a new web site for web hosting plans... If you are looking on ways to mkae money starting a business and need a site to host it on . Visit http://webhost-er.com/ Today
btw i love your blog although i have just stumbled upon it =)
Love the new pictures you got there! Please come visit my site kitchen renovation give me any valuable feedbacks.
btw i love your blog although i have just stumbled upon it =)
Love the new pictures you got there! Please come visit my site guide to antique give me any valuable feedbacks.