Identifying “Operations” in Your Windows Services
Windows Services usually follow several common usage patterns. By identifying these patterns, you can quickly evaluate the best way to identify operations in your code.
Think of an operation as a unit of work that is repeated over and over. You need to identify them and then potentially monitor each different operation that your service executes.
Common usage patterns:
- Queue listener – App continuously listens on a queue and each message picked up off a queue would be a unique operation.
- Timer based – Many Windows Services use timers to repeat a specific operation every few seconds like polling a database.
- Job scheduler – It is possible to embed a job scheduler like Quartz within your Windows Service to trigger small jobs and scale them across servers.
Most Windows Services are likely to perform multiple operations. I would suggest breaking them down to the smallest logical units of work. It is better if you monitor smaller units of work. This is similar to monitoring each web request in your ASP.NET application versus monitoring the performance of the application as a whole.
For example, our monitoring agent for Windows is a Windows Service. It does a ton of different operations on a schedule every few seconds. Each one of those tasks that it performs should be defined as unique operations so you can track everything that it does.
No comments:
Post a Comment