Microsoft/Zend Webcast on Cloud Computing

42
Cloud Computing with Zend Framework and Windows Azure Josh Holmes @joshholmes josh.holmes@microsoft .com www.joshholmes.com

description

This is the presentation that I presented during a webcast with Microsoft and Zend on Cloud Computing. The demo focused on the SimpleCloud.org API

Transcript of Microsoft/Zend Webcast on Cloud Computing

Page 1: Microsoft/Zend Webcast on Cloud Computing

Cloud Computing with Zend

Framework and Windows Azure

Josh Holmes@joshholmes

[email protected]

Page 2: Microsoft/Zend Webcast on Cloud Computing

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

Page 3: Microsoft/Zend Webcast on Cloud Computing

We are all excited about the cloud

Page 4: Microsoft/Zend Webcast on Cloud Computing

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

Page 5: Microsoft/Zend Webcast on Cloud Computing

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

Page 6: Microsoft/Zend Webcast on Cloud Computing

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

Page 7: Microsoft/Zend Webcast on Cloud Computing

The Microsoft Cloud~100 Globally Distributed Data Centers

Quincy, WA Chicago, IL San Antonio, TX Dublin, Ireland Generation 4 DCs

Page 8: Microsoft/Zend Webcast on Cloud Computing
Page 9: Microsoft/Zend Webcast on Cloud Computing

ZENDFRAMEWORK

Page 10: Microsoft/Zend Webcast on Cloud Computing

Two sides to talk about…

Compute Storage

Cloud VM

Runtime API

VM Setup

User Code

Page 11: Microsoft/Zend Webcast on Cloud Computing

Data Storage

Page 12: Microsoft/Zend Webcast on Cloud Computing

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

Page 13: Microsoft/Zend Webcast on Cloud Computing

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

Page 14: Microsoft/Zend Webcast on Cloud Computing

Windows Azure Data Storage

Account

Queue

Blob

Tables

Drives

Page 15: Microsoft/Zend Webcast on Cloud Computing

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

Page 16: Microsoft/Zend Webcast on Cloud Computing

Windows Azure Data Storage - Blobs

• Unstructured data storage

• Partitioned by container

• Unlimited containers

Page 17: Microsoft/Zend Webcast on Cloud Computing

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

Page 18: Microsoft/Zend Webcast on Cloud Computing

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

Page 19: Microsoft/Zend Webcast on Cloud Computing

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

Page 20: Microsoft/Zend Webcast on Cloud Computing

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

Page 21: Microsoft/Zend Webcast on Cloud Computing

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

Page 22: Microsoft/Zend Webcast on Cloud Computing

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

Page 23: Microsoft/Zend Webcast on Cloud Computing

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

Page 24: Microsoft/Zend Webcast on Cloud Computing

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

Page 25: Microsoft/Zend Webcast on Cloud Computing

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

Page 26: Microsoft/Zend Webcast on Cloud Computing

SQL Azure

Page 27: Microsoft/Zend Webcast on Cloud Computing

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

Page 28: Microsoft/Zend Webcast on Cloud Computing

SQL AzureDeployment

Web Portal(API)

SQL AzureTDS

DB Script

Page 29: Microsoft/Zend Webcast on Cloud Computing

SQL AzureAccessing databases

Web Portal(API)

SQL AzureTDS

Your App

Change Connection String

Page 30: Microsoft/Zend Webcast on Cloud Computing

Database Replicas

Replica 1

Replica 2

Replica 3

DB

Single Database Multiple Replicas

Single Primary

Page 31: Microsoft/Zend Webcast on Cloud Computing

SQL AzureDatabase Monitoring & Recovery

Web Portal(API)

SQL AzureTDS

Your App !

Page 32: Microsoft/Zend Webcast on Cloud Computing

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;

Page 33: Microsoft/Zend Webcast on Cloud Computing

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

Page 34: Microsoft/Zend Webcast on Cloud Computing

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

Page 35: Microsoft/Zend Webcast on Cloud Computing

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

Page 36: Microsoft/Zend Webcast on Cloud Computing

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

Page 37: Microsoft/Zend Webcast on Cloud Computing

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…

Page 38: Microsoft/Zend Webcast on Cloud Computing
Page 39: Microsoft/Zend Webcast on Cloud Computing

More resources

• Microsoft Windows Azure Interop• http://www.microsoft.com/windowsazure/interop/

• Interop Bridges• http://www.interoperabilitybridges.com/

Page 40: Microsoft/Zend Webcast on Cloud Computing

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

Page 41: Microsoft/Zend Webcast on Cloud Computing

And of course

• Josh Holmes● http://www.joshholmes.com

Page 42: Microsoft/Zend Webcast on Cloud Computing

Cloud Computing with Zend

Framework and Windows Azure

Josh Holmes@joshholmes

[email protected]