Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to view/report on Windows Azure CPU and Memory usage?

What's the easiest method of viewing and reporting on the CPU and Memory usage percentage statistics on all the server instances hosting an application on Windows Azure?

Is it necessary to write a Worker Role that monitors and logs the CPU and Memory usage? Or, is there something in Windows Azure that automatically logs this that you can just tap into? If something custom needs to be built, what is the best method to do so?

like image 759
Chris Pietschmann Avatar asked Oct 06 '11 19:10

Chris Pietschmann


People also ask

How do I see CPU usage and memory?

Press CTRL + Shift + Esc to open Task Manager. Click the Performance tab. This tab displays your system's RAM, CPU, GPU, and disk usage, along with network info. To view RAM usage, select the Memory box.

How do I check memory utilization Azure?

You can set up alerts for memory usage of an Azure VM by using Azure Monitor and run queries in Log Analytics Workspace.


2 Answers

Sounds like a job for Windows Azure Diagnostics. The basic idea is (a) you enable diagnostics in your role code to govern the types of diagnostics you wish to gather, (b) this diagnostics data is collected on your behalf by an agent that runs on each deployed instance, and (c) the agents send each type of data to a defined location so that the data across all deployed instances is in the same place (which will be in Azure Blob Storage or Azure Tables Storage, whichever is a more natural fit, depending on the nature of the data).

General Documentation here, and specifics on Performance Counters (for memory and CPU) are here. General "how to" writeup on Neil's blog.

It is not necessary to write a special Worker Role for this, and no custom code required (other than the small boilerplate code to specify what it is you wish to gather logging about).

like image 86
codingoutloud Avatar answered Oct 11 '22 12:10

codingoutloud


Yes there is built in functionality for logging out performance counters to table storage. There are plenty of articles out there which cover this, but this seems to be the jumping off point on MSDN.

The short overview is that you can set them up performance counters in code when your role starts or if you don't want diagnostics running all the time you can change your settings remotely. On a scheduled basis the logged performance counters get copied to the WADPerformanceCountersTable in the azure storage account you specified. From there you can query it yourself or you can use a commercial tool like Cerebrata Diagnostics Manager which will draw graphs for you like you're used to seeing in Windows (and lots of other things related to diagnostics in Azure)

like image 34
knightpfhor Avatar answered Oct 11 '22 13:10

knightpfhor