elastic scalability azurev1 0

Upload: marlabs

Post on 06-Apr-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/3/2019 Elastic Scalability AzureV1 0

    1/14

    ImprovingOperational Agility

    and Efficiency

    involved in LoadBalancing and Scaling

    using Windows

    AzureCloud & Mobile COE, Marlabs

    Auto scaling is a way to automatically scale up or down the

    number of compute resources based on user-defined

    policies, Key Performance Indicators (KPI), health status

    checks, and schedules. If your application needs more

    computing power, you can launch additional compute

    instances on-demand and use them for as long as you want,

    and then terminate them when they are no longer needed

  • 8/3/2019 Elastic Scalability AzureV1 0

    2/14

    Improving Operational Agility and Efficiency involved in Load

    Balancing and Scaling using Windows Azure1

    Cloud & Mobile COE, Marlabs

    Version 1.0

    http://www.marlabs.com

    http://www.marlabs.com/http://www.marlabs.com/http://www.marlabs.com/
  • 8/3/2019 Elastic Scalability AzureV1 0

    3/14

    Improving Operational Agility and Efficiency involved in Load

    Balancing and Scaling using Windows Azure2

    Table of Contents

    Introduction .................................................................................................................................................. 3

    The Business Need for Auto Scaling .............................................................................................................. 3

    Example Scenarios for Auto Scaling .......................................................................................................... 3

    Major benefits of using Auto Scaling ........................................................................................................ 4

    Operational Agility ................................................................................................................................ 4

    Elastic Scalability ................................................................................................................................... 4

    Guard the Budget .................................................................................................................................. 4

    Cost Savings .......................................................................................................................................... 4

    Notifications .......................................................................................................................................... 5

    Windows Azure Autoscaling Application Block (WASABi) ............................................................................ 5

    Major functionalities of Windows Azure .................................................................................................. 5

    Instance Scaling ..................................................................................................................................... 5

    Throttling .............................................................................................................................................. 5

    Notifying ................................................................................................................................................ 5

    Custom action ....................................................................................................................................... 5

    Adding Autoscaling Application Block to Host Application........................................................................... 6

    Hosting the Autoscaling Application Block in a Windows Azure Worker Role ............................................. 7

    Instantiate and Run the Scaler .................................................................................................................. 7

    Import Namespaces .............................................................................................................................. 7

    Resolve an instance of Autoscaler class ................................................................................................ 7

    Edit Autoscaling Application Block Configuration..................................................................................... 8

    Author Rule Configuration File ............................................................................................................... 11

    Author Service Configuration File ........................................................................................................... 12Quick Steps to Add and Use Autoscaling Application Block ....................................................................... 12

    Windows Azure Compute Resources to Host Autoscaling Application Block............................................. 13

  • 8/3/2019 Elastic Scalability AzureV1 0

    4/14

    Improving Operational Agility and Efficiency involved in Load

    Balancing and Scaling using Windows Azure3

    Introduction

    Cloud computing is the set of technologies and infrastructure capabilities being offered in a service

    based consumption model. Windows Azure is Microsofts Cloud computing offering to build and deploy

    applications on a Pay-per-use basis. Cloud computing with Microsoft Windows Azure platform lets the

    customers to focus on delivering services to their customers rather than managing technology

    infrastructure. One of the key benefits of using Cloud computing is the ability for on-demand scalability

    of the applications deployed in Cloud. Dynamic provision for load balancing and scaling can dramatically

    reduce operational overheads, time, and costs and can improve efficiency of the applications deployed

    over the Cloud. Microsofts patterns & practices team is providing an Auto Scaling solution for Windows

    Azure that will provides dynamic provision for auto scaling based on the rules defined by the users for

    the applications scalability needs and organizational strategy.

    What is Auto Scaling?

    Auto scaling is a way to automatically scale up or down the number of compute resources based on

    user-defined policies, Key Performance Indicators (KPI), health status checks, and schedules. If your

    application needs more computing power, you can launch additional compute instances on-demand and

    use them for as long as you want, and then terminate them when they are no longer needed.

    The Business Need for Auto Scaling

    Auto Scaling is an extremely important service when we are building cloud based applications. Since

    cloud computing is a pay-per-use utility service and provides on-demand scalability, dynamic

    provisioning for scale up and scale down of cloud resources are very important functionality for cloud

    based applications. Dynamic provisioning for auto scaling can provide better scalability and can also

    guard organizational budget for cloud deployments. Auto Scaling balances between costs and

    performance to business organizations when they are moving to cloud.

    Example Scenarios for Auto Scaling

    The following are the few example scenarios where Auto Scaling service can provide business values.

  • 8/3/2019 Elastic Scalability AzureV1 0

    5/14

    Improving Operational Agility and Efficiency involved in Load

    Balancing and Scaling using Windows Azure4

    You can instruct the Auto Scaling service to launch an additional compute instances wheneverCPU usage is high for a pre-defined time.

    You can instruct the Auto Scaling service to terminate few compute instances whenever CPUusage is low for a pre-defined time.

    You can instruct the Auto Scaling service to terminate few compute instances over the weekendwhen traffic is expected to be low.

    You can instruct the Auto Scaling service to launch an additional compute instances over theevening time of week days when traffic is expected to be high.

    You can instruct the Auto Scaling service to launch an additional compute instances whenmessages on your applications queue service is very high.

    You can configure the Auto Scaling service for receiving email notifications whenever computeusage is very high or low.

    The above conditions are just few example scenarios, but the Auto Scaling can provide business values

    to many situations based on the behavior of your applications and the organizational strategy. This canreduce lot of manual tasks involved in load balancing and scaling and can staying on budget. Auto

    Scaling will help the enterprises to save both time and money and can improve business agility. Auto

    Scaling is a must have service when organizations are moving their applications onto Cloud.

    Major benefits of using Auto Scaling

    The following are the key features and benefits of using an Auto Scaling service

    Operational AgilityAuto Scaling service can reduces lot of manual tasks involved in load balancing and scaling which willenables the overall operational agility and better productivity.

    Elastic ScalabilityAuto Scaling service can dynamically add compute resources when application usage rises and remove it

    when usage drops.

    Guard the BudgetOrganizations can guard their financial budget for C loud based applications. They can define and control

    the number of computing instances using well defined conditions.

    Cost SavingsAuto Scaling service can save usage costs of compute resources by terminating underused instances

    automatically and launching new instances when applications need more compute resources.

  • 8/3/2019 Elastic Scalability AzureV1 0

    6/14

    Improving Operational Agility and Efficiency involved in Load

    Balancing and Scaling using Windows Azure5

    NotificationsThe Auto Scaling service can also use for receiving notifications and alerts about the load situations and

    health statuses.

    Windows Azure Autoscaling Application Block (WASABi)

    The Windows Azure Autoscaling Application Block (WASABi) lets the cloud developers to add and

    manage automatic scaling behavior to Windows Azure applications that provides all the functionality

    needed to define and monitor autoscaling behavior in a Windows Azure application or a group of

    Windows Azure applications. The Windows Azure Autoscaling Application Block is a part of the Microsoft

    Enterprise Library provided by the Microsoft patterns & practices team. The Windows Azure Autoscaling

    Application Block can automatically scale Windows Azure applications based on the rules defined in

    configuration files specifically for the hosted Windows Azure application. The block will read the rules

    and monitor Windows Azure applications and scale-up or scale-down the applications based on the

    rules. The Autoscaling Application Block can be hosted on a Windows Azure worker role application or in

    an on-premises application. The Enterprise Library provides a GUI based configuration tool that can be

    used for edit configuration settings for the Autoscaling Application Block.

    Major functionalities of Windows Azure

    The following are the key functionalities of Autoscaling Application Block

    Instance Scaling

    The Autoscaling Application Block varies the number of role instances in order to accommodate

    variations in the load on the application. Instance scaling actions can span multiple host

    services/subscriptions.

    Throttling

    Instead of spinning off new instances, the block limits or disables certain expensive operations in your

    application when the load is above certain thresholds.

    NotifyingInstead of performing instance scaling or throttling, the user may elect to simply receive notifications

    about the load situations with no automatic scaling taking place.

    Custom action

    We can build extensions using the extensibility features provided by Autoscaling Application Block.

  • 8/3/2019 Elastic Scalability AzureV1 0

    7/14

    Improving Operational Agility and Efficiency involved in Load

    Balancing and Scaling using Windows Azure6

    Adding Autoscaling Application Block to Host Application

    The Autoscaling Application Block is available as aNuGet package.The following steps will add the

    Autoscaling Application Block onto your host application.

    1. Add a reference to the Autoscaling Application Block assembly. In Microsoft Visual Studio, right-click

    your project node in Solution Explorer, and then click Manage NuGet Packages.

    2. Click the Online button, and then in the Search Online box, type WASABi.

    3. Click the Install button for the Enterprise Library 5.0 Windows Azure Autoscaling Application BlockBeta package.

    4. Read and accept the license terms for the packages listed.

    The NuGet package will add the all necessary assemblies and references to your project that you need to

    use the Autoscaling Application Block. The NuGet package will also add the XML schema files for the

    autoscaling rule definitions and autoscaling service information.

    http://nuget.org/List/Packages/EnterpriseLibrary.WindowsAzure.Autoscaling.Previewhttp://nuget.org/List/Packages/EnterpriseLibrary.WindowsAzure.Autoscaling.Previewhttp://nuget.org/List/Packages/EnterpriseLibrary.WindowsAzure.Autoscaling.Previewhttp://nuget.org/List/Packages/EnterpriseLibrary.WindowsAzure.Autoscaling.Preview
  • 8/3/2019 Elastic Scalability AzureV1 0

    8/14

    Improving Operational Agility and Efficiency involved in Load

    Balancing and Scaling using Windows Azure7

    Hosting the Autoscaling Application Block in a Windows Azure

    Worker Role

    Autoscaling Application Block needs a host to run. The Autoscaling Application Block can be hosted on a

    Windows Azure worker role application or in an on-premises application. The following step by step

    instructions will help you to host the Autoscaling Application Block onto Windows Azure Worker Role.

    Instantiate and Run the Scaler

    The following steps will instantiate and run the Autoscaling Application Block in a Windows Azure

    Worker Role.

    Import Namespaces

    Import the following namespaces to the Worker Role class

    using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;

    using Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling;

    Resolve an instance of Autoscaler class

    The Autoscalerclass is the main entry point for the Autoscaling Application Block from your host

    application. The following code block instantiates the Autoscalerclass and call its start method for

    monitoring the Autoscaling behavior.

    Autoscaler scaler = EnterpriseLibraryContainer .Current.GetInstance();

    scaler.Start();

    The following code block shows implementation of Worker Role class

    publicclassWorkerRole : RoleEntryPoint

    {privateAutoscaler autoscaler;

    publicoverridevoid Run()

    {

    autoscaler = EnterpriseLibraryContainer .Current.GetInstance();

    autoscaler.Start();

    while (true)

    {Thread.Sleep(10000);

    Trace.WriteLine("Working", "Information");

    }}

  • 8/3/2019 Elastic Scalability AzureV1 0

    9/14

    Improving Operational Agility and Efficiency involved in Load

    Balancing and Scaling using Windows Azure8

    publicoverridebool OnStart(){

    // *** AzureAutoScale-Start ***

    //Set Max number of concurrent connectionsServicePointManager.DefaultConnectionLimit = 12;

    DiagnosticMonitorConfiguration dmc = DiagnosticMonitor.GetDefaultInitialC

    onfiguration();dmc.Logs.BufferQuotaInMB = 4;

    dmc.Logs.ScheduledTransferPeriod = TimeSpan.FromSeconds(30);

    dmc.Logs.ScheduledTransferLogLevelFilter = LogLevel.Verbose;DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.Conne

    ctionString", dmc);// *** AzureAutoScale-End ***

    returnbase.OnStart();}

    }When you call the Start method of the Autoscaler class, the block will look for rule and service

    information, and will start to monitor hosted services and will perform the auto scaling based on the

    rules defined in the rule store.

    Edit Autoscaling Application Block Configuration

    You can add ad edit the Autoscaling application block configuration using Enterprise Library

    Configuration tool. To install the Enterprise Library Configuration tool, do the following steps

    1. In Visual Studio, on the Tools menu, click Extension Manager.

    2. In the Extension Manager dialog, click Online Gallery, and then in the Search Online Gallery box, type

    Enterprise Library Config.

    3. Make sure that you can see version 5.0.505 of the EnterpriseLibrary.Config package. Then click the

    Download button.

    4. Read the license and then click Install.

    5. Click the Restart Now button to restart Visual Studio and complete the installation.

    To edit the Autoscaling application block configuration using Enterprise Library Configuration tool, right

    click on the app.config file in the project that will be hosting the block and click Edit configuration file.

  • 8/3/2019 Elastic Scalability AzureV1 0

    10/14

    Improving Operational Agility and Efficiency involved in Load

    Balancing and Scaling using Windows Azure9

    In the Enterprise Library Configuration tool, open the Blocks menu, and then click Add Autoscaling

    Settings.

  • 8/3/2019 Elastic Scalability AzureV1 0

    11/14

    Improving Operational Agility and Efficiency involved in Load

    Balancing and Scaling using Windows Azure10

    The enterprise library configuration tool allows editing Autoscaling settings, Rule store information and

    the Service information store. The Rule Store settings contain the storage information about Rulesconfiguration file and the Service Information Store settings contain the storage information about

    Service configuration file. Typically, if you host the Autoscaling Application Block in a worker role, you

    will store the data points, rule definitions, and service information in Windows Azure storage.

  • 8/3/2019 Elastic Scalability AzureV1 0

    12/14

    Improving Operational Agility and Efficiency involved in Load

    Balancing and Scaling using Windows Azure11

    AuthorRule Configuration File

    The rule configuration file contains the rules that will be used for the scaler to scale up and scale down

    the hosted service. There are two types of rules available in the Autoscaling Application Block -

    constraint rules and reactive rules. Constraint rules are associated with a time table and reactive rules

    are associated with KPI and conditions. The below code block shows the sample rule configuration which

    contains both constraint rules and reactive rules.

  • 8/3/2019 Elastic Scalability AzureV1 0

    13/14

    Improving Operational Agility and Efficiency involved in Load

    Balancing and Scaling using Windows Azure12

    The above rule configuration contains two constraint rules a default rule and a rule for peak business

    time on every Fridays. The rank specified in the rule configuration is just a priority for each role. The

    utcOffset value is using to convert the configured local time to UTC time using by the Windows Azure.

    The reactive rules contain the rules for KPI based on the CPU utilization.

    AuthorService Configuration File

    The service configuration file contains the information for Windows Azure subscriptions and hosted

    service(s) to monitoring for auto scaling. This tells the Scaler that which hosted service(s) should

    monitor. The below code blocks show the sample service configuration file.

    Quick Steps to Add and Use Autoscaling Application Block

    The following are the major quick steps to add and use Autoscaling Application Block

    1. Add a reference to Autoscaling Application Block in host application.2. Instantiates the Autoscalerclass and call its start method for monitoring.3. Edit app.config file of the host application using Enterprise Library configuration tool.4. Configure the Autoscaling settings.

  • 8/3/2019 Elastic Scalability AzureV1 0

    14/14

    Improving Operational Agility and Efficiency involved in Load

    Balancing and Scaling using Windows Azure13

    5. Configure the Rule Store settings to specify the storage information of Rules configuration file.6. Configure the Service Information Store to specify the storage information of Service

    information configuration file.

    7. Add Rules configuration XML file to specify the rules and conditions for scaling.8. Add Service information XML file to specify Windows Azure subscription and hosted services tomonitoring the Autoscaling Application Block.

    Windows Azure Compute Resources to Host Autoscaling

    Application Block

    The following compute resources are the essential components to host Autoscaling block

    1. Windows Azure hosted service for Worker Role to host Autoscaling block.2. BLOB storage account for store rule configuration and service information configuration.

    Conclusion

    Windows Azure is Microsofts offering for Cloud computing to help customers to build and deploy

    applications on a Pay-per-use basis and providing on-demand scalability. This allows the customers to

    fully focus on their applications rather than managing IT infrastructure. The Windows Azure Autoscaling

    Application Block lets the Windows Azure customers to take full advantage of scalability offerings

    provided by Windows Azure. This enables the customers to reduce number of management overheads

    involved load balancing and scaling which will improve the business agility and can also reduce cost and

    time.

    Links

    Windows Azure -http://www.microsoft.com/windowsazure/

    Microsoft Patterns & Practice -http://entlib.codeplex.com/

    http://www.microsoft.com/windowsazure/http://www.microsoft.com/windowsazure/http://www.microsoft.com/windowsazure/http://entlib.codeplex.com/http://entlib.codeplex.com/http://entlib.codeplex.com/http://entlib.codeplex.com/http://www.microsoft.com/windowsazure/