Search code examples
.netwcfsql-server-2008long-pollingpolling

How to implement "new mail icon" for roughly 100 clients? Central server polling or local client polling?


Following scenario: We have got a database table, in which new mail messages for the users are stored. When a user has our client application running, the app needs to display an icon that a new mail has arrived when an entry for this user is inserted in the database table.

Roughly 100 users will be logged in at the same time.

Two solutions as far as I see them:

  1. Implement a service on a central server. That server polls the database regularly. Also, clients, when starting up, need to register with the server, so that they can be called back, when a new message for their user has arrived. Good: fewer database polls. Bad: More coding for the central element.
  2. Every client polls the database on its own. The polling needs to happen about once a minute, so I have got 100 clients polling the database every minute. Bad idea? Or still ok?

So, which option would you go for?

We are using .NET 4.0 for our clients and MS SQL Server 2008 as database.

Also, in case you vote for solution 1: Would a WCF service be a good idea? Any links or ideas around my scenario would be appreciated.

Thanks all!


Solution

  • Go for option 1. More code, but more scalability.