0

System Layout

I have a system in place where a Cache is made up of many Cache Nodes. When one is added, a CacheNodeAdded event is raised by the Cache. The Cache has a redundant set of Monitors listening for this event. Monitors are responsible for notifying on Cache events.

Since I have multiple Monitors, but only want to be notified once, Step 3 is what I am looking to implement.

Solutions I can't use:

  • Cache notifying directly. Monitors must be used.
  • Have each Monitor check the log to see if the notification has been sent. Since they all run separately, they could all access the list of notifications at the same time, see the notification hasn't been sent, and notify multiple times as a result.

Solution I'm toying with:

  • When event is received, get a list of all Monitor IDs (GUID), order the list, and the first Monitor in the list gets to send the notification. This is a simple solution but it seems a little inelegant.

Are there any other simple solutions that I may be overlooking?

  • There are potential constraints to answers that you don't mention. Are all of these monitors and nodes running on the same machine? In the same process? Using the same thread(s)? – Chris Shain Mar 27 '14 at 1:44
  • @ChrisShain Nodes and Monitors are all running on separate physical systems. – Garrison Neely Mar 27 '14 at 13:56
0

A write-lock can be acquired by the Monitor that has received the event over the log, do logging and set the logged flag to 'true' in the global logging context which all Monitors can look up and update has a reference of. Subsequent monitors may skip the logging step after reading the logged flag status.

Lookup of in memory context flag is expected less costly than that of the log itself.

  • I'm updating my question to remove logging. It's really notification, so the file locking you suggest isn't valid in this case. I oversimplified. – Garrison Neely Mar 27 '14 at 13:59
0

It isn't really clear what your other monitors are for if they aren't going to be sending notifications.

Is there some reason why you can't add or have a single monitor instance that is responsible for passing on the notifications?

  • This would be more appropriate as a comment. I do realize that you don't have the reputation though to post it as a comment. – Adam Zuckerman Mar 27 '14 at 20:16
  • Redundancy is the reason. The monitoring functionality is critical for system health monitoring. – Garrison Neely Mar 27 '14 at 21:09
0

I ended up implementing the solution discussed in my question.

•When event is received, get a list of all Monitor IDs (GUID), order the list, and the first Monitor in the list gets to send the notification.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.