Scaling Big while Sleeping Well<br />Josh Holmes<br />@joshholmes<br />josh.holmes@microsoft.com<br />www.joshholmes.com<b...
Agenda<br />Testing the Waters<br />What is cloud computing?<br />What are the advantages of cloud computing?<br />How’s A...
We are all excited about the cloud<br />
Cloud-Addressable Challenges<br />1<br />1<br />5<br />Maintaining security while increasing access and transparency—withi...
In House or Hosted Servers<br />Allocated IT-capacities<br />Load Forecast<br />“Under-supply“ of capacities<br />“Waste“ ...
Cloud Computing<br />Load Forecast<br />Allocated IT capacities<br />No “under-supply“<br />IT CAPACITY<br />Reduction of ...
Types of Clouds<br />Platform<br />(as a Service)<br />Private<br />(On-Premise)<br />Infrastructure<br />(as a Service)<b...
The Microsoft Cloud<br />~100 Globally Distributed Data Centers<br />Quincy, WA<br />Chicago, IL<br />San Antonio, TX<br /...
Categories of Services<br />Application Services<br />Software Services<br />Platform Services<br />The Microsoft Cloud<br...
The trick is knowing what your systems need,<br />and how the cloud can help.<br />
Not everything has to or can live in the cloud<br />
Only move to the cloud that which can benefit<br />
The core strategy is ‘hybrid’<br />
Take an À la carteapproach<br />
We call this Software + Services<br />
An Example…<br />
“Packaged”<br />Application<br />Big Pharmaceutical Example<br />Hosted <br />“Packaged”<br />“Packaged”<br />using cloud ...
“Packaged”<br />Application<br />Big Pharmaceutical Example<br />Hosted <br />“Packaged”<br />“Packaged”<br />using cloud ...
Big Pharmaceutical Example<br />“Packaged”<br />Application<br />Hosted <br />“Packaged”<br />“Packaged”<br />using cloud ...
“Packaged”<br />Application<br />Big Pharmaceutical Example<br />Hosted <br />“Packaged”<br />“Packaged”<br />using cloud ...
“Packaged”<br />Application<br />Big Pharmaceutical Example<br />Hosted <br />“Packaged”<br />“Packaged”<br />using cloud ...
Where the Cloud is Compelling<br />
Only 2 reasons to use the cloud<br />
Windows Azure VMs<br />Small<br />Medium<br />Large <br />X Large<br />$0.12 <br />$0.24 <br />$0.48 <br />$0.96 <br />Per...
Windows Azure, In One Picture<br />Business Portal<br />Developer Portal<br />Service Management Service<br />REST<br />Us...
Determine an ROI<br />Consider:<br /><ul><li>Current hosting costs
Current staff costs
Cooling/power/space
Migration costs
Licensing</li></ul>AzureROI.CloudApp.net<br />
ZENDFRAMEWORK<br />
Digging into Azure with PHP/Ruby<br />
Windows Azure, In One Picture<br />Business Portal<br />Developer Portal<br />Service Management Service<br />REST<br />Us...
Windows Azure Roles<br />WorkerRole<br /><ul><li>Internal Facing
TCP/HTTP Endpoint
Long running processes
Think Service or Deamon</li></ul>WebRole<br /><ul><li>External Facing
HTTP/HTTPS Endpoint
Short lived calls
Think Web Server</li></li></ul><li>Running PHP in Windows Azure<br />How to Do It<br />Host in Web role (like .NET)<br />S...
Windows Azure 4 Eclipse<br />Does a lot of the heavy lifting for you<br />Creates the Web.config, Web.roleConfig, PHP impl...
Running EXEs in the Worker Process<br />Start with a Worker Role Process to <br />Copy the exes to the worker role’s app d...
Running Ruby in the Worker Process<br />http://code.msdn.microsoft.com/railsonazure<br />Download and extract the solution...
Data Storage<br />
Storage options<br />Windows Azure Data<br />Sql Azure<br />
Windows Azure Data Storage<br />Queue<br />Blob<br />Account<br />Tables<br />Drives<br />
Azure Platform Data Storage Options<br /><ul><li>Windows Azure Data Storage
Blobs
Unstructured data storage
Tables
Semi-structured or tabular data storage
Queues
Buffered delivery data storage
Drives
Durable NTFS volumes that Windows Azure applications can use.  See: http://microsoftpdc.com/Sessions/SVC14</li></ul>SQL Az...
Windows Azure Data Storage<br />
PHP with Windows Azure Storage<br />Windows Azure SDK for PHP @ http://phpazure.codeplex.com<br />PHP programming model fo...
Windows Azure Data Storage - Blobs<br />Unstructured data storage<br />Partitioned by container<br />Unlimited containers<...
Blobs Sample<br />$blobStorage= new Microsoft_WindowsAzure_Storage_Blob();<br />// Create<br />if (!$blobStorage->containe...
Blobs Sample Cont…<br />// Copy<br />$result = $blobStorage->copyBlob(<br />     $containerName, $blobName, $containerName...
Blob Stream Wrapper<br />$blobStorage= new Microsoft_WindowsAzure_Storage_Blob();<br />// Register:<br />$blobStorage->reg...
Storage: XDrive<br />NTFS drive in the cloud: X:<br />Fixed size between 16MB and 1TB<br />Max 8 drives on your VM<br />Im...
Queue Workflow Concepts<br />Windows Azure Queue Provides<br />Guarantee delivery (two-step consumption)<br />Worker Deque...
Azure Queues<br />RemoveMessage<br />GetMessage (Timeout)<br />Worker Role<br />PutMessage<br />Queue<br />Msg 1<br />Msg ...
Loosely Coupled Work with Queues<br />Worker-Queue Model<br />Load work in a queue<br />Many workers consume the queue<br ...
Queues<br />$queueClient= new Microsoft_WindowsAzure_Storage_Queue();<br />// Create<br />$result = $queueClient->createQu...
Windows Azure Data Storage - Tables<br />Semi-Structured data<br />Tables contain entities<br />Entities contain propertie...
Windows Azure Data Storage – Tables (Terms Part 1)<br />Table<br />Contains a set of entities.  <br />Entity (Row) <br />B...
Windows Azure Data Storage – Tables (Terms Part 2)<br />Partition <br />Entities in a table with the same partition key<br...
Key Example – Blog Posts<br />Partition 1<br />Partition 2<br />Getting all of dunnry’s blog posts is fast<br />Single par...
Table Sample<br />$tableStorage= new Microsoft_WindowsAzure_Storage_Table(<br />'table.core.windows.net', 'myaccount', 'my...
Tables with Entities<br />// Structured entity<br />class ImageEntityextends <br />Microsoft_WindowsAzure_Storage_TableEnt...
Tables with Entities Cont…<br />// Insert<br />$image = new ImageEntity($partitionKey, $rowKey);<br />$image->filename = $...
Table Queries<br />// Filter condition<br />$select = "filesizegt 1024 and PartitionKeyeq '$partitionKey'";<br />// Or flu...
Batching Operations<br />// Start batch<br />$batch = $tableStorage->startBatch();<br />// Insert multiple<br />$images = ...
Table session handler<br />$sessionHandler<br />    = new Microsoft_WindowsAzure_SessionHandler($tableStorage);<br />$sess...
SQL Azure and Windows Azure Table Comparison<br />Windows Azure Tables<br />SQL Azure Tables<br />Semi-structured<br />Loo...
MySQL: Simple Configuration<br />VIP<br />Load Balancer<br />Web Role<br />MySQL<br />Worker Role<br />
MySQL in a Windows Azure Application<br />Running MySQL in a worker role<br />Copy MySQL to the worker role sub-directory<...
Simple Configuration<br />VIP<br />Load Balancer<br />MySQL<br />
Replication<br />VIP<br />Load Balancer<br />M<br />S<br />S<br />MySQL<br />MySQL<br />MySQL<br />
Windows Azure Drive with Hot Spare<br />VIP<br />Load Balancer<br />MySQL<br />MySQL<br />
Windows Azure Drive with Hot Spare<br />VIP<br />Load Balancer<br />MySQL<br />MySQL<br />
SQL Azure<br />
SQL Azure Features<br />Supported<br />Tables, Indexes, Views<br />Stored Procedures<br />Triggers<br />Constraints<br />T...
SQL AzureDeployment<br />Web Portal<br />(API)<br />DB Script<br />SQL Azure<br />TDS<br />
Upcoming SlideShare
Loading in...5
×

Scaling Big While Sleeping Well

28,122

Published on

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
28,122
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
65
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Many of the challenges with building applications today have very little to do with development tools, programming languages, or frameworks. Rather, many of the challenges that organizations face are related to the infrastructure required to deploy, run, and manage applications. Quickly summarize only 1 of the following:Startups - For example, imagine you were a startup building the next social networking site or online game You have to worry about numerous issues that are unrelated to the functionality of the application.[Capacity]You have to think about the capacity requirements for the application.Will it be used by a few thousand users or hundreds of thousands or millions?How do users translate to bandwidth, storage, and server requirements?Will the usage be consistent during all times of the year? Will it be consistent over the lifetime of the application?Can you handle spikes in demand if there were sudden demands for the app? (Digg Effect)Ultimately, most organizations end up paying for more capacity then they need.[Deployment, operations, and versioning]Then you have to worry about deploying and operating your applicationHow do you deploy your application over multiple servers?How do you role out updates to the app without taking it offline?How do you manage patches? Enterprise - For established organizations, some of these decisions and problems may have already been addressed through a shared data center or an established staff and processes. However, in enterprise organizations we often find that apps are silos of their own servers. Established organizations also still have to spend a significant amount of capital and operations funding. IT resources are applied to maintaining applications rather than delivering new value and functionality. ISV - Finally, if you’re an ISV who builds applications for use by other businesses you have to worry about a number of additional problems. You have to think about your customer’s capacity, which gets factored into the cost of ownership. Often, your sales opportunities are limited by your customer’s ability to deploy new applications.Your customers often have existing assets such as order fulfillment systems, ERP systems, multi-terabyte databases, etc. that are running on-premise. You must be able to easily integrate with these assets.
  • http://www.flickr.com/photos/cesarastudillo/158254288/sizes/o/
  • This reference chart may help us to recognize opportunities for using cloud computing within our own organizations or our vendors or customers.A new social networking sight may need a massive amount of scalability…A 911 call center may require that last “9” of reliability…A tax preparation package may require varying amounts of computational power, storage, and bandwidth…A hurricane relief site may need to launch on a moment’s notice and be available for a duration that is hard to predict at the onset of the disaster.A genome sequencing project or perhaps a search for extraterrestrial planets to live on in our future might require massive amounts of parallel processing power.A new online startup may need to begin business with little or no capital investment and fail fast with little or no financial lossSo with the terrific list of “great fits” … are there any “bad fits”? Well… yes… there are a few… at the present time…Frequently updated applications are not very good candidates. Primarily I say this because as a developer … the time that it takes to deploy is longer than if you had your own local on premise or hosted servers; however, you must take this with a grain of salt as you’ll have to compare it against the level of effort the you presently invest to make deployments in order to gauge the applicability of this advice.Applications needing external data storage are also not very good candidates at the present time.Of course, this is a moving target… and as cloud computing evolves further… even these bullets (and others like them) may move from the not-so-good list to the good-list. We are entering a new era of software development where we will once again be inspired and excited about our profession as software developers!
  • http://www.flickr.com/photos/28481088@N00/2530180465/sizes/m/
  • We’ll start with SQL Azure... This will give most of developers a common frame of reference as most developers are comfortable with relational databases.In a short while, I will introduce Blobs, Tables, Queues, and DrivesSQL Azure can be thought of as your SQL Server in the cloud. It is based on a subset of SQL Server 2008.Blobs are a means of storing unstructured data, such as pictures, movies, PDF’s, Word documents, and the like.Tables are a means of storing semi-structured or tabular data. Tables are similar to an Excel spreadsheet in the sense that data is tabular and there is no strict type cohesion as there would be in a SQL Server table column. Data stored in tables is partitioned and keyed for retrievalQueues are a means of buffered message delivery. There are very useful for communicating data between our Windows Azure service instances. As our service instances do not have to wait around for the I/O of delivering the message or the result of the message processing, they can dramatically improve the scalability of our software system.Drives are a recently added feature announced at the Los Angeles PDC in November 2009. Drives provide durable storage that appears to our application as an NTFS volume. The drive itself is an abstraction over the same Windows Azure Data Storage used for Blobs. You can get more information on Drives by visiting the PDC site on my slide.Applications may use multiple types of data storage at the same time. In fact, this is quite common. When we do our first Windows Azure Data Storage demo together, I will be showing you an application that uses Blobs, Tables, and Queues in concert.
  • Okay… That’s all about SQL Azure for now… we’ll come back to this topic in Session 3…Keep in mind that SQL Azure is a separate product from Windows Azure…. And that Windows Azure includes Windows Azure Data Storage, which we are going to talk about now. We will be using the Windows Azure Data Storage directly in demos, so these slides will provide more of a brief and high level overview.To get Windows Azure Data Storage setup, we simply create a new Storage Account from the Windows Azure Portal.
  • Our Windows Azure Data Storage will be accessible via RESTful queries at the endpoints you see on this slide, or via the API in the Windows Azure SDK library.We’ll be using the Windows Azure library in our demo.
  • It’s time now to introduce Windows Azure Data Storage Blobs.Blobs are for storage of unstructured data.We partition our data by creating Blob containers which we give names to.We can create an unlimited number of Blob Containers.We then simply place our blob data into the blob containers, supplying a unique identifier.When we want to retrieve our data, we simply provide the container and the unique identifier.
  • Use queues as a way of communicating w/ the backend worker rolesWRs call getmessage and pass timeoutTimeout value is importantExpiration time is important; message is marked in the queue as invisible; for duration of timeout it’s invisibleWhen we’re done processing, we call a message to remove the message through a deleteTh reason we do this is imagine we have a second worker role; if something goes wrong, once the timeout expires, the message becomes visible, and the next person to do a get message will get the message
  • http://www.flickr.com/photos/cav666/3562455727/http://go.microsoft.com/fwlink/?LinkId=153401Windows Azure Data Storage Tables are how we get massively scalable and highly available databases.Although there are some similarities, these tables are very different from relational database tables.Data in Windows Azure Data Storage Tables is semi-structured; The concept of a Windows Azure Data Storage Table is similar to how a spreadsheet is used to provide tabularized organization to data without strongly enforcing data cohesion.… Data is indexed in Tables for high performance retrieval, but there are no relationships between Tables.The tables support ACID transactions over single entities and rich queries over the entire table.
  • The PartitionKey combined with the RowKey uniquely identifies an entity in a table.
  • 11:53Getting the all of dunnry’s post it fast because we’re selecting the entities by a partition keyGetting all of the posts after a certain is slow because we may have to traverse across multiple servers because we’re selecting entities that span partition keysA query without the partition key is really a scan
  • We have included this feature comparison table in anticipation of your likely questions about differences between using a relational database table as you may be currently doing with your SQL Server databases and the new Windows Azure Tables included in Windows Azure.
  • http://www.flickr.com/photos/timothymorgan/75593157/sizes/o/
  • As I stated earlier, SQL Azure is based on SQL Server 2008. At this time it is only a subset of the features of the server product.My intention here is to convey the high level features that are supported and the ones that are not.SQL Azure will support most of the things we need… Tables, Index, Views, Stored Procedures, Triggers, and Constraints… in my book… that’s all the functionality that I need for most of my applications.There are some other adjunct technologies that ship as part of SQL Server 2008 such as SQL Reporting Services and Analysis Services which are not supported. The Service Broker is also not supported.
  • So let’s assume that we have designed our relational database with local developer and data modeling tools.We can begin our story then by assuming that we want to get our database deployed to the cloud.There are some tools that will expedite this process which I will show you later, but for now lets assume that we have scripted our database schema. We apply this script to SQL Azure which speaks native TDS.If you created your database through the SQL Azure Portal, then SQL Azure will have created one master database and three replicas of that database. If you create your database with the script the same will be true.These replicas are stored in different database centers from the master to provide redundancy and protection against geographical catastrophe.
  • Configuring our application to use SQL Azure storage instead of SQL Server is simply a matter of modifying the connection string in our application’s configuration file.When our application requests data, ADO.NET speaks to the TDS which directs our queries to the master database server. The master database server performs our query and returns the results to our application.
  • From our application’s point of view, there is only one SQL Azure database.As we make updates to our database, those updates are replicated to other copies stored in other data centers so that in the event that our database fails for any reason, the other databases will be standing by ready to take its place.
  • But what if that master database server fails for some reason?TDS is receives notification of the database failure and automatically redirects the call to the replica!The Azure Cloud Fabric is self-healing… and the details are outside the scope of this presentation; however, the fabric will get busy repairing itself like drones on a Borg mother ship… essentially with the objective of keeping three replicas online at a time.
  • I will demonstrate creating a SQL Azure account in session 3 where I will walk you through the entire process.For now I simply want to give you some background information to prepare you for our first demonstration.When we create our SQL Azure database server, we’ll be prompted for an Administrator’s name and a password.This username and password will be the granted a system administrator role that is similar to the “sa” account on a local SQL Server 2008 box. The account has permission to create and drop databases and database ownership authority in any databases that you create with this account.
  • After creating your SQL Azure database server, you will want to grant appropriate access through the SQL Azure firewall.SQL Azure provides a very simple and easy to maintain firewall. The firewall is so easy to use that it’s only going to get one slide in my deck!The firewall allows us to expose our database to Windows Azure services via a checkbox and to add ranges of IP addresses such as your home office and your business… or possibly the address of a 3rd party server hosting some application that needs data access.I’ll do a thorough demo of this feature in session 3…
  • When you created your SQL Azure database server, you supplied an administrator’s user name and password. I have named my user accordingly… to remind me of its power.The SQL Portal will offer you the ability to copy these credentials in connection string format to your clip board… tempting you into believing that you should just paste this into your configuration file.This is terrific for demos like mine… BUT you should NEVER, EVER do this…A database server system administrator password placed in a configuration file in clear text format… there has got to be something naive in the extreme going on here… and worse… no way to create non-sa-like users through the UI… you must script your database users and then apply the script to the database. And to anticipate your question… no… you can’t use SQL Server Management Studio to do this either.I will demo this as well in session 3… so hang tight…
  • There are a number of techniques for getting data migrated from an existing database into a SQL Azure database.One very effective technique is to script the database schema and any stored procedures or views and then apply these scripts to the SQL Azure database. Once the schema has been deployed to the cloud, BCP can be used to copy the data in.Another effective technique is to utilize SQL Server Integration Service which will transfer the Schema and the Data.
  • I think that I saved the best for last here… The SQL Server Migration Wizard is available for download from the CodePlex website at the URL on this slide.To quote the website, “The SQL Azure Migration Wizard helps you migrate your local SQL Server 2005 / 2008 databases into SQL Azure. The wizard walks you through the selection of your SQL objects, creates SQL scripts suitable for SQL Azure, and allows you to migrate your data.”I will demonstrate this tool in session 3 when I use it to migrate an application and associated database from the local desktop to the cloud.
  • Although some things can be done with SQL Server 2008 Management Studio, I highly recommend that you use the 2008 R2 Nov CTP as it is SQL Azure aware.After you have created your system administrator account for SQL Azure, you can use SQL Server Management Studio R2 CTP to make connections to the database and execute scripts such as the one that I am showing in this slide.
  • Scaling Big While Sleeping Well

    1. 1. Scaling Big while Sleeping Well<br />Josh Holmes<br />@joshholmes<br />josh.holmes@microsoft.com<br />www.joshholmes.com<br />
    2. 2. Agenda<br />Testing the Waters<br />What is cloud computing?<br />What are the advantages of cloud computing?<br />How’s Azure fit in?<br />Diving Deep<br />Digging into PHP/Ruby on Azure<br />Leveraging FastCGI<br />Leveraging Azure Storage<br />Leveraging SQL Azure<br />
    3. 3. We are all excited about the cloud<br />
    4. 4. Cloud-Addressable Challenges<br />1<br />1<br />5<br />Maintaining security while increasing access and transparency—within and outside the organization<br />Infrastructure costs are fixed and ongoing, and distract from the mission of reducing business process friction<br />2<br />6<br />Leveraging past investments to provide future value<br />Security, access, and transparency across the value chain: suppliers, partners, etc.<br />3<br />Many data centers at limit—real estate, capacity, cooling and power<br />7<br />Lack of a common platform<br />4<br />Matching capacity to demand<br />
    5. 5. In House or Hosted Servers<br />Allocated IT-capacities<br />Load Forecast<br />“Under-supply“ of capacities<br />“Waste“ of capacities<br />Fixed cost of IT-capacities<br />IT CAPACITY<br />Barrier for<br />innovations<br />ActualLoad<br />TIME<br />
    6. 6. Cloud Computing<br />Load Forecast<br />Allocated IT capacities<br />No “under-supply“<br />IT CAPACITY<br />Reduction of “over-supply“<br />Possible reduction of IT-capacities in case of reduced load<br />Reduction of initial investments<br />ActualLoad<br />Time<br />
    7. 7. Types of Clouds<br />Platform<br />(as a Service)<br />Private<br />(On-Premise)<br />Infrastructure<br />(as a Service)<br />You manage<br />Applications<br />Applications<br />Applications<br />You manage<br />Runtimes<br />Runtimes<br />Runtimes<br />Security & Integration<br />Security & Integration<br />Security & Integration<br />Managed by vendor<br />Databases<br />Databases<br />Databases<br />You manage<br />Servers<br />Servers<br />Servers<br />Managed by vendor<br />Virtualization<br />Virtualization<br />Virtualization<br />Server HW<br />Server HW<br />Server HW<br />Storage<br />Storage<br />Storage<br />Networking<br />Networking<br />Networking<br />
    8. 8. The Microsoft Cloud<br />~100 Globally Distributed Data Centers<br />Quincy, WA<br />Chicago, IL<br />San Antonio, TX<br />Dublin, Ireland<br />Generation 4 DCs<br />
    9. 9.
    10. 10. Categories of Services<br />Application Services<br />Software Services<br />Platform Services<br />The Microsoft Cloud<br />Infrastructure Services<br />
    11. 11. The trick is knowing what your systems need,<br />and how the cloud can help.<br />
    12. 12. Not everything has to or can live in the cloud<br />
    13. 13. Only move to the cloud that which can benefit<br />
    14. 14. The core strategy is ‘hybrid’<br />
    15. 15. Take an À la carteapproach<br />
    16. 16. We call this Software + Services<br />
    17. 17. An Example…<br />
    18. 18. “Packaged”<br />Application<br />Big Pharmaceutical Example<br />Hosted <br />“Packaged”<br />“Packaged”<br />using cloud <br />“Software as a Service”<br />Buy<br />ERP<br />“Too costly to run this myself, but I’ve made too many customizations”<br />CRM<br />Email<br />Build vs. Buy<br />“Home Built”<br />Application<br />Hosted <br />“Home Built”<br />“Home Built”<br />using cloud <br />“Platform as a Service”<br />HR System<br />Molecule Research<br />Build<br />Clinical Trial<br />Hoster<br />Vendor<br />On Premise<br />Cloud<br />
    19. 19. “Packaged”<br />Application<br />Big Pharmaceutical Example<br />Hosted <br />“Packaged”<br />“Packaged”<br />using cloud <br />“Software as a Service”<br />Buy<br />ERP<br />CRM<br />“CRM and Email are commodity services – They have no customizations, and it’s cheaper for someone else to run these”<br />Email<br />Build vs. Buy<br />“Home Built”<br />Application<br />Hosted <br />“Home Built”<br />“Home Built”<br />using cloud <br />“Platform as a Service”<br />HR System<br />Molecule Research<br />Build<br />Clinical Trial<br />Hoster<br />Vendor<br />On Premise<br />Cloud<br />
    20. 20. Big Pharmaceutical Example<br />“Packaged”<br />Application<br />Hosted <br />“Packaged”<br />“Packaged”<br />using cloud <br />“Software as a Service”<br />Buy<br />ERP<br />CRM<br />Email<br />Build vs. Buy<br />“Home Built”<br />Application<br />Hosted <br />“Home Built”<br />“Home Built”<br />using cloud <br />“Platform as a Service”<br />“I can’t afford to maintain this old HR application written in VB4 – it’s driving me mad!”<br />HR System<br />“…but due to regulatory issues, I cannot store my HR data off-premise”<br />Molecule Research<br />Build<br />Clinical Trial<br />Hoster<br />Vendor<br />On Premise<br />Cloud<br />
    21. 21. “Packaged”<br />Application<br />Big Pharmaceutical Example<br />Hosted <br />“Packaged”<br />“Packaged”<br />using cloud <br />“Software as a Service”<br />Buy<br />ERP<br />CRM<br />Email<br />HR System<br />Build vs. Buy<br />“Home Built”<br />Application<br />Hosted <br />“Home Built”<br />“Home Built”<br />using cloud <br />“Platform as a Service”<br />“I wish I had access to cheaper compute and storage when I need it”<br />Molecule Research<br />Build<br />Clinical Trial<br />Hoster<br />Vendor<br />On Premise<br />Cloud<br />
    22. 22. “Packaged”<br />Application<br />Big Pharmaceutical Example<br />Hosted <br />“Packaged”<br />“Packaged”<br />using cloud <br />“Software as a Service”<br />Buy<br />ERP<br />CRM<br />Email<br />HR System<br />Build vs. Buy<br />“Home Built”<br />Application<br />Hosted <br />“Home Built”<br />“Home Built”<br />using cloud <br />“Platform as a Service”<br />Molecule Research<br />Build<br />“THIS is where I want to spend my IT resources – I’m going to double down on this application!”<br />Clinical Trial<br />Hoster<br />Vendor<br />On Premise<br />Cloud<br />
    23. 23. Where the Cloud is Compelling<br />
    24. 24. Only 2 reasons to use the cloud<br />
    25. 25. Windows Azure VMs<br />Small<br />Medium<br />Large <br />X Large<br />$0.12 <br />$0.24 <br />$0.48 <br />$0.96 <br />Per service hour<br />Per service hour<br />Per service hour<br />Per service hour<br />1 x 1.6Ghz <br />2 x 1.6Ghz <br />4 x 1.6Ghz <br />8 x 1.6Ghz<br />(moderate IO) <br />(high IO)<br />(high IO) <br />(high IO)<br />1.75 GB memory <br />3.5 GB memory <br />7.0 GB memory<br />14 GB memory<br />
    26. 26. Windows Azure, In One Picture<br />Business Portal<br />Developer Portal<br />Service Management Service<br />REST<br />User Code<br />…<br />…<br />Runtime API<br />Storage Cluster<br />VS Tools<br />Compute Cluster<br />…<br />WA SDK<br />VM Setup<br />REST<br />MSFT Datacenters<br />Desktop<br />Cloud VM<br />
    27. 27. Determine an ROI<br />Consider:<br /><ul><li>Current hosting costs
    28. 28. Current staff costs
    29. 29. Cooling/power/space
    30. 30. Migration costs
    31. 31. Licensing</li></ul>AzureROI.CloudApp.net<br />
    32. 32.
    33. 33. ZENDFRAMEWORK<br />
    34. 34. Digging into Azure with PHP/Ruby<br />
    35. 35. Windows Azure, In One Picture<br />Business Portal<br />Developer Portal<br />Service Management Service<br />REST<br />User Code<br />…<br />…<br />Runtime API<br />Storage Cluster<br />VS Tools<br />Compute Cluster<br />…<br />WA SDK<br />VM Setup<br />REST<br />MSFT Datacenters<br />Desktop<br />Cloud VM<br />
    36. 36. Windows Azure Roles<br />WorkerRole<br /><ul><li>Internal Facing
    37. 37. TCP/HTTP Endpoint
    38. 38. Long running processes
    39. 39. Think Service or Deamon</li></ul>WebRole<br /><ul><li>External Facing
    40. 40. HTTP/HTTPS Endpoint
    41. 41. Short lived calls
    42. 42. Think Web Server</li></li></ul><li>Running PHP in Windows Azure<br />How to Do It<br />Host in Web role (like .NET)<br />Supply PHP runtime<br />Point to runtime via FastCGI configuration in<br />Web.config<br />Web.roleConfig<br />PHP <br />Web Role<br />Instance 1<br />VIP<br />Load Balancer<br />PHP <br />Web Role<br />Instance 2<br />
    43. 43. Windows Azure 4 Eclipse<br />Does a lot of the heavy lifting for you<br />Creates the Web.config, Web.roleConfig, PHP implementation and debugs in the dev fabric<br />http://windowsazure4e.org<br />
    44. 44. Running EXEs in the Worker Process<br />Start with a Worker Role Process to <br />Copy the exes to the worker role’s app directory<br />Execute the process<br />Monitor the health of the process<br />Other auxiliary tasks…<br />
    45. 45. Running Ruby in the Worker Process<br />http://code.msdn.microsoft.com/railsonazure<br />Download and extract the solution <br />Copy the Ruby bin and lib folders to the Ruby folder in the RR project <br />Copy your rails application to the RailsApp folder in the RR project <br />Open the solution in Visual Studio <br />Run in the Dev Fabric<br />Navigate to http://127.0.0.1:5100<br />
    46. 46. Data Storage<br />
    47. 47. Storage options<br />Windows Azure Data<br />Sql Azure<br />
    48. 48. Windows Azure Data Storage<br />Queue<br />Blob<br />Account<br />Tables<br />Drives<br />
    49. 49. Azure Platform Data Storage Options<br /><ul><li>Windows Azure Data Storage
    50. 50. Blobs
    51. 51. Unstructured data storage
    52. 52. Tables
    53. 53. Semi-structured or tabular data storage
    54. 54. Queues
    55. 55. Buffered delivery data storage
    56. 56. Drives
    57. 57. Durable NTFS volumes that Windows Azure applications can use. See: http://microsoftpdc.com/Sessions/SVC14</li></ul>SQL Azure<br /><ul><li>Relational data storage</li></li></ul><li>Admin Windows Azure Data Storage<br />
    58. 58. Windows Azure Data Storage<br />
    59. 59. PHP with Windows Azure Storage<br />Windows Azure SDK for PHP @ http://phpazure.codeplex.com<br />PHP programming model for Windows Azure Storage<br />Features <br />PHP classes for Blobs, Tables & Queues<br />Store PHP sessions in Table Storage<br />
    60. 60. Windows Azure Data Storage - Blobs<br />Unstructured data storage<br />Partitioned by container<br />Unlimited containers<br />
    61. 61. Blobs Sample<br />$blobStorage= new Microsoft_WindowsAzure_Storage_Blob();<br />// Create<br />if (!$blobStorage->containerExists($containerName))<br />{<br />$blobStorage->createContainer($containerName);<br />$blobStorage->setContainerAcl($containerName, <br />Microsoft_WindowsAzure_Storage_Blob::ACL_PUBLIC);<br />}<br />// Store<br />$blob = $blobStorage->putBlob($containerName, $blobName, <br />$localFilename, $metadata);<br />/* @var $blob Microsoft_WindowsAzure_Storage_BlobInstance */<br />
    62. 62. Blobs Sample Cont…<br />// Copy<br />$result = $blobStorage->copyBlob(<br /> $containerName, $blobName, $containerName, $blob2Name);<br />// Retrieve<br />$tempStore= azure_getlocalresourcepath('tempstore');<br />$tempPath= $tempStore. 'apos; . $imageId;<br />$blobStorage->getBlob($containerName, $blobName, $tempPath);<br />// Delete<br />$result = $blobStorage->deleteBlob($containerName, $blobName);<br />$result = $blobStorage->deleteContainer($containerName);<br />
    63. 63. Blob Stream Wrapper<br />$blobStorage= new Microsoft_WindowsAzure_Storage_Blob();<br />// Register:<br />$blobStorage->registerStreamWrapper(); // registers azure://<br />// or<br />$blobStorage->registerStreamWrapper('blob://'); // use blob://<br />// Use<br />$fp= fopen('azure://mycontainer/myfile.txt', 'r');<br />// ...<br />fclose($fp);<br />
    64. 64. Storage: XDrive<br />NTFS drive in the cloud: X:<br />Fixed size between 16MB and 1TB<br />Max 8 drives on your VM<br />Implemented as a page blob<br />Single instance write<br />Multiple instance read<br />
    65. 65. Queue Workflow Concepts<br />Windows Azure Queue Provides<br />Guarantee delivery (two-step consumption)<br />Worker Dequeues Message and mark it as Invisible<br />Worker Deletes Message when finished processing it<br />If Worker role crashes, message becomes visible for another Worker to process<br />Doesn’t guarantee “only once” delivery<br />Doesn’t guarantee ordering<br />Best effort FIFO<br />Worker Role<br />Web Role<br />Input Queue (Work Items)<br />Worker Role<br />Azure Queue<br />Web Role<br />Worker Role<br />Web Role<br />Worker Role<br />
    66. 66. Azure Queues<br />RemoveMessage<br />GetMessage (Timeout)<br />Worker Role<br />PutMessage<br />Queue<br />Msg 1<br />Msg 2<br />Msg 2<br />Msg 1<br />Web Role<br />Worker Role<br />Worker Role<br />Msg 3<br />Msg 4<br />Msg 2<br />
    67. 67. Loosely Coupled Work with Queues<br />Worker-Queue Model<br />Load work in a queue<br />Many workers consume the queue<br />Input Queue (Work Items)<br />Azure Queue<br />Worker Role<br />Web Role<br />Worker Role<br />Web Role<br />Worker Role<br />Web Role<br />Worker Role<br />
    68. 68. Queues<br />$queueClient= new Microsoft_WindowsAzure_Storage_Queue();<br />// Create<br />$result = $queueClient->createQueue('imageQueue');<br />// Delete<br />$queueClient->deleteQueue('imageQueue');<br />// Add message<br />$queueClient->putMessage('imageQueue', $message, $ttl);<br />// Retrieve Messages<br />$messages = $queueClient->getMessages('imageQueue', 10);<br />foreach($messages as $message) {<br />// Do work here...<br />$queueClient->deleteMessage('imageQueue', $message);<br />}<br />
    69. 69. Windows Azure Data Storage - Tables<br />Semi-Structured data<br />Tables contain entities<br />Entities contain properties<br />May be partitioned across thousands of servers.<br />Support ACID transactions over single entities<br />Queries over entire table<br />.NET and REST interfaces<br />
    70. 70. Windows Azure Data Storage – Tables (Terms Part 1)<br />Table<br />Contains a set of entities. <br />Entity (Row) <br />Basic data items stored in a table. <br />Property (Column)<br />Single value in an entity. <br />RowKey<br />Unique ID of the entity within a partition<br />Timestamp<br />Time it was created<br />
    71. 71. Windows Azure Data Storage – Tables (Terms Part 2)<br />Partition <br />Entities in a table with the same partition key<br />PartitionKey<br />Segments entities in to partitions to automatically distribute the table’s entities over many storage nodes.<br />Sort Order<br />There is a single index provided for the CTP, where all entities in a table are sorted by PartitionKey and then RowKey<br />
    72. 72. Key Example – Blog Posts<br />Partition 1<br />Partition 2<br />Getting all of dunnry’s blog posts is fast<br />Single partition<br />Getting all posts after 2008-03-27 is slow<br />Traverse all partitions<br />
    73. 73. Table Sample<br />$tableStorage= new Microsoft_WindowsAzure_Storage_Table(<br />'table.core.windows.net', 'myaccount', 'myauthkey');<br />// Create<br />$result = $tableStorage->createTable($tableName);<br />// List <br />$result = $tableStorage->listTables();<br />foreach($result as $table) {<br />echo 'Table name is: ' . $table->Name . " ";<br />}<br />// Delete<br />$tableStorage->deleteTable($tableName);<br />
    74. 74. Tables with Entities<br />// Structured entity<br />class ImageEntityextends <br />Microsoft_WindowsAzure_Storage_TableEntity<br />{<br />/**<br /> * @azure filename<br /> */<br />public $filename;<br />/**<br /> * @azure size Edm.Int64<br /> */<br />public $size;<br />}<br />// Unstructured entity<br />// Microsoft_WindowsAzure_Storage_DynamicTableEntity<br />
    75. 75. Tables with Entities Cont…<br />// Insert<br />$image = new ImageEntity($partitionKey, $rowKey);<br />$image->filename = $_FILES['imageUpload']['name'];<br />$image->size = $_FILES['imageUpload']['size'];<br />$image = $tableStorageClient->insertEntity($tableName, $image);<br />// Retrieve<br />$image = $tableStorage->retrieveEntityById($tableName, <br />$partitionKey, $rowKey, 'ImageEntity');<br />// Update<br />$image->filename = 'newname.jpg';<br />$result = $tableStorage->updateEntity($tableName, $image);<br />// Delete<br />$result = $tableStorage->deleteEntity($tableName, $image);<br />
    76. 76. Table Queries<br />// Filter condition<br />$select = "filesizegt 1024 and PartitionKeyeq '$partitionKey'";<br />// Or fluent interface<br />$select = $tableStorage->select()->from($tableName)<br /> ->where('filesizegt 1024')<br /> ->andWhere('PartitionKeyeq ?', $partitionKey);<br />// Run query<br />$images = $tableStorage->storageClient->retrieveEntities(<br />'testtable', $select, 'ImageEntity'<br />);<br />foreach($images as $image) {<br />echo 'Name: ' . $image->filename . " ";<br />}<br />
    77. 77. Batching Operations<br />// Start batch<br />$batch = $tableStorage->startBatch();<br />// Insert multiple<br />$images = generateEntities();<br />foreach($images as $image) {<br />$tableStorage->insertEntity($tableName, $image);<br />}<br />// Commit<br />$batch->commit();<br />
    78. 78. Table session handler<br />$sessionHandler<br /> = new Microsoft_WindowsAzure_SessionHandler($tableStorage);<br />$sessionHandler->register();<br />session_start();<br />if (!isset($_SESSION['start'])) {<br />$_SESSION['start'] = time();<br />}<br />
    79. 79. SQL Azure and Windows Azure Table Comparison<br />Windows Azure Tables<br />SQL Azure Tables<br />Semi-structured<br />Loosely typed<br />Non-Relational (Not RDMS)<br />Massively scalable<br />Fully structured<br />Strongly typed<br />Relational (RDMS)<br />Highly scalable<br />
    80. 80. MySQL: Simple Configuration<br />VIP<br />Load Balancer<br />Web Role<br />MySQL<br />Worker Role<br />
    81. 81. MySQL in a Windows Azure Application<br />Running MySQL in a worker role<br />Copy MySQL to the worker role sub-directory<br />Copy to read-write local storage<br />Configure MySQL to listen on the right port<br />Monitor MySQL health<br />Consuming MySQL<br />Discover IP address and port<br />Normal access from then on<br />Handle topology changes<br />
    82. 82. Simple Configuration<br />VIP<br />Load Balancer<br />MySQL<br />
    83. 83. Replication<br />VIP<br />Load Balancer<br />M<br />S<br />S<br />MySQL<br />MySQL<br />MySQL<br />
    84. 84. Windows Azure Drive with Hot Spare<br />VIP<br />Load Balancer<br />MySQL<br />MySQL<br />
    85. 85. Windows Azure Drive with Hot Spare<br />VIP<br />Load Balancer<br />MySQL<br />MySQL<br />
    86. 86. SQL Azure<br />
    87. 87. SQL Azure Features<br />Supported<br />Tables, Indexes, Views<br />Stored Procedures<br />Triggers<br />Constraints<br />Table Variables<br />Temp Tables (#Name)<br />Not Supported<br />Physical Server Access <br />Catalog DDL<br />Common Language Runtime<br />Service Broker<br />Reporting Services<br />Analysis Services<br />Distributed Transactions and Queries<br />
    88. 88. SQL AzureDeployment<br />Web Portal<br />(API)<br />DB Script<br />SQL Azure<br />TDS<br />
    89. 89. SQL AzureAccessing databases<br />Web Portal<br />(API)<br />Your App<br />SQL Azure<br />TDS<br />Change Connection String<br />
    90. 90. Database Replicas<br />Single Database<br />Multiple Replicas<br />Replica 1<br />Single Primary<br />Replica 2<br />DB<br />Replica 3<br />
    91. 91. SQL AzureDatabase Monitoring & Recovery<br />Web Portal<br />(API)<br />!<br />Your App<br />SQL Azure<br />TDS<br />
    92. 92. SQL Azure Server Creation<br />
    93. 93. SQL Azure Firewall Maintenance<br /><ul><li>Simple rules
    94. 94. Easy one-screen portal maintenance</li></li></ul><li>SQL Azure Database Connection String<br />An administrative user is created with the server<br />User has system administrator permissions likesa”<br />Server=tcp:itte80vcfq.database.windows.net; Database=FabrikamAzureDB;User ID=SaPaulM;Password=myPassword;Trusted_Connection=False;Encrypt=True;<br />
    95. 95. Database Migrations<br />Scripts<br />Transfer Schema<br />BCP<br />Transfer Data<br />SSIS (SQL Server Integration Service)<br />Transfer Schema and Data<br />
    96. 96. Database Migrations (Cont.)<br />The SQL Azure Migration Wizard helps you migrate your local SQL Server 2005 / 2008 databases into SQL Azure. The wizard walks you through the selection of your SQL objects, creates SQL scripts suitable for SQL Azure, and allows you to migrate your data.”<br />http://sqlazuremw.codeplex.com/<br />
    97. 97. Database Management using SQL Management Studio<br />
    98. 98. PHP with SQL Azure<br />SQL Server Driver for PHP @ http://sqlsrvphp.codeplex.com/<br />Supports PHP access to SQL Azure<br />Features<br />Choose between SQL Server and SQL Azure by changing connection string<br />Use from on-premises or in Windows Azure<br />
    99. 99.
    100. 100. More resources<br />Microsoft Windows Azure Interop<br />http://www.microsoft.com/windowsazure/interop/<br />Interop Bridges<br />http://www.interoperabilitybridges.com/<br />
    101. 101. More resources<br />PHP<br />http://www.windowsazure4e.org<br />http://phpazure.codeplex.com/<br />MySQL<br />Windows Azure MySQL PHP Solution Accelerator<br />http://code.msdn.microsoft.com/winazuremysqlphp<br />
    102. 102. More resources<br />Python<br />Sriram Krishnan<br />http://www.sriramkrishnan.com/blog/2008/11/python-wrapper-for-windows-azure.html<br />Ruby<br />Simon Davies<br />http://blogs.msdn.com/simondavies<br />http://code.msdn.microsoft.com/railsonazure<br />Johnny Halife<br />http://github.com/johnnyhalife/waz-storage<br />http://waz-storage.heroku.com/rdoc/index.html<br />
    103. 103. And of course<br />Josh Holmes<br />http://www.joshholmes.com<br />
    104. 104. Scaling Big while Sleeping Well<br />Josh Holmes<br />@joshholmes<br />josh.holmes@microsoft.com<br />www.joshholmes.com<br />
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×