Using PHP and M y SQL to Build Applications with Windows Azure

45
Using PHP and MySQL to Build Applications with Windows Azure Mohit Srivastava & Tushar Shanbhag SVC51

description

SVC51. Using PHP and M y SQL to Build Applications with Windows Azure. Mohit Srivastava & Tushar Shanbhag. Interoperability PHP & Eclipse memcached MySQL Customer Showcases Technology Drilldowns. Agenda. Windows Azure Capabilities On-Demand Computational Resources - PowerPoint PPT Presentation

Transcript of Using PHP and M y SQL to Build Applications with Windows Azure

Page 1: Using PHP and M y SQL to Build Applications with Windows Azure

Using PHP and MySQL to Build Applications with Windows AzureMohit Srivastava & Tushar Shanbhag

SVC51

Page 2: Using PHP and M y SQL to Build Applications with Windows Azure

Agenda> Interoperability

>PHP & Eclipse >memcached>MySQL

> Customer Showcases

> Technology Drilldowns

Page 3: Using PHP and M y SQL to Build Applications with Windows Azure

Windows Azure + Interoperability

> Windows Azure Capabilities> On-Demand Computational Resources> Storage at Massive Scale> Automated Service Management> Goal: Give You More Time to Write

Code

> …with Skills of your Choice> Languages> Tools> Application Components

PHP

Page 4: Using PHP and M y SQL to Build Applications with Windows Azure

Interoperability in this Session> Popular Technologies, Used by

> Sites: Facebook, Wikipedia> Apps: WordPress, MediaWiki

> …with Windows Azure Benefits> Get Started Easily: PHP/Eclipse Developer Experience> Maintain and Scale: Leverage Platform Primitives

> Cloud Storage> Inter-role Communication + Endpoint Discovery> …

PHP Web Development LanguageEclipse Development EnvironmentMySQL Relational Databasememcached

Distributed Memory Cache

Page 5: Using PHP and M y SQL to Build Applications with Windows Azure

Agenda> Interoperability

>PHP & Eclipse>memcached>MySQL

> Customer Showcases

> Technology Drilldowns

Page 6: Using PHP and M y SQL to Build Applications with Windows Azure

Using PHP with Windows Azure> Running PHP Code in Windows Azure

> Eclipse Tooling> Build, Test, Deploy PHP Projects> Create New or Use Existing PHP Projects

> Scaling PHP Apps

> Using Cloud Storage from PHP> Using Windows Azure Storage> Using SQL Azure

Page 7: Using PHP and M y SQL to Build Applications with Windows Azure

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

> Eclipse Tooling @ http://windowsazure4e.org does the above for you

PHP Web Role

Instance 2

VIP

Load

Ba

lanc

er PHP Web Role

Instance 1

Page 8: Using PHP and M y SQL to Build Applications with Windows Azure

Using PHP & Eclipse with Windows Azure

Demo

Page 9: Using PHP and M y SQL to Build Applications with Windows Azure

PHP + Cloud Storage

PHPWeb Role

VIP

Load

Ba

lanc

er

Windows Azure Storage

SQL Azure

PHP App

Windows Azure Platform

On-Premis

es

Page 10: Using PHP and M y SQL to Build Applications with Windows Azure

PHP with Windows Azure Storage> 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 11: Using PHP and M y SQL to Build Applications with Windows Azure

PHP with SQL Azure> SQL Server Driver for PHP @

http://sqlsrvphp.codeplex.com/

> Supports PHP access to SQL Azure

> Features> Choose between SQL Server and SQL

Azure by changing connection string> Use from on-premises or in Windows Azure

Page 12: Using PHP and M y SQL to Build Applications with Windows Azure

PHP + Cloud Storage

Windows Azure Storage & SQL Azure

Demo

Page 13: Using PHP and M y SQL to Build Applications with Windows Azure

Agenda> Interoperability

>PHP & Eclipse>memcached>MySQL

> Customer Showcases

> Technology Drilldowns

Page 14: Using PHP and M y SQL to Build Applications with Windows Azure

Customer Showcase: Adslot> Highly scalable auction service that enables

advertisers to realize significant discounts by bidding on combinations of keywords at a time

