running php on the windows azure platform

21
Running PHP on the Windows Azure Platform Brian Swan PHP Developer Advocate Microsoft [email protected] @ brian_swan http://blogs.msdn.com/b/brian_swan http://blogs.msdn.com/b/silverlining

Upload: corine

Post on 24-Feb-2016

49 views

Category:

Documents


0 download

DESCRIPTION

Running PHP on the Windows Azure Platform. Brian Swan PHP Developer Advocate Microsoft [email protected] @ brian_swan http://blogs.msdn.com/b/brian_swan http://blogs.msdn.com/b/silverlining. Lots I could talk about…. Why is PHP 5.3 faster on Windows than previous versions of PHP? - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Running PHP on the  Windows Azure Platform

Running PHP on the Windows Azure Platform

Brian SwanPHP Developer Advocate

[email protected] @brian_swan

http://blogs.msdn.com/b/brian_swanhttp://blogs.msdn.com/b/silverlining

Page 3: Running PHP on the  Windows Azure Platform

But I’ll tour Windows Azure(by looking at auto-scaling)

Page 4: Running PHP on the  Windows Azure Platform

Windows Azure Boot Camp WindowsAzureBootCamp.com

Windows Azure Platform Overview

ON-PREMISES LOB ApplicationsComposite applications

Developer ExperienceUse existing skills and tools.

Compute Storage Management Relational data Management Connectivity Access control

AppFabric

Page 5: Running PHP on the  Windows Azure Platform

Packaged Software

Storage

Servers

Networking

O/S

Middleware

Virtualization

Data

Applications

Runtime

You

man

age

Infrastructure(as a Service)

Storage

Servers

Networking

O/S

Middleware

Virtualization

Data

Applications

Runtime

Managed by vendor

You

man

age

Platform(as a Service)

Managed by vendor

You

man

age

Storage

Servers

Networking

O/S

Middleware

Virtualization

Applications

Runtime

Data

Software(as a Service)

Managed by vendor

Storage

Servers

Networking

O/S

Middleware

Virtualization

Applications

Runtime

Data

What type of cloud is Windows Azure?

Page 6: Running PHP on the  Windows Azure Platform

What are Web and Worker roles?

Web Role• External Facing • HTTP/HTTPS

Endpoint• Short lived calls(Think Web Server)

Worker Role• Internal Facing • TCP/HTTP Endpoint• Long running

processes(Think Service or

Deamon)There is also a VM Role • You configure and maintain the OS.• Lacks persistent state.

In general, think of a “role” as on OS template.

Page 7: Running PHP on the  Windows Azure Platform

Instance Sizes and Costs

Size Cores CPU Speed Memory Cost/hour

Ex. Small Shared 1.0 GHz 768 MB $0.04

Small 1 1.6 GHz 1.75 GB $0.12

Medium 2 1.6 GHz 3.5 GB $0.24

Large 4 1.6 GHz 7 GB $0.48

Ex. Large 8 1.6 GHz 14 GB $0.96

Page 8: Running PHP on the  Windows Azure Platform

What is Azure Storage?

Blobs: large, unstructured binary data (audio, video, etc.)

Tables: simply (and loosely) structured data (not relational)

Queues: serially accessed messages

Storage Costs $0.14 GB/month*

$0.01/10k transactions

* http://blogs.msdn.com/b/windowsazure/archive/2011/10/27/microsoft-lowers-storage-cost-for-blob-and-table-storage-in-windows-azure.aspx

Transfer Costs $0.15 GB outbound

Don’t forget

Page 9: Running PHP on the  Windows Azure Platform

Azure Table StoragePartition Key

Row Key Timestamp DeliveryAddress OrderAmount

Kirk NC1701 10/24/2011 6:05:15 PM

6855 Kobayashi Maru Drive

$35,490.00

Kirk NC1701A 10/23/2011 6:09:10 PM

409 Tiberious Road

$98.99

Kirk NC1701B 10/24/2011 6:00:15 AM

1024 Priceline Ave

$4,523.99

Archer 31415 11/20/2010 8:05:15 AM

999 Sliders Blvd $5,780.99

Archer 1 10/04/2011 6:55:15 PM

1405 Suliban Road

$55.39

Archer 234 09/24/2011 6:05:15 AM

DS9, Level 29, Suite 782

$1.58

Bender 1 10/24/2010 7:05:15 PM

900 South Futurama Drive

$87,399.99

