How to programmatically use the azure web / working role usage measurement of memory?

I want to record the memory usage for some web / worker roles that are hosted in azure windows.

Is there a way to programmatically check the current memory used so that I can save this value somewhere for later use?

The only information I found was to get the current thread, and then call the method, which should return the heap memory usage. But I don’t think it helps me much in my problem, especially when there are asynchronous calls.

+4
source share
2 answers

Azure - . , : , ..

  • Azure "".
  • "" ""
  • " " " " → ""
  • " " , (, , ).

"WADPerformanceCounters"

enter image description here

: http://msdn.microsoft.com/en-us/library/windowsazure/dn186185.aspx

+3

#, , , . (): MS:

        try
        {
            long bytes = GC.GetTotalMemory(false);

            return "RAM used: " + (bytes/1024/1024).ToString() + " MB";
        }
        catch (Exception ex)
        {
          return "No RAM info available!";
        }
0

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


All Articles