> Windows Azure Adoption Drivers> Computation-Heavy> Real-time Performance> Interop between .NET and non-.NET technologies

> ASP.NET> memcached, a distributed object cache

Page 15: Using PHP and M y SQL to Build Applications with Windows Azure

Customer Showcase: Adslot

Web Role

ComputationWorker Role

> memcached for ASP.NET MVC Models & Intermediate Computation Results

> Dynamically Scale memcached Tier

VIP

Load

Ba

lanc

er

memcached Worker Role

Page 16: Using PHP and M y SQL to Build Applications with Windows Azure

memcached Client Codeprivate MemcachedClient InitializeClient() { var client = new MemcachedClient(); foreach (var inst in RoleEnvironment.Roles["memcached"].Instances) { client.Add(inst.Id, inst.InstanceEndpoints["query"]); } return client; } public void Go() { // Initialize the memcached client var client = InitializeClient(); // Reinitialize the client when there is a topology change RoleEnvironment.Changed += (sender, args) => { if (args.Changes.Any(chg => chg is RoleEnvironmentTopologyChange)) { client = InitializeClient(); } }; // Use the client var value = client.Get("mykey"); }

Page 17: Using PHP and M y SQL to Build Applications with Windows Azure

memcached Solution Accelerator> Delivered by Infosys

> memcached Client (Web Role)> Uses Enyim client library> Supports “consistent” hashing, to

minimize cache invalidation when nodes are added or removed

> memcached Server (Worker Role)

Page 18: Using PHP and M y SQL to Build Applications with Windows Azure

Agenda> Interoperability

>PHP & Eclipse>memcached>MySQL

> Customer Showcases

> Technology Drilldowns

Page 19: Using PHP and M y SQL to Build Applications with Windows Azure

MySQL: Simple Configuration

Web

Rol

e

VIP

Load Balancer

Wor

ker

Role

MySQL

Page 20: Using PHP and M y SQL to Build Applications with Windows Azure

MySQL in a Windows Azure Application> Running MySQL in a worker role

> Copy MySQL to the worker role sub-directory

> Copy to read-write local storage> Configure MySQL to listen on the right

port> Monitor MySQL health

> Consuming MySQL> Discover IP address and port> Normal access from then on> Handle topology changes

Page 21: Using PHP and M y SQL to Build Applications with Windows Azure

MySQL

Demo

Page 22: Using PHP and M y SQL to Build Applications with Windows Azure

Simple Configuration

VIP

Load Balancer

MySQL

Page 23: Using PHP and M y SQL to Build Applications with Windows Azure

Replication

VIP

Load Balancer

MySQL MySQLMySQLMS S

Page 24: Using PHP and M y SQL to Build Applications with Windows Azure

Windows Azure Drive with Hot Spare

VIP

Load Balancer

MySQL MySQL

Page 25: Using PHP and M y SQL to Build Applications with Windows Azure

Windows Azure Drive with Hot Spare

VIP

Load Balancer

MySQL MySQL

Page 26: Using PHP and M y SQL to Build Applications with Windows Azure

MySQL Solution Accelerator> Built by our partner, Infosys

> Master/slave configurations in a worker role> Leverage Windows Azure Drive> Master election and replication on startup> Failover and recovery> Scale up/down slaves> Periodic backups - full and incremental

> Available with source code

Page 27: Using PHP and M y SQL to Build Applications with Windows Azure

MySQL Solution Accelerator

Demo

Page 28: Using PHP and M y SQL to Build Applications with Windows Azure

Administering MySQL> Some users prefer a command-line> Instance Manager solution accelerator

> Built by our partner Infosys> Command-line access to worker role

instances> Server runs in each worker role instance> Client runs in a web roleWorke

r

Worker

Page 29: Using PHP and M y SQL to Build Applications with Windows Azure

Instance ManagerSolution Accelerator

Demo

Page 30: Using PHP and M y SQL to Build Applications with Windows Azure

Solution Accelerators> MySQL and Memcached

> Best-practice deployments> Leverage Windows Azure primitives:

> Windows Azure Drive> Windows Azure storage> Discovering IP addresses, other servers,

lifecycle> Dynamic Scaling, Failover, and Upgrades> Automation of application lifecycle

> Instance Manager for remote command

Page 31: Using PHP and M y SQL to Build Applications with Windows Azure

Agenda> Interoperability

>PHP & Eclipse>memcached>MySQL

> Customer Showcases

> Technology Drilldowns

Page 32: Using PHP and M y SQL to Build Applications with Windows Azure

Spotlight: MediaWiki > Powers Wikipedia> PHP-based, usually with MySQL and

Memcached> Used by many companies

> Internal knowledge management> Content management system (CMS)

> Windows Azure benefits> Support traffic spikes> Support unpredictable growth> Minimize possibility of data loss> Minimize downtime

Page 33: Using PHP and M y SQL to Build Applications with Windows Azure

Spotlight: MediaWiki> Technology Requirements

> Web server w/PHP support, MySQL for storage, memcached for caching query results

> What we’ve added : phpMyAdmin and Instance Manager

VIP

Inst

ance

M

anag

er

MCached_2

MCached_3

MCached_1

Med

iaw

iki

PhpM

yAdm

in MySQL Solution

Accelerator

Web Roles Worker Role

Wor

ker R

ole

Memcached Solution Accelerator

Load

Ba

lanc

er

MySQL 1

MySQL 2

Page 34: Using PHP and M y SQL to Build Applications with Windows Azure

Agenda> Interoperability

>PHP & Eclipse>memcached>MySQL

> Customer Showcases

> Technology Drilldowns

Page 35: Using PHP and M y SQL to Build Applications with Windows Azure

Customer Showcase: Glympse> Mobile consumer application that allows

people to share and view their location in real-time

> Windows Azure Adoption Drivers> Support spiky traffic> Automated service management> Geo-availability> Ease of development

Page 36: Using PHP and M y SQL to Build Applications with Windows Azure

Customer Showcase: Glympse> Technical Requirements

> MySQL backend for storing tour data, memcached for caching, php for displaying results to web

VIP

Load

Ba

lanc

er

FE_2

MCached_2

MCached_3

MCached_1

FE_1

FE_3

Web Role Worker Role

Wor

ker

RoleMyS

QL

Page 37: Using PHP and M y SQL to Build Applications with Windows Azure

Glympse

Demo

Page 38: Using PHP and M y SQL to Build Applications with Windows Azure

Benefits of Database as a ServiceSQL AzureDatabase as a Service> Lower TCO> Automatic High Availability

> Multiple servers with live copies of your data --- instant failover

> Automatic Fault-Tolerance> Automatic maintenance

> No downtime> Instantly expand/contract

databases to meet application needs

> Metered by database> Mission-critical SQL Server

foundation

MySQL Solution Accelerator> Compatibility w/ MySQL apps> Pre-configured clustering across

multiple compute instances> Database maintenance required> Metered by compute hour

Clear commitment to OSS support and application compatibility SQL Azure is our strategic investment for the Windows Azure

Platform

Page 39: Using PHP and M y SQL to Build Applications with Windows Azure

Takeaways> Powerful platform primitives> Support for PHP and Eclipse> Accelerators for MySQL and

Memcached

> In use in real-world applications

Page 40: Using PHP and M y SQL to Build Applications with Windows Azure

Call To Action> Windows Azure Monitoring, Logging, and

Management APIs – 11/18 (11:00 AM)

> Windows Azure Tables and Queues Deep Dive – 11/18 (3:00 PM)

> Windows Azure Blobs and Drives Deep Dive – 11/18 (4:30 PM)

> Automating the Application Lifecycle with Windows Azure – 11/19 (10:00 AM)

Page 41: Using PHP and M y SQL to Build Applications with Windows Azure
Page 42: Using PHP and M y SQL to Build Applications with Windows Azure

YOUR FEEDBACK IS IMPORTANT TO US! Please fill out session evaluation

forms online atMicrosoftPDC.com

Page 43: Using PHP and M y SQL to Build Applications with Windows Azure

Learn More On Channel 9> Expand your PDC experience through

Channel 9

> Explore videos, hands-on labs, sample code and demos through the new Channel 9 training courses

channel9.msdn.com/learnBuilt by Developers for Developers….

Page 44: Using PHP and M y SQL to Build Applications with Windows Azure

© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Page 45: Using PHP and M y SQL to Build Applications with Windows Azure