Server Development Performance Counters

All of you agree on the importance of using performance counters for server applications.

I would like to know how to implement them using C #.

Typically, performance counters have the following attributes:

  • They are public / global
  • For recording, a lock is required for synchronization.
  • Reading sometimes requires locks.

Is it better to update them asynchronously? What is the best way to make them asynchronous?

I plan to use the ThreadPool.QueueUserWorkItem () function. What is your opinion on this?

If my questions seem a bit vague, check out the HelloWorld WCF service.

I also want to know the following:

  • How many times this happens in general and over a given period of time.
  • Average / min / maximum response time in general and over a given period.

If anyone knows of any specialized ways to do this in .NET or WCF, please let me know.

+3
source share
2 answers

If you use .NET classes for this purpose, there is no need to manually block the increment, decrement, and request of the performance counter - the framework will do this for you.

If you need to use performance counters in your own code, you should still use InterlockedIncrement () and friends.

, - , . , - . ThreadPool . , , , - , .

, , , , .

, .NET GC Memory , GC , ( ) , - (, , MS ).

, , WCF , , .

+3
+1

Source: https://habr.com/ru/post/1739425/


All Articles