Your SlideShare is downloading. ×
Marlabs - Elastic scalability Azure v1 0
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Marlabs - Elastic scalability Azure v1 0

880
views

Published on

Improving Operational Agility and Efficiency involved in Load …

Improving Operational Agility and Efficiency involved in Load
Balancing and Scaling using Windows Azure

- by Marlabs Cloud and Mobile CoE.

Published in: Technology, Business

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
880
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. ImprovingOperational Agilityand Efficiencyinvolved in LoadBalancing and Scalingusing WindowsAzure Cloud & 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
  • 2. Improving Operational Agility and Efficiency involved in Load 1 Balancing and Scaling using Windows AzureCloud & Mobile COE, Marlabs Version 1.0 http://www.marlabs.com
  • 3. Improving Operational Agility and Efficiency involved in Load 2 Balancing and Scaling using Windows AzureTable of ContentsIntroduction .................................................................................................................................................. 3The 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 .......................................................................................................................................... 5Windows Azure Autoscaling Application Block (WASABi) ............................................................................ 5 Major functionalities of Windows Azure .................................................................................................. 5 Instance Scaling..................................................................................................................................... 5 Throttling .............................................................................................................................................. 5 Notifying................................................................................................................................................ 5 Custom action ....................................................................................................................................... 5Adding Autoscaling Application Block to Host Application........................................................................... 6Hosting 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 ....................................................................... 12Windows Azure Compute Resources to Host Autoscaling Application Block............................................. 13
  • 4. Improving Operational Agility and Efficiency involved in Load 3 Balancing and Scaling using Windows AzureIntroductionCloud computing is the set of technologies and infrastructure capabilities being offered in a servicebased consumption model. Windows Azure is Microsoft’s Cloud computing offering to build and deployapplications on a Pay-per-use basis. Cloud computing with Microsoft Windows Azure platform lets thecustomers to focus on delivering services to their customers rather than managing technologyinfrastructure. One of the key benefits of using Cloud computing is the ability for on-demand scalabilityof the applications deployed in Cloud. Dynamic provision for load balancing and scaling can dramaticallyreduce operational overheads, time, and costs and can improve efficiency of the applications deployedover the Cloud. Microsoft’s patterns & practices team is providing an Auto Scaling solution for WindowsAzure that will provides dynamic provision for auto scaling based on the rules defined by the users forthe 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 onuser-defined policies, Key Performance Indicators (KPI), health status checks, and schedules. If yourapplication needs more computing power, you can launch additional compute instances on-demand anduse them for as long as you want, and then terminate them when they are no longer needed.The Business Need for Auto ScalingAuto Scaling is an extremely important service when we are building cloud based applications. Sincecloud computing is a pay-per-use utility service and provides on-demand scalability, dynamicprovisioning for scale up and scale down of cloud resources are very important functionality for cloudbased applications. Dynamic provisioning for auto scaling can provide better scalability and can alsoguard organizational budget for cloud deployments. Auto Scaling balances between costs andperformance to business organizations when they are moving to cloud.Example Scenarios for Auto ScalingThe following are the few example scenarios where Auto Scaling service can provide business values.
  • 5. Improving Operational Agility and Efficiency involved in Load 4 Balancing and Scaling using Windows Azure  You can instruct the Auto Scaling service to launch an additional compute instances whenever CPU usage is high for a pre-defined time.  You can instruct the Auto Scaling service to terminate few compute instances whenever CPU usage is low for a pre-defined time.  You can instruct the Auto Scaling service to terminate few compute instances over the weekend when traffic is expected to be low.  You can instruct the Auto Scaling service to launch an additional compute instances over the evening time of week days when traffic is expected to be high.  You can instruct the Auto Scaling service to launch an additional compute instances when messages on your application’s queue service is very high.  You can configure the Auto Scaling service for receiving email notifications whenever compute usage is very high or low.The above conditions are just few example scenarios, but the Auto Scaling can provide business valuesto 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. AutoScaling will help the enterprises to save both time and money and can improve business agility. AutoScaling is a ‘must have’ service when organizations are moving their applications onto Cloud.Major benefits of using Auto ScalingThe following are the key features and benefits of using an Auto Scaling serviceOperational 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 itwhen usage drops.Guard the BudgetOrganizations can guard their financial budget for C loud based applications. They can define and controlthe number of computing instances using well defined conditions.Cost SavingsAuto Scaling service can save usage costs of compute resources by terminating underused instancesautomatically and launching new instances when applications need more compute resources.
  • 6. Improving Operational Agility and Efficiency involved in Load 5 Balancing and Scaling using Windows AzureNotificationsThe Auto Scaling service can also use for receiving notifications and alerts about the load situations andhealth statuses.Windows Azure Autoscaling Application Block (WASABi)The Windows Azure Autoscaling Application Block (WASABi) lets the cloud developers to add andmanage automatic scaling behavior to Windows Azure applications that provides all the functionalityneeded to define and monitor autoscaling behavior in a Windows Azure application or a group ofWindows Azure applications. The Windows Azure Autoscaling Application Block is a part of the MicrosoftEnterprise Library provided by the Microsoft patterns & practices team. The Windows Azure AutoscalingApplication Block can automatically scale Windows Azure applications based on the rules defined inconfiguration files specifically for the hosted Windows Azure application. The block will read the rulesand monitor Windows Azure applications and scale-up or scale-down the applications based on therules. The Autoscaling Application Block can be hosted on a Windows Azure worker role application or inan on-premises application. The Enterprise Library provides a GUI based configuration tool that can beused for edit configuration settings for the Autoscaling Application Block.Major functionalities of Windows AzureThe following are the key functionalities of Autoscaling Application BlockInstance Scaling The Autoscaling Application Block varies the number of role instances in order to accommodatevariations in the load on the application. Instance scaling actions can span multiple hostservices/subscriptions.ThrottlingInstead of spinning off new instances, the block limits or disables certain expensive operations in yourapplication when the load is above certain thresholds.NotifyingInstead of performing instance scaling or throttling, the user may elect to simply receive notificationsabout the load situations with no automatic scaling taking place.Custom actionWe can build extensions using the extensibility features provided by Autoscaling Application Block.
  • 7. Improving Operational Agility and Efficiency involved in Load 6 Balancing and Scaling using Windows AzureAdding Autoscaling Application Block to Host ApplicationThe Autoscaling Application Block is available as a NuGet package .The following steps will add theAutoscaling Application Block onto your host application.1. Add a reference to the Autoscaling Application Block assembly. In Microsoft Visual Studio, right-clickyour 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 Block –Beta 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 touse the Autoscaling Application Block. The NuGet package will also add the XML schema files for theautoscaling rule definitions and autoscaling service information.
  • 8. Improving Operational Agility and Efficiency involved in Load 7 Balancing and Scaling using Windows AzureHosting the Autoscaling Application Block in a Windows AzureWorker RoleAutoscaling Application Block needs a host to run. The Autoscaling Application Block can be hosted on aWindows Azure worker role application or in an on-premises application. The following step by stepinstructions will help you to host the Autoscaling Application Block onto Windows Azure Worker Role.Instantiate and Run the ScalerThe following steps will instantiate and run the Autoscaling Application Block in a Windows AzureWorker Role.Import NamespacesImport the following namespaces to the Worker Role classusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;using Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling;Resolve an instance of Autoscaler classThe Autoscaler class is the main entry point for the Autoscaling Application Block from your hostapplication. The following code block instantiates the Autoscaler class and call its start method formonitoring the Autoscaling behavior.Autoscaler scaler = EnterpriseLibraryContainer.Current.GetInstance<Autoscaler>();scaler.Start();The following code block shows implementation of Worker Role class public class WorkerRole : RoleEntryPoint { private Autoscaler autoscaler; public override void Run() { autoscaler = EnterpriseLibraryContainer.Current.GetInstance<Autoscaler>(); autoscaler.Start(); while (true) { Thread.Sleep(10000); Trace.WriteLine("Working", "Information"); } }
  • 9. Improving Operational Agility and Efficiency involved in Load 8 Balancing and Scaling using Windows Azure public override bool OnStart() { // *** AzureAutoScale-Start *** //Set Max number of concurrent connections ServicePointManager.DefaultConnectionLimit = 12; DiagnosticMonitorConfiguration dmc = DiagnosticMonitor.GetDefaultInitialConfiguration(); dmc.Logs.BufferQuotaInMB = 4; dmc.Logs.ScheduledTransferPeriod = TimeSpan.FromSeconds(30); dmc.Logs.ScheduledTransferLogLevelFilter = LogLevel.Verbose; DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", dmc); // *** AzureAutoScale-End *** return base.OnStart(); } }When you call the Start method of the Autoscaler class, the block will look for rule and serviceinformation, and will start to monitor hosted services and will perform the auto scaling based on therules defined in the rule store.Edit Autoscaling Application Block ConfigurationYou can add ad edit the Autoscaling application block configuration using Enterprise LibraryConfiguration tool. To install the Enterprise Library Configuration tool, do the following steps1. 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, typeEnterprise Library Config.3. Make sure that you can see version 5.0.505 of the EnterpriseLibrary.Config package. Then click theDownload 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, rightclick on the app.config file in the project that will be hosting the block and click Edit configuration file.
  • 10. Improving Operational Agility and Efficiency involved in Load 9 Balancing and Scaling using Windows AzureIn the Enterprise Library Configuration tool, open the Blocks menu, and then click Add AutoscalingSettings.
  • 11. Improving Operational Agility and Efficiency involved in Load 10 Balancing and Scaling using Windows AzureThe enterprise library configuration tool allows editing Autoscaling settings, Rule store information andthe Service information store. The Rule Store settings contain the storage information about Rulesconfiguration file and the Service Information Store settings contain the storage information aboutService configuration file. Typically, if you host the Autoscaling Application Block in a worker role, youwill store the data points, rule definitions, and service information in Windows Azure storage.
  • 12. Improving Operational Agility and Efficiency involved in Load 11 Balancing and Scaling using Windows AzureAuthor Rule Configuration FileThe rule configuration file contains the rules that will be used for the scaler to scale up and scale downthe 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 rulesare associated with KPI and conditions. The below code block shows the sample rule configuration whichcontains both constraint rules and reactive rules. <?xml version="1.0" encoding="utf-8"?><rules xmlns="http://schemas.microsoft.com/practices/2011/entlib/autoscaling/rules"> <constraintRules> <rule name="default" description="default" rank="1" enabled="true"> <actions> <range target="WebRole1" min="1" max="4"/> </actions> </rule> <rule name="peakbusinesstime" enabled="true" rank="100"> <timetable duration="02:00:00" startTime="13:26:00" utcOffset="-07:00"> <weekly days ="Friday"/> </timetable> <actions> <range target="WebRole1" min="4" max="8"/> </actions> </rule> </constraintRules> <reactiveRules> <rule name="Too Much CPU" enabled="true"> <when> <greaterOrEqual operand="CPU_Last_15Minutes" than="60"/> </when> <actions> <scale target="WebRole1" by="2" /> </actions> </rule> <rule name="Too Less CPU" enabled="true"> <when> <lessOrEqual operand="CPU_Last_15Minutes" than="30"/> </when> <actions> <scale target="WebRole1" by="-2" /> </actions> </rule> </reactiveRules> <operands> <performanceCounter alias="CPU_Last_15Minutes" performanceCounterName="Processor(_Total)% Processor Time" source="HighCPUWorkerRole" aggregate="Average" timespan="00:15:00"/></operands></rules>
  • 13. Improving Operational Agility and Efficiency involved in Load 12 Balancing and Scaling using Windows AzureThe above rule configuration contains two constraint rules – a default rule and a rule for peak businesstime 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.Author Service Configuration FileThe service configuration file contains the information for Windows Azure subscriptions and hostedservice(s) to monitoring for auto scaling. This tells the Scaler that which hosted service(s) shouldmonitor. The below code blocks show the sample service configuration file.<?xml version="1.0" encoding="utf-8" ?><serviceModel xmlns="http://schemas.microsoft.com/practices/2011/entlib/autoscaling/serviceModel"> <subscriptions> <subscription name="something" subscriptionId="b5fb8dfb-3e0b-xxxx-xxxx-xxxxxxxxxxxx" certificateStoreLocation="LocalMachine" certificateStoreName="My" certificateThumbprint="FE5EB4279BC6354xxxxxxxxxxxxxxxxxxxxxxxxx"> <services> <service name="myHostedServiceName" slot="Staging"> <roles> <role name="WebRole1" roleName="WebRole1" wadStorageAccountName="wadStorageAccount"/> </roles> </service> </services> <storageAccounts> <storageAccount name="wadStorageAccount" connectionString="DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=123xxxxxxxxx"> </storageAccount> </storageAccounts> </subscription> </subscriptions></serviceModel>Quick Steps to Add and Use Autoscaling Application BlockThe 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 Autoscaler class 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.
  • 14. Improving Operational Agility and Efficiency involved in Load 13 Balancing and Scaling using Windows Azure 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 to monitoring the Autoscaling Application Block.Windows Azure Compute Resources to Host AutoscalingApplication BlockThe 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.ConclusionWindows Azure is Microsoft’s offering for Cloud computing to help customers to build and deployapplications on a Pay-per-use basis and providing on-demand scalability. This allows the customers tofully focus on their applications rather than managing IT infrastructure. The Windows Azure AutoscalingApplication Block lets the Windows Azure customers to take full advantage of scalability offeringsprovided by Windows Azure. This enables the customers to reduce number of management overheadsinvolved load balancing and scaling which will improve the business agility and can also reduce cost andtime.LinksWindows Azure - http://www.microsoft.com/windowsazure/Microsoft Patterns & Practice - http://entlib.codeplex.com/

×