Need help on Mutex

  • Thread starter Thread starter =?iso-8859-1?B?YUKj?=
  • Start date Start date
?

=?iso-8859-1?B?YUKj?=

Hello all,

I have an application which will seek the sql server table whether it
is updated or not.

This application runs once in 60 seconds.

But the sql server table doesnt get updated frequently. So I thought
of a logic where in the global.asax of my web application im invoking a
semapore whenever any request comes.

And the external application will share the semaphore.

Can anyone help me out with a logic. The main or primary aim is to
minimize the overhead on my server.

Thanks in advance.

Abraham.
 
it depends what type of "application" is monitoring the sql server table.
Assuming it's a separate process (application domain) I don't think you can
use .Net synchronization primitives. Also there is no built-in support for
named pipes or memory-mapped files, so really you'd need to use tcp/ip (e.g.
make the application host a web service).

to be honest, if there is no need to poll more often than 60 seconds, I
wouldn't be that worried about the extra processing involved. you're looking
at coding a load of possibly-troublesome synchronization code to save a few
milliseconds once a minute.

Andy
 
You can use a named mutex to communicate across processes, but it
seems like overkill (you probably really want a named event instead).

Polling the database is a simple approach with little overhead. Have
you measured the impact?

If you really want to avoid polling, I'd look at a safer alternative,
like message queuing with MSMQ.
 
Back
Top