2012.04.03 - introduzione a windows azure - public
DESCRIPTION
Si sente parlare di Cloud Computing sempre più insistentemente. È ora di capire cos’è, come funziona, quanto costa, quali sono i vantaggi e gli svantaggi, e quali sono le competenze da acquisire per portare le nostre applicazioni ASP.NET sul Cloud. Anche se in parte si parla di ASP.NET, non è solo una sessione per programmatori... Queste slides provengono dal Windows Azure Training Kit (http://www.microsoft.com/download/en/details.aspx?id=8396)TRANSCRIPT
Introductionto Windows Azure
Marco [email protected] Windows Azure Training Kit - January Refresh
http://www.microsoft.com/download/en/details.aspx?id=8396
Windows Azure SDK for .NET - November 2011http://
www.microsoft.com/download/en/details.aspx?id=28045
Disclaimer
if (!changs.Any()) Application.Exit(0);
No Mind Change?
if (business_plan == null) Application.Exit(0);
No Business Plan?
if (credit_card == null) Application.Exit(0);
No Credit Card?
Let’s talk about Deployment
On Premise DeploymentPrivate HostingOne Time Rate
OverprovisionedServices with micro seasonality trends Peaks due to periodic increased demandWasted capacity
ScenarioPatterns
Com
pute
«Classic» Web DeploymentPublic HostingPeriodical, Fixed Rate
UnderprovisionedServices with micro seasonality trends Peaks due to periodic increased demandIT complexity and wasted capacity
ScenarioPatterns
Com
pute
What’s the Problem?
Some apps run too slowly on a single computerSplitting them up into chunks, then running those chunks in parallel on multiple computers can speed them up
Doing this effectively requires creating a compute cluster, with:Tools to create and manage the clusterA scheduler to keep the cluster busy running apps
Cloud DeploymentPrivate or PublicPay as you go
Time
Dem
an
dWhat is a “Cloud”?
Cloud: on-demand, scalable, multi-tenant, self-service compute and storage resources
TimeD
em
an
d
Server Provisioning Cloud Provisioning
OverprovisionedUnderprovisioned
Aperiodical Events
ScenarioPatterns
Marketing On-Time OfferAperiodical Dues
Special Event
Unpredictable BurstingUnexpected/unplanned peak in demand Sudden spike impacts performance Can’t over provision for extreme cases
Com
pute
Average Usage
Periodical Events
ScenarioPatterns
Marketing Periodical OfferPeriodical Dues
Special Repeatable Events
Predictable BurstingServices with micro seasonality trends Peaks due to periodic increased demandIT complexity and wasted capacity
Com
pute
Technical Computing
ScenarioPatterns
UsageCom
pute
Average
Inactivity
Period
On and OffOn & off workloads (e.g. batch job)Over provisioned capacity is wasted Time to market can be cumbersome
Digital media rendering and encodingFinancial and insurance risk calculation
Engineering modeling and simulationComputational life sciences
Earth sciencesData analytics
Succesful Service
ScenarioPatterns
Social MediaWeb Games
Growing FastSuccessful services needs to grow/scale Keeping up w/ growth is big IT challenge Cannot provision hardware fast enough
Average Usage
Com
pute
Cloud Services
Cloud Services
Software-as-a-Service
consume
SaaSPlatform-as-a-Service
build
PaaSInfrastructure-as-a-
Service
host
IaaS
Cloud TerminologyInfrastructure as a Service (IaaS): basic compute and storage resourcesOn-demand serversAmazon EC2, VMWare vCloud
Platform as a Service (PaaS): cloud application infrastructureOn-demand application-hosting environmentE.g. Google AppEngine, Salesforce.com, Windows Azure
Software as a Service (SaaS): cloud applicationsOn-demand applicationsE.g. Office 365, GMail, Microsoft Office Web Companions
Cloud ServicesPackaged Software
Storage
Servers
Networking
O/S
Middleware
Virtualization
Data
Applications
Runtime
You m
anag
e
Infrastructure(as a Service)
Storage
Servers
Networking
O/S
Middleware
Virtualization
Data
Applications
Runtime
Man
ag
ed b
y v
en
dor
You m
anag
e
Platform(as a Service)
Man
ag
ed b
y v
en
dor
You m
anag
e
Storage
Servers
Networking
O/S
Middleware
Virtualization
Applications
Runtime
Data
Software(as a Service)
Man
ag
ed b
y v
en
dor
Storage
Servers
Networking
O/S
Middleware
Virtualization
Applications
Runtime
Data
EfficiencyControl+Cost
Windows Azure
Windows Azure
Windows Azure is an OS for the data centerHandles resource management, provisioning, and monitoringHost and execute your code in the cloudManages application lifecycleIncludes services for storage, access control, etc.Allows developers to concentrate on business logic
Provides common building blocks for distributed applicationsReliable queuing, simple structured storage, SQL storageApplication services like access control, caching, and connectivity
Key BenefitsAbstraction & flexibilityDesigned for scalability & high availabilityOpen & InteroperableMix and match servicesConsumption based pricing model
Windows Azure Data CentersNorth America Region Europe Region Asia Pacific Region
6 datacenters across 3 continentsSimply select your data center of choice when deploying an
application
North Central US
South Central US
Northern Europe
Western Europe East Asia
South East Asia
East Asia South East Asia Europe
West
North Europe
South Central US
North Central US
Geo-replicationData geo-replicated cross data centers 100s miles apartTurned on right now for Blob and Table data (Queues will be in CY12)
Provide data durability in face of major data center disasters
Data only geo-replicated within regions
User chooses primary location during account creationThe other location in region is the secondary location
Geo-replication Geo-replicationGeo-replication
Geo-replicationIs there a cost for geo-replication?Geo-replication included in current price of Storage
Geo-replication is on by default for all storage accountsCan turn off for whole storage accountThough no price savings if you turn it off
To disable (turn off) geo-replication contact Microsoft Windows Azure Support
But note, if you turn geo-rep off and then back onData transfer egress rates apply to re-bootstrap the data from primary to secondary data center. No additional charge after the re-bootstrap is done.
North Central US
AzureDNS
http://account.blob.core.windows.net/
DNS lookup
Data access
Hostname IP Address
account.blob.core.windows.net
North Central US
Failover
Update DNS
South Central US
Geo-Failover
Existing URL works after failoverFailover Trigger – failover would only be used if primary could not be recoveredAsynchronous Geo-replication – may lose recent updates during failoverTypically geo-replicate data within minutes, though no SLA guarantee
Geo-replication
South Central US
Core Services
Compute Storage Database
Building Block Services
Authn support using multiple identity providersEasily integrate Live ID, Facebook, Yahoo, Google, & ADSupport for industry standards and existing .NET APIs
Messaging & connectivity for building distributed and loosely-coupled apps in the cloudEnables hybrid apps across both on-premises & the cloudQueues & Topics for persistence & pub/sub messaging
Distributed, in-memory cache for Windows Azure appsSession state provider for Windows Azure applications.NET client library for caching data
Access Control
Caching
Service Bus
Data Services
Synchronize data from on-premises SQL Server to/from SQL Azure in the cloudSynchronize data between SQL Azure databases potentially in different data centers
SQL Server Reporting provided as a service Reports authored using existing tools (BIDS) Reports can include rich Data Visualizations (Maps, Charts, Tablix) and exported to variety of formats Directly viewed in the browser or rendered as part of an app using the Reporting Viewer controlWeb Service interface to render & manage reports
Reporting
Data Sync
Service Model
The Windows Azure Service ModelA Windows Azure application is called a “service”Definition informationConfiguration informationAt least one “role”
Roles are like DLLs in the service “process”Collection of code with an entry point that runs in its own virtual machine
Windows Azure compute SLA requires two instances of each role99.95% for connectivity to two instancesAchieved with update and fault domains
Service, Roles, and InstancesA service is a logical set of roles (up to 5)Defined in the Service Definition at development timeAssigned a public URL (i.e. foo.cloudapp.net) at deployment
Instances
Role defines the type of Virtual Machine that will be used to run each component of your applicationDefined in the Service Definition at development time
An instance is a dedicated virtual machine instance that is running your code with your configurationInstances are created by the Windows Azure fabric at runtime based on the roles defined in the service definition
Roles
Service
Inherits RoleEntryPoint
OnStart() Method
Run() Method
OnStop() Method
Role Programming Model
Role LifecycleAll roles may extend RoleEntryPointRoles report status via RoleEnvironment
StatusCheck
StatusCheck
StatusCheck
Stopping
METHODS EVENTS STATUS
Worker Role
Queue Polling Worker•Poll and Pop Messages within while(true) loop•E.g. Map/Reduce pattern, background image processing
Listening Worker Role•Create TcpListener or WCF Service Host•E.g. Run a .NET SMTP server or WCF Service
External Process Worker Role•OnStart or Run method executes Process.Start()•Startup Task installs or executes background/foreground process•Custom Role Entry Point (executable or .Net assembly)•E.g. Run a database server, web server, distributed cache
Web Role
All features of a worker role + IIS 7 or 7.5ASP.NET 3.5 SP1 or 4.0 – 64bitHosts•Webforms or MVC•FastCGI applications (e.g. PHP)•Multiple Websites
Http(s)Web/Worker Hybrid•Can optionally implement RoleEntryPoint
Compute Instance SizeSelectable Size defines CPU Cores, RAM, Local Storage, and PricingSize configured in the Service Definition prior to packaging
Key considerationsDon’t just throw big VMs at every problemScale out architectures have natural parallelismMore small instances == more redundancySome scenarios will benefit from more cores
CPU MEMORY
LOCAL STORAGE
I/O PERFORMANCE
PRICING
Extra Small
1.0 Ghz
768 MB 20 GB Low $0.04
Small 1.6 GHz
1.75 GB 225 GB Moderate $0.12
Medium
2 x 1.6 GHz
3.5 GB 490GB High $0.24
Large4 x 1.6 GHz
7 GB1,000 GB
High $0.48
Extra Large
8 x 1.6 GHz
14 GB2,040 GB
High $0.96
ASP.NET in Windows Azure
Windows Azure for .Net Developers
Visual Studio 2010
Project Templates
Model & Config Tooling
Package & 1 Click Deploy
Debugging Support
Storage Explorer
Server Explorer
IntelliTrace Support
Profiling Support
Web Forms and MVC
Windows Azure Tools for Visual Studio pre-defined role templatesASP.NET WebForms RoleASP.NET MVC 3 Role
What’s Different?
Single InstanceASP.NET
Local StorageRole instances have available disk storageUse LocalStorage element in service definition•Name•CleanOnRoleRecycle•Size
•Persistent but not guaranteed durable•Good for cached resources or temporary files
Windows Azure Storage Drives provide guaranteed durable storage
Local Storage
<LocalResources>
<LocalStoragename="myLocalDisk" sizeInMB="10"
cleanOnRoleRecycle="false" />
</LocalResources>
string rootPath = RoleEnvironment.GetLocalResource("myLocalDisk“).RootPath;
DirectoryInfo di = new DirectoryInfo(rootPath);
foreach(di.EnumerateFiles())
….
SQL Azure Database
Highly available and scalable cloud database serviceManaged service (no setup or management)Familiar Relational Database Management System (RDMS)High availability and fault tolerance built in
ASP.NET for availability
Why do services fail?
Increased workloadFailureHardwareNetwork Platform ServiceTransient conditions
HumanUpgrades
What do we mean by available?
Same functionalityDegraded functionalityFailsafe
Windows Azure Application Philosophy: Design for FailureScale out for capacityScale out for redundancyAsynchronous communicationShort time outs with retriesIdempotent operationsStateless with durable external storage
Statelessness
Load balancer round-robins requests in multi instance roles
Follow web farm best practicesDo not store state on individual instances Do not assume subsequent requests will hit the same instanceDon’t forget things like dynamically generated images loaded by a page
AJAX and Windows Azure
Client side calls may not return to the same instance the original page came from
AJAX calls must be statelessDon’t generate a page and leave state on the server to call via AJAX later
All instances require the same MachineKey for ViewState hashingFabric uses same machine key for all instances in a role
Windows Azure Session StateWindows Azure Load Balancer uses round-robin allocation. Session state must persist to client or storage on every request
LB
session[“foo”] = 1; session[“foo”] = 2;
What is the value of session[“foo”]?
SQL Azure
Windows Azure Storage
Solving Session State
Persist to Storage via Session State ProviderWindows Azure CachingSQL AzureWindows Azure StorageCustom
Persist to ClientUse cookies
Don’t forget ASP.NET MVC TempData relies on Session State provider by default
Windows Azure CachingUsing Windows Azure Caching as the session store
In-memory, distributed cache
Based on Windows Server Caching
Microsoft.Web.DistributedCache assembly found in the SDK
Enable ASP.NET 4 Session Compression
SQL Server Session State
Use SQL Azure as backing storeRound trip to database twice per requestRead at request startWrite at request end
Enable ASP.NET 4 Session CompressionScale out across multiple DBsUse session state partitioninghttp://bit.ly/scale-session
SQL Azure is competitive on cost basis
Windows Azure Storage Providers Sample ASP.NET Providers
(Session, Membership, Role etc…)
Sample Codehttp://code.msdn.microsoft.com/windowsazuresamples
Uses Blob + Table Storage
Several storage transactions per request
Enable ASP.NET 4 Session Compression
Sample Provider should be treated as a starting point only.
Windows Azure Storage
Windows Azure Storage
Storage in the CloudScalable, durable, and availableAnywhere at anytime accessOnly pay for what the service uses
Exposed via RESTful Web ServicesUse from Windows Azure ComputeUse from anywhere on the internet
Design Goals
Highly Available Storage with Strong ConsistencyProvide access to data in face of hardware failures
DurabilityReplicate data several times within and across data centers
ScalabilityNeed to scale to exabytes and beyondAutomatically load balance data to meet peak traffic demands Provide a global namespace to access data around the world
Data Partitioning
Why Partition
Data Volume (too many bytes)
Work Load (too many transactions/second)
Cost (using different cost storage)
Elasticity (just in time partitioning for high load periods)
Horizontal Partitioning
David Alexander [email protected] 3kb 3MB
Jared Carlson [email protected] 3kb 3MB
Sue Charles [email protected] 3kb 3MB
Simon Mitchel [email protected] 3kb 3MB
Richard Zeng [email protected] 3kb 3MB
Horizontal Partitioning (Sharding)
Spread Data Across Similar Nodes
Achieve Massive Scale Out (Data and Load)
Intra-Partition Queries Simple
Cross-Partition Queries Harder
David Alexander [email protected] 3kb 3MB
Jared Carlson [email protected] 3kb 3MB
Sue Charles [email protected] 3kb 3MB
Simon Mitchel [email protected] 3kb 3MB
Richard Zeng [email protected] 3kb 3MB
Vertical Partitioning
SQL Azure Tables BLOBS
Spread Data Across Dis-Similar Nodes
Place frequently queried data in more ‘expensive’ indexed storage
Place large data in ‘cheap’ binary storage
Retrieving
a whole row requires >1 query
Vertical Partitioning
Partitioning
David Alexander [email protected] 3kb 3MB
Jared Carlson [email protected] 3kb 3MB
Sue Charles [email protected] 3kb 3MB
Simon Mitchel [email protected] 3kb 3MB
Richard Zeng [email protected] 3kb 3MB
Abstractions
Windows Azure Storage Abstractions
TablesStructured storage. A table is a set of entities; an entity is
a set of properties.
QueuesReliable storage and delivery of messages for an application.
BlobsSimple named files along with metadata for the file.
DrivesDurable NTFS volumes for Windows Azure applications to use. Based on Blobs.
Windows Azure Data Storage Concepts
Account Table Entities
Queue Messages
Container Blobs
https://<account>.blob.core.windows.net/<container>
https://<account>.table.core.windows.net/<table>
https://<account>.queue.core.windows.net/<queue>
Windows Azure Costs
More small instances == more redundancy
Some scenarios will benefit from more coresWhere moving data >$ parallel overheadE.g. Video processing, Stateful services (DBMS)
Choosing Your VM Size
Don’t just throw big VMs at every problem
Scale out architectures have natural parallelism
Test various configurations under load
Windows Azure Consumption Prices
Elastic, scalable, secure, and highly available automated service platform
Compute
$0.04-0.96/hour+ Variable Instance Sizes
Per service hour
StoragePer GB stored and
transactions$0.15 GB/month
$0.01/10k transactions
Caching
128MB cache for $45/monthPer Message Operation
$1.99/10k transactionsPer Message Operation
Access Control
Prices shown in USD only. International prices are available
$3.99/month per connectionPer Message Operation
Service Bus
Windows Azure
Windows Azure Additional Services
Highly available, scalable, and self managed distributed database service
Web Edition$9.99/month
(up to 1 GB DB/month)
Per database/month
Business Edition Per database/month
Starting at $99.99/month(10-50 GB DB/month)
SQL Azure
Windows Azure Instance Sizes
Unit of Compute Defined
Variable instance sizes to handle complex workloads of any size
Small1 x
1.6Ghz (moderate IO) 1.75 GB memory
250 GB storage(instance storage)
Medium2 x
1.6Ghz (high IO)3.5 GB
memory 500 GB storage(instance storage)
Small
$0.12 Per service
hour
Medium
$0.24 Per service
hour
X-Large
$0.96 Per service
hour
Large
$0.48 Per service
hour
Large 4 x
1.6Ghz (high IO) 7.0 GB
memory1000 GB storage(instance storage)
X-Large8 x
1.6Ghz(high IO)
14 GB memory2000 GB
(instance storage)
$0.04 Per service
hour
Extra Small
Extra Small1 x 1.0Ghz(low IO)
768 MB memory 20 GB storage
(instance storage)
2 Small Instances - Advanced Calculator http://www.windowsazure.com/it-it/pricing/calculator/advanced/
On Premise ServerPowerEdge T110 II Tower Chassis, Up to 4x 3.5" Cabled HDDshttp://configure.euro.dell.com/dellstore/config.aspx?oc=svt110ii&c=it&l=it&s=bsd&cs=itbsdt1&model_id=poweredge-t110-2&
Unit Price: € 1.062,00 € x 2
BasePowerEdge T110 II Tower Chassis, Up to 4x 3.5" Cabled HDDs
Memoria2GB Memory, DDR3, 1333MHz (1x2GB Single Ranked LV UDIMM)
Monitor Display Not IncludedMouse No Factory Installed MouseDispositivi ottici 16X DVD-ROM Drive with SATA Cable
Documenti di spedizioneT110II EMEA1 Ship Docs No Power Cord (English/French/German/Spanish/Russian/Hebrew)
Garanzia di base1Yr Basic Warranty - Next Business Day - Minimum Warranty
Servizi di supporto 1Yr Basic Warranty - NBD Included - No Upgrade Selected
Gestione dei sistemiPE T110II Electronic System Documentation and OpenManage DVD
Supporti di backupRemovable HD Cartridge for RD1000, 320GB SATA (320GB native/640GB compressed)
Informazioni sull'ordine PowerEdge Order - ItalyServizi di manutenzione proattiva Declined Proactive MaintenanceProcessore Intel Core i3-2100, 2C/4T, 3.10GHz, 3M Cache, 65W TDPCavo di alimentazione Italian Spare Power Cord 220V
Sistema operativo preinstallatoWindows Server 2008 R2 SP1, Foundation Edition, English, No Media
Service – Reporting & Remote Management
Dell Proactive Systems Management - Declined - www.dell.com/Proactive
Partizionamento disco rigido Microsoft Windows Server 40GB Partition Option
Configurazione dei dischi rigidiC3 - RAID1 with On-board SATA Controller, Requires Exactly 2 SATA HDDs
Primo disco rigido (2) 250GB, SATA, 3.5-in, 7.2K RPM Hard Drive (Cabled)Schede di rete Intel Gigabit ET Dual Port Server Adapter, Cu, PCIe-4
Dell Services: InstallationsNo Installation Service Selected (Contact Sales rep for more details)
Schede di gestione server Embedded Baseboard Management Controller
High Availability (from Wikipedia)High availability is a system design approach and associated service implementation that ensures a prearranged level of operational performance will be met during a contractual measurement period.
Availability % Downtime per year Downtime per month* Downtime per week
55.5555555% ("nine fives") 162.22 days 13.33 days 74.67 hours
90% ("one nine") 36.5 days 72 hours 16.8 hours
95% 18.25 days 36 hours 8.4 hours
97% 10.96 days 21.6 hours 5.04 hours
98% 7.30 days 14.4 hours 3.36 hours
99% ("two nines") 3.65 days 7.20 hours 1.68 hours
99.5% 1.83 days 3.60 hours 50.4 minutes
99.8% 17.52 hours 86.23 minutes 20.16 minutes
99.9% ("three nines") 8.76 hours 43.2 minutes 10.1 minutes
99.95% 4.38 hours 21.56 minutes 5.04 minutes
99.99% ("four nines") 52.56 minutes 4.32 minutes 1.01 minutes
99.999% ("five nines") 5.26 minutes 25.9 seconds 6.05 seconds
99.9999% ("six nines") 31.5 seconds 2.59 seconds 0.605 seconds
High Availability, SLA=99,95%
3 year support 4hr Mission Critical+ Proactive Manteinance +€840/server
Percentuale di tempo di attività mensile
Credito di servizio*
< 99,95% 10%< 99% 25%
3-year of service• Windows Azure• 141,72 x 36=5101,92
• 2 On Premise Servers
€ 390,87 x 12 trimestri = € 4690,44+ installation+ power/cooling/backup
Conclusions
Conclusions
• Azure is an opportunity• It’s not «simple»...• ...but it’s «simple»• It’s not «cheap»...• ...but it’s «cheap»
Sito Web: http://www.innovazionefvg.net/E-Mail: [email protected]
• Marco Pozzan: [email protected]• Marco Parenzan: [email protected]