430 likes | 627 Views
Migrating Business Apps to Windows Azure. Marc Müller Principal Consultant, 4tecture Gmb H www.4tecture.ch www.dotnetacademy.ch mmueller@4tecture.ch. Agenda. Short Introduction to Windows Azure Overview Differences to On-Premise Development Migration Strategies
E N D
Migrating Business AppstoWindows Azure Marc Müller Principal Consultant, 4tecture GmbH www.4tecture.ch www.dotnetacademy.ch mmueller@4tecture.ch
Agenda Short Introduction to Windows Azure • Overview • Differences to On-Premise Development Migration Strategies • Logic / Frontend / Storage Cloud Computing Topics • Scale Out / Scale up • Architecture / Cost Oriented Architecture Security Role Management Call to Action Questions
Windows Azure What, Cloud is just computers? – differences to on-premise systems
Definition ofCloud Computing Infrastructure (as a Service) Platform (as a Service) Packaged Software Software (as a Service) Applications Applications Applications Applications You manage Data Data Data Data You manage Runtime Runtime Runtime Runtime Managed by vendor Infrastructure-as-a-Service Middleware Middleware Middleware Middleware “PaaS” “IaaS” “SaaS” Managed by vendor You manage O/S O/S O/S O/S Platform-as-a-Service Software-as-a-Service Virtualization Virtualization Virtualization Virtualization Managed by vendor Image Source: Windows Azure Training Kit consume build host Servers Servers Servers Servers Storage Storage Storage Storage Networking Networking Networking Networking
The transitiontothecloud • Windows Server • Single Instance • Persistent • File System • Network Shares • Windows Security (AD) • Benefits • Automated Updates • Multi-Instance-Management • Scale-Out • High Availability / Failover • Windows Azure • Multi Instance • Stateles OS • Azure Storage • SQL Azure • ACS (AD ADFS) • Azure Connect / Service Bus
Standard Cloud Tiers Front end: e.g. load-balanced stateless web servers Middle worker tier: e.g. order processing, encoding Backend storage: e.g. SQL tables or files Multiple instances of each for scalability and availability Front-End Windows Azure Storage,SQL Azure Front-End Middle-Tier Load Balancer HTTP/HTTPS Image Source: Windows Azure Training Kit Cloud Application
Top migrationeffortpoints StatefulvsStateless Scheduled Jobs Complex Business Logic in Database File Handling
Migration StrategiesAzureCompute Howtomigrateyourprocessinglogic
WindwosAzureRoles VM Role Worker Role Web Role • “Move” applications to Windows Azure • Full control over OS Image • VHD Image • Designed for long or non-automated installs • Image must be Windos Server 2008 R2 Enterprise • Role is hosted on IIS • HTTP/HTTPS • ASP.NET • Fast CGI + PHP • Role is an executable • Create your own web server, host a database, etc. • Inbound on • Any TCP Port • HTTP/HTTPS
Azure Package and Endpoints Configuration • Service Definition (*.csdef) • Service Configuration (*.cscfg) Deployment Package • Encrypted(Zipped(Code + *.csdef)) • *.cspkg file Deplyoment • (*.cspkg + *.cscfg) Endpoints • Input • Internal • Windows Azure Connect
Startup Tasks Enables short, unattended setups on role startup • Silent MSIs, COM Components, Registry Keys, Configuring Windows Server, etc. Configured in the .csdef Task Type • Simple – System waits for the task to exit • Background – System does not wait for the task to exit • Foreground – Same as background, but blocks role restart until tasks exit <WebRolename=“FabrikamShipping.App.Web"> <Startup> <Taskcommandline="relative\path\ToSetupExecutable" executionContext="limited|elevated" taskType=“simple|foreground|background"/> </Startup> </WebRole>
Workflow (simplified) Defineyour Endpoints DefineRolesand Instance Count Create a deploymentpackage (applicationbinaries) Provide additional InstallersandBinariesfor Startup Tasks Deploy! … but therearesomeimportantpointstoconsider!
Migration StrategiesAzure Storage Howtohanldefiles in thecloud…
Storage Challange Don’tthink in termsof «filesystemaccess» Think RESTful • 4 HTTP Verbs for CRUD • Ressources Localfilesystemshouldbeusedfor «localcache» only Create logicalstoragestorageinterfaces / abstractions CreateAzure Storage adapters in yourapplication
Migrateyourlocalfilesystem Blobs - Simple named files along with metadata for the file • Two level hierarchy – container / file • Security on container / file – policy or signature • Two Types • Block BLOB (streaming workload [“file”], blocks, max 200GB) • Page BLOB (random read / write, pages, max 1TB) Drives - Durable NTFS volumes • Page BLOB formatted as a NTFS single volume VHD • one instance read/write, read-only snapshot for multiple instances • Drive API, not REST Calls – NTFS API for read/write
Access BLOB Files RESTful URL Can include ‘/‘ or other delimeterin name • e.g. /<container>/f1/blob1.jpg • e.g. /<container>/f1/blob2.jpg • http://.../<container>?comp=list&prefix=f1&delimiter=/ f1/blob1.jpg, f1/blob2.jpg Image Source: Windows Azure Training Kit
BLOB Security Client Control the access to your files Fine grain access rights to blobs and containers Sign URL with storage key – permit elevated rights Revocation • Use short time periods and re-issue • Use container level policy that can be deleted Two broad approaches • Ad-hoc • Policy based Create Shared Access Keys by • Tool • API Request Shared Access Key URL Signed URL Web App Blob Storage
Tools Windows Azure Storage Explorer http://azurestorageexplorer.codeplex.com
New Concepts Azure Table Storage • Not a RDBMS! • TablesandEntities • CRUD • NofixedSchema (exceptPartition Key, RowKey, Timestamp) • Upto 255 properties per Entitytype (standard .NET Types) Azure Queue Storage • Usedforinstancesynchronization • Messages (max. 8kb) • ReliableDelivery / Poisonous Message detection Image Source: Windows Azure Training Kit
Migration StrategiesDatabase SQL Database in thecloud
SQL Azure • SQL Server Engine • Sharedinfrastructure • Request routing, security, isolation • Scalable / high availability • Automaticreplicationandfailover • Working with SQL Azure • TDS Protocol (Firewall rules!) • Useexistingclintlibraries: ADO.NT, ODBC, PHP, … • Cannotswitchbetween DBs (no USE command) • Only SSL connectionsaresupported (encrypt = true) • Standard SQL Auth Logins (username + password)
Challenge SQL Azurefocusses on logicaladministration Schema creationandmanagement Query optimization Securiymanagement Nophysicalmanagementneeded / possible Restrictions Not supported: Sparse Columns, Filestreams, Partitions, Full-Text-indexes, SQL-CLR Tablesrequireclusteredindexes New features SQL AzureFederations
How do I migratemydatabase? TSQL Management Studio – Script databaseas… Size restrictions (data)! use BCP TSQL with BCP (BulkCopy Utility) SQL Azure Migration Wizard (http://sqlazuremw.codeplex.com) SQL AzureFederation Data Migration Wizard (http://sqlazurefedmw.codeplex.com) SQL Server Data-Tier Applications (DAC) DACPAC / BACPAC Sync Framework 2.1
How do I backupbydatabase? Import / Export (DAC) Not transactionalconsistent! create a copyfirst! CREATE DATABASE destination_database_name AS COPY OF [source_server_name.]source_database_name Nojobscheduler! Syncwith on-premisedatabase SQL AzureDatasync Fullbackupfunctionality on on-premisedatabase BCP (bulkcopyutility) bcp AdventureWorksLTAZ2008R2.SalesLT.Customer out C:\Users\user\Documents\GetDataFromSQLAzure.txt -c -U username@servername -S tcp:servername.database.windows.net -P password SQL Azure Backup Tools Quest Spotlight for SQL Azure, Enzo Backup for SQL Azure, Redgate SQL Azure Backup Tool, SQLAzureBackup
Restriction Workarounds Job Scheduler Use an on-premisedatabase (sync) andrunthejobslocally On-premisejobschedulerwithconnectionto SQL Azure (TSQL) Local SQL Server Integration Services withconnectiontocloud Use an Azure Worker Rolewith a scheduler Full Text Search Lucene.net Unique identifierClustered Indexes NEWSEQUANTIALID() ist not supported! Don’tuseuniqueidentifiersforclusteredindexesor providecustomindexgenerator (App Tier)
Migration StrategiesCloud Features Design yourapplicationforthecloud!
Scale-Out Architecture The Internet The Internet via TCP or HTTP Tables LB LB LB Storage Queues Web Site (ASPX, ASMX, WCF) Worker Service Web Site (ASPX, ASMX, WCF) Worker Service Web Role IIS as Host Worker Role Managed Interface Call Image Source: Windows Azure Training Kit Blobs Windows Azure Data Center
Scale-Out Architecture Intelligent Network Load Balancer Network Activation Stateless Web and/or Application Servers Stateless ‘Worker’ Machines Async Activation State Tier Queues Key/ValueDatastores Partitioned RDBMS Blob Storage
Role Patterns Worker Role • Web Role • IIS Web Application / Web Farm • Worker Role • Queue Polling Worker • Poll and Pop Messages (i.e. map/reduce pattern) • Listening Worker Role • TcpListener / WCF (i.e. run a .NET SMTP) • External Process Worker Role • Start process from application or startup task • E.g. Run a database server, web server, distributed cache • Web / Worker Hybrid Role • Web Application and Background Worker in same Instance Web Role Hybrid Role
AsynchronousProgramming Usequeuemessagesfortasks A messageshouldbesmall, use BLOB or Table storageforthepayload Storage Web Role Worker Role Web Role Worker Role Worker Role Worker Role Blob Container LB LB Queue Table
MapReduce Images Processedin Worker Instances Slices Pulled from Blob Storage Final ImageSaved as BLOBReady for Use Processed Slices Pushed Back to Blob Storage Image Uploaded Reduce Worker Role Upload Web Role SlicesSaved ToBlob Storage Image Split Splits ReducedBack to Full Image Map Worker Role
Queue Best Practices Ensurethat messagesareidempotent [f(x) = f(f(x))] andhavea compensationmechanism youimplementpoisondetection To do so, youhaveto • Check the «dequeuecount» of a message • Use Transaction with Rollback / Comit • Use an Action-Log torecover last state • Move poisonousmessageto a separate queueordeletethem
Data Partitioning Whyshouldwepartitionthedata? Data volume (too large) Work load (toomanytransactions) Costs (COA – CostOrientedArchitecture) Elasticity (JIT Partitioningduring high loadperiods) Horizontal Partitioning: VerticalPartitioning:
Migration StrategiesSecurity Howtoauthenticate in yourcloudapplication
Authentication & Authorization Security Token Trust • We do not wantto • implementanothersecuritysystem • integratethecloudserverintoourdomain • Wewantto • integrateintoourexistingsecuritysystem (AD) • integratepartnersandcustomers • use open an flexible standards Integrate in company’s AD
Migration StrategiesRole Management Scale Out / ScaleUp
Cloud Computing Patterns Optimizeyourinstanceusage Save money Haveresponsiveapps Manage Instances Manuallythroughmanagementportal Manuellythroughmanagementservice Automatically • Tracdiagnosticinformation • Modify instancecountautomatically • (i.e. EntLib 5 Autoscaling Block)
Let’sgetstarted MSDN Benefits
MSDN Benefits http://www.windowsazure.com/en-us/pricing/member-offers/msdn-benefits/
Special Training Offer http://www.4tecture.ch/Media/Default/Flyer/AzureQuickstartFlyer.pdf