1

I am requesting for an implementation suggestion in

OS: Windows server 2008 Platform : ASP.NET, C# DB: MS SQL 2005

Scenario is:

  1. We have to implement a monitoring daemon which will monitor set of DB tables in MS SQL in a frequent interval (Say 10 sec) and identify all critical entries.

  2. The entries after analysis will associate with some actions based on its criticality or category. So assume one of a critical entry will be denoted as ACCT_USR_LIMIT_EXECEED : SomeName.

3.So ACCT_USR_LIMIT_EXECEED : SomeName shall associate to an action which shall be an email dispatch or a DB table update query execution or a folder size measurement or deleting a folder or cleaning up some files in the local HDD etc.

The amount critical entries to be analysed shall be moderate as of now but it has scope to increase too.

How do we approach this, and i see the possibilities are,

  1. Shall we write one windows service for monitoring and dispatching actions or,
  2. write two different services, one to monitor and dispatch its analysis to a MSMQ and the other service to dispatch an action reading the same MSMQ entry pushed.

Will having a single windows service will help us? or whats the best approach for this.

Kindly suggest

Futur
  • 8,444
  • 5
  • 28
  • 34
  • 2
    Just a thought [deviating away from C# Service] - Why not use Powershell for such stuffs. There is a concept of backgroud jobs and Powershell is a powerful automation tool to achieve such admin operations. For ex: http://www.sqlservercentral.com/blogs/cleveland-dba/2012/04/12/better-living-thru-powershell-update-statistics-in-parallel/ – Angshuman Agarwal Apr 27 '12 at 13:35
  • Thank you for suggesting, we will see that as well. and some C# solution will help a lot :) – Futur Apr 27 '12 at 13:41

2 Answers2

2

I think it all depends on the expected volume of dispatches. If you're going to do 2000 dispatches every second then I would think that a separation is a good idea, so one service won't impact the other and you could possibly have a separate environment (server) for each of them. If the expected amount is something like 10 every minute then I can't see why you should make it complicated, some threading and proper business layers will do just fine.

hyp
  • 1,370
  • 1
  • 9
  • 21
  • it will be little high and cant be predicted. assume the whole setup is for a SaaS based portal to track user usages. I cant be sure about the size of it. But do you think MSMQ is a best approach or any other IPC? – Futur Apr 27 '12 at 13:43
  • Well without having an estimate you're in a hard place really, but yes MSMQ is a viable solution in your case. – hyp Apr 27 '12 at 13:52
2

There is no straight forward answer to this as it depends on lot of parameters. I agree with what "Hyp" said. As you said, some C# solution will help a lot - So, technically if you want to achieve this Windows Service / MSMQ stuff then you may have a look here -

http://stackoverflow.com/questions/1521841/receiving-msmq-messages-with-windows-service
http://stackoverflow.com/questions/3956467/how-to-create-a-c-sharp-listener-service-for-msmq-as-a-windows-service

Hope this helps.

Angshuman Agarwal
  • 4,796
  • 7
  • 41
  • 89