The Performance Counter Collection Process

Retired Content

This content and the technology described is outdated and is no longer being maintained. For more information, see Transient Fault Handling.

patterns & practices Developer Center

Reactive rules can use performance counter data as operands, enabling the block to scale an application based on the performance counter data it collects from the web and worker roles in the application. This topic describes how the performance counter data collection process ensures that the reactive rules always have the most up-to-date available values of the performance counters.

The following list summarizes the key steps in the process.

  1. Your web or worker role collects a performance counter value.
  2. Microsoft Azure transfers the performance counter values to persistent storage—the WADPerformanceCountersTable table in Azure storage.
  3. The Autoscaling Application Block collects the performance counter data values that the reactive rules use from the WADPerformanceCountersTable table, and aggregates the values.
  4. The Autoscaling Application Block saves the aggregated performance counter values to the AutoscalerDatapoints table in Azure storage.
  5. The rules evaluator component reads the data points that it needs to evaluate the reactive rule operands from the AutoscalerDatapoints table.

Typically, you add code to the WebRole or WorkerRole of your application to perform steps 1 and 2. The example code in the topic "Collecting Performance Counter Data" shows how to transfer the CPU utilization performance counter values to persistent storage every minute.

In step 3, the block reads all the performance counter values that Azure has added to the WADPerformanceCountersTable table since the last time the block read performance counter data from the WADPerformanceCountersTable table. The following example explains this process in more detail.

The block collects data from the WADPerformanceCountersTable table at 15:20:20. The following table shows the data retrieved from the WADPerformanceCountersTable table at this time.

Role instance

Performance counter value

Time the performance counter value was collected

Time the performance counter value was saved

1

10

15:16:24

15:20:00

1

20

15:17:24

15:20:00

1

30

15:18:24

15:20:00

1

40

15:19:24

15:20:00

2

15

15:17:00

15:19:30

2

25

15:18:00

15:19:30

2

35

15:19:00

15:19:30

The Autoscaling Application Block samples the performance counter data every two minutes, so in this example it must calculate an average value for the performance counter every two minutes. It does this by sorting the collected values into buckets, and then averaging the bucket contents. It labels the buckets by using the time at the mid-point of the bucket. The following table shows the contents of the two buckets created from the data in the previous table.

Bucket ID

Performance counter values

Average counter value

15:17:00

10, 20, 15

15

15:19:00

30, 40, 25, 35

32.5

The block writes the average counter values to the AutoscalerDatapoints table (step 4).

The block next collects data from the WADPerformanceCountersTable table at 15:22:20. The following table shows the data retrieved from the WADPerformanceCountersTable table at this time.

Role instance

Performance counter value

Time the performance counter value was collected

Time the performance counter value was saved

1

5

15:19:48

15:22:10

1

10

15:20:24

15:22:10

1

20

15:21:24

15:22:10

2

15

15:20:00

15:21:30

2

35

15:21:00

15:21:30

The following table shows the contents of the two buckets created from the data in the previous table.

Bucket ID

Performance counter values

Average counter value

15:19:00

5

5

15:21:00

10, 20, 15, 35

20

The first bucket (15:19:00) has already been written to the AutoscalerDatapoints table, so the block must replace the existing value in the table with an adjusted value. The block saves a value of 27 to this bucket ((30 + 40 +25 + 35 +5)/5).

This process means that the autoscaling rules always work with the most up-to-date version of performance counter values (step 5), and that the block updates these values as new data becomes available.

Next Topic | Previous Topic | Home

Last built: June 7, 2012