Agenda
• Testing the Waters● What is cloud computing?● What are the advantages of cloud computing?● How’s Azure fit in?
• Diving Deep● Digging into PHP on Azure● Leveraging Azure Storage● Leveraging SQL Azure
We are all excited about the cloud
In House or Hosted Servers
TIME
IT C
APA
CIT
Y
Actual Load
Allocated IT-
capacities
“Waste“ of capacities
“Under-supply“ of capacities
Fixed cost of IT-capacities
Load Forecast
Barrier forinnovations
Cloud Computing
Actual Load
Allocated IT capacities
Reduction of initial
investments
Reduction of “over-
supply“
No “under-supply“
Possible reduction of IT-capacities
in case of reduced load
Time
IT C
APA
CIT
YLoad
Forecast
Private(On-Premise)
Types of Hosting Solutions
Storage
Server HW
Networking
Servers
Databases
Virtualization
Runtimes
Applications
Security & Integration
You
man
age
Platform(as a
Service)
Storage
Server HW
Networking
Servers
Databases
Virtualization
Runtimes
Applications
Security & Integration M
anaged by vendor
You
man
age
Runtimes
Infrastructure
(as a Service)
Storage
Server HW
Networking
Servers
Databases
Virtualization
Applications
Security & Integration
Managed by vendor
You
man
age
The Microsoft Cloud~100 Globally Distributed Data Centers
Quincy, WA Chicago, IL San Antonio, TX Dublin, Ireland Generation 4 DCs
ZENDFRAMEWORK
Two sides to talk about…
Compute Storage
Cloud VM
Runtime API
VM Setup
User Code
Data Storage
PHP with Windows Azure Storage• SimpleCloud API @
http://simplecloud.org
• Windows Azure SDK for PHP @ http://phpazure.codeplex.com
• PHP programming model for Windows Azure Storage
• Features ● PHP classes for Blobs, Tables & Queues● Store PHP sessions in Table Storage
Windows Azure 4 Eclipse
• Does a lot of the heavy lifting for you• Creates the Web.config, Web.roleConfig,
PHP implementation and debugs in the dev fabric
• http://windowsazure4e.org
• Does a lot of the heavy lifting for you
Windows Azure Data Storage
Account
Queue
Blob
Tables
Drives
Azure Platform Data Storage Options
• 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
• SQL Azure• Relational data storage
Windows Azure Data Storage - Blobs
• Unstructured data storage
• Partitioned by container
• Unlimited containers
Storage: XDrive
● NTFS drive in the cloud: X:\● Fixed size between 16MB and 1TB● Max 8 drives on your VM● Implemented as a page blob● Single instance write● Multiple instance read
Queue Workflow Concepts
• Windows Azure Queue Provides● Guarantee delivery (two-step consumption)
1. Worker Dequeues Message and mark it as Invisible
2. Worker Deletes Message when finished processing it
If Worker role crashes, message becomes visible for another Worker to process
● Doesn’t guarantee “only once” delivery● Doesn’t guarantee ordering
• Best effort FIFO
Azure QueueInput Queue (Work Items)
Web Role
Web Role
Web Role
Worker Role
Worker Role
Worker Role
Worker Role
Azure Queues
Queue
Msg 1
Msg 2
Msg 3
Msg 4
Worker Role
Worker Role
PutMessage
Web Role
GetMessage (Timeout)
RemoveMessage
Msg 2Msg 1
Worker Role
Msg 2
Loosely Coupled Work with Queues
• Worker-Queue Model● Load work in a queue● Many workers consume the queue
Azure Queue
Input Queue (Work Items)
Web Role
Web Role
Web Role
Worker Role
Worker Role
Worker Role
Worker Role
Windows Azure Data Storage - Tables• Semi-Structured data• Tables contain entities• Entities contain properties• May be partitioned across
thousands of servers.• Support ACID transactions
over single entities• Queries over entire table• .NET and REST interfaces
Windows Azure Data Storage – Tables (Terms Part 1)• Table
● Contains a set of entities. • Entity (Row)
● Basic data items stored in a table. • Property (Column)
● Single value in an entity. • RowKey
● Unique ID of the entity within a partition• Timestamp
● Time it was created
Windows Azure Data Storage – Tables (Terms Part 2)• Partition
● Entities in a table with the same partition key• PartitionKey
● Segments entities in to partitions to automatically distribute the table’s entities over many storage nodes.
• Sort Order● There is a single index provided for the CTP,
where all entities in a table are sorted by PartitionKey and then RowKey
Key Example – Blog Posts
• Getting all of dunnry’s blog posts is fast● Single partition
• Getting all posts after 2008-03-27 is slow● Traverse all partitions
Partition KeyAuthor
Row KeyPermalink
Property 3ChangedO
nProperty 4
Title
smarx i-love-tables 2009-07-04 I Love Tables!
smarx tables-are-awesome 2009-07-12 Tables are
Awesome!
dunnry cheetos 2008-03-27 I Love Cheetos
dunnry blogging-again 2009-07-15 Finally Blogging
Again
dunnry phluffyfotos 2008-04-09 PhluffyFotos!
Partition 1
Partition 2
SQL Azure and Windows Azure Table Comparison
SQL Azure Tables• Fully structured• Strongly typed• Relational (RDMS)• Highly scalable
Windows Azure Tables• Semi-structured• Loosely typed• Non-Relational (Not RDMS)• Massively scalable
SQL Azure
SQL Azure Features
• Supported● Tables, Indexes, Views● Stored Procedures● Triggers● Constraints● Table Variables● Temp Tables (#Name)
• Not Supported● Physical Server Access ● Catalog DDL● Common Language
Runtime● Service Broker● Reporting Services● Analysis Services● Distributed
Transactions and Queries
SQL AzureDeployment
Web Portal(API)
SQL AzureTDS
DB Script
SQL AzureAccessing databases
Web Portal(API)
SQL AzureTDS
Your App
Change Connection String
Database Replicas
Replica 1
Replica 2
Replica 3
DB
Single Database Multiple Replicas
Single Primary
SQL AzureDatabase Monitoring & Recovery
Web Portal(API)
SQL AzureTDS
Your App !
SQL Azure Database Connection String
• An administrative user is created with the server
• User has system administrator permissions like sa”
• Server=tcp:itte80vcfq.database.windows.net; Database=FabrikamAzureDB;User ID=SaPaulM;Password=myPassword;Trusted_Connection=False;Encrypt=True;
Windows Azure VMsSmall
$0.12 Per service hour
Medium
$0.24 Per service hour
Large
$0.48 Per service hour
X Large
$0.96 Per service hour
1 x 1.6Ghz (moderate IO)
1.75 GB memory
2 x 1.6Ghz (high IO)
3.5 GB memory
4 x 1.6Ghz (high IO)
7.0 GB memory
8 x 1.6Ghz(high IO)
14 GB memory
Windows Azure, In One Picture
Desktop
VS Tools
WA SDK
Sto
rage
Clu
ster
MSFT Datacenters
Business Portal
Developer Portal
Com
pute
Clu
ster
……
Service Management Service
REST
REST…
Cloud VM
Runtime API
VM Setup
User Code
Windows Azure Roles
WebRole• External Facing • HTTP/HTTPS
Endpoint• Short lived calls
• Think Web Server
WorkerRole• Internal Facing • TCP/HTTP
Endpoint• Long running
processes
• Think Service or Deamon
Running PHP in Windows Azure• How to Do It
● Host in Web role (like .NET)● Supply PHP runtime● Point to runtime via FastCGI
configuration in• Web.config• Web.roleConfig
PHP Web RoleInstance 2
VIP
Load
Bal
ance
r
PHP Web RoleInstance 1
Running EXEs in the Worker Process
• Start with a Worker Role Process to ● Copy the exes to the worker role’s app
directory● Execute the process● Monitor the health of the process● Other auxiliary tasks…
More resources
• Microsoft Windows Azure Interop• http://www.microsoft.com/windowsazure/interop/
• Interop Bridges• http://www.interoperabilitybridges.com/
More resources
• PHP• http://www.windowsazure4e.org • http://simplecloud.org • http://phpazure.codeplex.com/
• MySQL● Windows Azure MySQL PHP Solution
Accelerator• http://code.msdn.microsoft.com/winazuremysqlphp