VIN

12345

KJUDH

Super Fast• Unique Partition Key

Very Fast• Partition Key + Row Key

Slower

• Only Partition Key• No Row Key

Slowest

• No Partition Key• No Row Key

Query Performance

Page 10: Running PHP on the  Windows Azure Platform

Azure Blob Storage

BlobContainerAccount

mymedia

images

PIC01.JPG

videos

http://<account>.blob.core.windows.net/<container>/<blobname>

PIC02.JPG

VID01.AVI

Page 11: Running PHP on the  Windows Azure Platform

Containers and Blobs• Containers

– Multiple containers per account– Create/destroy on the fly– One container can hold up to 100 TB* worth of blobs– Set access policies (private, public read, full public read)– Set metadata

• No search/query (i.e. no WHERE MetadataValue = ?)

• Blobs– A blob can be up to 1 TB in size– Set access policy– Set metadata

*100 TB is the size limit for an entire storage account

Page 12: Running PHP on the  Windows Azure Platform

What is the Diagnostics Monitor?An Azure component (MonAgentHost.exe) that collects diagnostic data for application instances– Starts automatically by default– Must define a storage account connection string

Page 13: Running PHP on the  Windows Azure Platform

How does it work (in a nutshell)?

Role Instance Starts Diagnostic Monitor Starts Monitor is configured

Imperatively at Start time Remotely any time

Monitor buffers data locally User can set a quota (FIFO)

User initiates transfer to storage Scheduled or On Demand

Role

Role Instance

Diagnostic Monitor

Local directory storage

Windows Azure Storage

Page 14: Running PHP on the  Windows Azure Platform

Diagnostic Data SourcesData Source Default Destination

Trace Logs Enabled Table

Diagnostic Infrastructure Logs Enabled Table

IIS Logs Enabled Blob

Performance Counters Disabled Table

Windows Event Logs Disabled Table

IIS Failed Request Logs Disabled Blob

Crash Dumps Disabled Blob

Arbitrary Files Disabled Blob

Page 15: Running PHP on the  Windows Azure Platform

What is the Management API?

• A REST API that allows you to manage services under an Azure subscription.– Examples include…

• Create/stop/start/delete a deployment• Move staging deployment to production• Increasing the number of instances• Initiate a rolling upgrade• Etc.• (almost anything you can do via the management portal)

• All API calls must be signed with an X509 certificate

Page 16: Running PHP on the  Windows Azure Platform

Windows Azure SDK for PHP• http://phpazure.codeplex.com/

– Open Source project– Mostly platform independent (only the packaging tools have a Windows

dependency)

• Features – PHP classes for Windows Azure Blobs, Tables & Queues– Scaffolds for quick application deployment– Helper Classes for HTTP transport, AuthN/AuthZ, REST & Error Management – Manageability, Instrumentation & Logging support – Support for storing PHP sessions in Azure Table Storage – Management API client – Diagnostics client – Command line tools set for packaging, management , diagnostics, and deployment

Page 17: Running PHP on the  Windows Azure Platform

DemoAuto-scaling a Windows Azure/PHP application

Windows Azure SDK for PHP + …

Page 18: Running PHP on the  Windows Azure Platform

Code

• GolferMessageBoard code is on the TechNet Wiki: http://social.technet.microsoft.com/wiki/contents/articles/use-the-windows-azure-web-role-and-windows-azure-blob-service-with-php.aspx

• Auto-scaling code is on GitHub: https://github.com/brian-swan/PHP-Auto-Scaler – Read about it here: http://

blogs.msdn.com/b/silverlining/archive/2011/10/05/an-auto-scaling-module-for-php-applications-in-windows-azure.aspx

Page 19: Running PHP on the  Windows Azure Platform

Other Resources• http://blogs.msdn.com/b/silverlining

– A PHP on Windows Azure Learning Plan• http://blogs.msdn.com/b/brian_swan• https://github.com/brian-swan• http://azurephp.interoperabilitybridges.com/• Why is PHP 5.3 faster on Windows than previous versions of P

HP?

• Version 3.0 (beta) of the SQL Server Driver for PHP is available.• SQL Server ODBC driver for Linux is coming.• Hadoop for Windows Server/Azure is coming.

Page 20: Running PHP on the  Windows Azure Platform

Try It Out

http://www.microsoft.com/windowsazure/free-trial/

Page 21: Running PHP on the  Windows Azure Platform

Q & A?