ict.ken.be

Delivering solid user friendly software solutions since the dawn of time.

WASABi Elastic Azure Scaling

Categories: Azure Notes

Notes on Azure Elastic Scaling by Zoiner Tejada. This is again one of these PluralSight courses, where only the sample project is worth the membership to the site. Get it there. Check also: Channel 9 Autoscaling in Windows Azure 2013

Dodging the 503 server busy response

Scale for performance, capacity & availability
vs
Costs of over-allocating (Ideally paying for exactly what is needed)

Scale out/in: adding/removing number of instances

Scale up/down: increasing/decreasing the power of resources

Database can be scaled out by sharding with federations

Elastic Scale: The ability to adjust resources according to demand.

Scaling vs Throttling

Things needed to allow automating scaling

  • Build tooling to monitor cloud service's key performance
  • Use the Windows Azure Service Management API from your code
  • Collect diagnostics
  • Maximize clock hour use in scaling decisions
  • Send admins notification
  • Manage cool down periods between scaling actions

WASABi

WASABi diagram of components

Autoscaler

  • Metronome: collects kpi data
  • Scaler + Stabilizer: manage scale and notifications
  • Tracker: log outcome of actions

Using WASABi

  1. Add reference to WASABI library from your project 
  2. Nuget: Autoscaling Application BLock
  3. Instantiate Autoscaler in code : var autoscaler = EnterpriseLibraryContainer.Current.GetInstance<Autoscaler>(); autoscaler.Start();
  4. Configure App, Service Information Store and Rules Store
  5. Deploy and run

Rule Evaluation
Contstraint rules over Reactive rules
Rule with highest integer rank wins
Intelligent scaling action on tie breaking

ServiceInfo.xml
Scale and/or notifications
Stabilizer ScaleUpOnlyInFirstMinutesOfHour
Stabilizer ScaleDownOnlyInLastMintesOfHour

WASABi in Azure
Management Certificate
makecert -sky exchange -r -n "CN=<CertificateName>" -pe -a sha1 -len 2048 -ss My"<CertificateName>.cer"
via azure portal, settings, mgmt certs, upload
backup .pfx with password
export via mmc, certs snap-in, personal, export
put public and private key on machine running autoscaler

Add WASABi nuget
Add Enterprise Library config nuget

Update app.config (right-click)
point to Rules.xml
point to ServiceInfo.xml
add smtp info

Update ServiceInfo.xml
Make sure you save as utf-8 without signature!
Add xsd to schema
Update subscription
Update service
Update roles
Update stabilizer

Update Rules.xml
ConstraintRules eg. ScaleTargetHost min="2" max="6"
ReactiveRules eg. greaterOrEqual operand="averageCPU" than="30"
Operands eg. alias="averageCPU" performanceCOunterName="..."

Update diagnostics.wadcfg
eg. PerformaceCounters scheduledTransferPeriod="PT1M"

Pubish Web Role and Run Web Worker Autoscaler

Custom Operands
When performance counters, queue length or instance count aren't enough
For use by reactive rules only
eg. Queue msg depth, number of files in blob, business tickets, ...
Extend DataPointsParametersElement using IDataPointsCollector

Custom Actions
When adjusting instance count or changing settings isn't enough
eg. change role instance size, scale vm website db storage, send sms messages
Extend ReactiveRuleActionElement using instance of ReactiveRuleAction
Remember to put in your custom namespaces (xmlns="http://myfoo")