Dela via


Hosting the Autoscaling Application Block in an On-Premises Application

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

On this page:
Usage Notes

This topic describes how to host the Autoscaling Application Block in a standalone on-premises application. This scenario is useful when you are testing and debugging your autoscaling solution. It is also useful if you need to integrate your autoscaling solution with existing on-premises applications such as a logging utility.

The Autoscaling Application Block uses rules to determine what scaling operations it should perform on your Microsoft Azure application and when. You must have a running Autoscaler instance that can perform the scaling operations. The following code sample shows how you can start an Autoscaler instance running in a simple console application.

using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling;

namespace AutoScalingConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {

                Autoscaler scaler = 
                 EnterpriseLibraryContainer.Current.GetInstance<Autoscaler>();
                scaler.Start();
                while (true)
                {
                    System.Threading.Thread.Sleep(10000);
                    Console.WriteLine("running");
                }
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp.Message);
                Console.Write(exp.StackTrace);
            }
            Console.ReadKey();
        }
    }
}

Note

When you call the Start method of the Autoscaler class, the block attempts to read and parse the rules in your rules store. If any error occurs during the reading and validation of the rules, the block will log the exception with a "Rules store exception" message and continue. You should correct the error condition identified in the log message and save a new version of the rules to your rules store. The block will automatically attempt to load your new set of rules.

To understand and troubleshoot the block's behavior, you must use the log messages that the block writes. To ensure that the block can write log messages, you must configure logging for the host application. By default, the block uses the logging infrastructure from the System.Diagnostics namespace. The block can also use the Enterprise Library Logging Application Block or a custom logger.

For more information about how to configure the System.Diagnostics namespace logger or the Enterprise Library Logging Application Block logger, see the topic "Autoscaling Application Block Logging."

For more information about how to select the logging infrastructure that the Autoscaling Application Block should use, see the topic "Entering Configuration Information."

Usage Notes

Here is some additional information:

  • If you are running the Autoscaling Application Block in a console application, you must ensure that you configure the block with details of your Microsoft Azure application. You must run your Azure application in Azure to test the autoscaling behavior because the local Compute Emulator does not support the Azure Service Management API.

  • If you are running the Autoscaling Application Block in a console application, you must ensure that the block can access the service information store and the rules store. You can configure the block to use local file system stores for the rules store and the service information store.

  • If you are running the Autoscaling Application Block in a console application, you must host the data points store in Azure storage.

    Note

    The block uses the upsert feature of Azure table storage that is not supported by the local storage emulator.

  • If you are running the Autoscaling Application Block in a console application, you must ensure that you have the management certificate for the target application installed in the local certificate store and accessible to the application hosting the block. The service information model must correctly identify this certificate by thumbprint and location.

For more information about how to configure the block, see the topic "Entering Configuration Information."

Next Topic | Previous Topic | Home

Last built: June 7, 2012