Download - PHPandTheCloud-VitoChin
-
8/9/2019 PHPandTheCloud-VitoChin
1/39
PHP and the CloudThe view from the bazaar
Vito Chin
June 2010
-
8/9/2019 PHPandTheCloud-VitoChin
2/39
2
About Me
Vito Chin
Software Engineer
Consultancy
Projects
Training, audits
Open-source:
Gmagick PHP Extension
Book
php|architect's Guide to PHP in the Cloud
-
8/9/2019 PHPandTheCloud-VitoChin
3/39
3
About this talk
Branch of Ivo Jansch's original PHP andthe Cloud
Co-author of php|architect's Guide to PHPin the Cloud
This talk focuses on available open-sourcetools within PHP; in extensions and inuserland.
-
8/9/2019 PHPandTheCloud-VitoChin
4/39
4
PHP
Standing on the shoulders of open-sourcegiants:
-
8/9/2019 PHPandTheCloud-VitoChin
5/39
5
PHP
Used by many
-
8/9/2019 PHPandTheCloud-VitoChin
6/39
6
Cloud
-
8/9/2019 PHPandTheCloud-VitoChin
7/397
Cloud
Gartner's Hype Cycle
-
8/9/2019 PHPandTheCloud-VitoChin
8/398
Cloud
Gartner's Hype Cycle
-
8/9/2019 PHPandTheCloud-VitoChin
9/399
Cloud
Cloud computing is a model for enabling convenient, on-demandnetwork access to a shared pool of configurable computing
resources (e.g., networks, servers, storage, applications, and
services) that can be rapidly provisioned and released withminimal management effort or service provider interaction.
This cloud model promotes availability and is composed of fiveessential characteristics, three service models, and four
deployment models.
http://csrc.nist.gov/groups/SNS/cloud-computing/
-
8/9/2019 PHPandTheCloud-VitoChin
10/3910
Cloud
Cloud computing is a model for enabling convenient, on-demandnetwork access to a shared pool of configurable computing
resources (e.g., networks, servers, storage, applications, and
services) that can be rapidly provisioned and released withminimal management effort or service provider interaction.
This cloud model promotes availability and is composed of fiveessential characteristics, three service models, and four
deployment models.
http://csrc.nist.gov/groups/SNS/cloud-computing/
-
8/9/2019 PHPandTheCloud-VitoChin
11/3911
PHP and the Cloud
Convenient network accessCURL extension
Connect and communicate to many different types of
servers http, https, ftp, gopher, telnet, dict, file, and ldap
protocols
Most prevalent within the cloud: HTTP
RESTful services (POST, GET, PUT, DELETE)
-
8/9/2019 PHPandTheCloud-VitoChin
12/3912
PHP and the Cloud
Convenient network accessCURL extension
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://api.cloudphp.net/");curl_setopt($ch, CURLOPT_HEADER, false);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$content = curl_exec($ch);
curl_close($ch);
-
8/9/2019 PHPandTheCloud-VitoChin
13/3913
PHP and the Cloud
Convenient network accessSOAP extension
SoapClient, SoapServer
Simple Object Access Protocol
WSDL: Web Services Description Language
$hello = new SoapClient("http://api.cloudphp.net/Hello.wsdl");$hello->sayHello("world");
-
8/9/2019 PHPandTheCloud-VitoChin
14/3914
Cloud
Cloud computing is a model for enabling convenient, on-demandnetwork access to a shared pool ofconfigurable computing
resources (e.g., networks, servers, storage, applications, and
services) that can be rapidly provisioned and released withminimal management effort or service provider interaction.
This cloud model promotes availability and is composed of fiveessential characteristics, three service models, and four
deployment models.
http://csrc.nist.gov/groups/SNS/cloud-computing/
-
8/9/2019 PHPandTheCloud-VitoChin
15/3915
PHP and the Cloud
Configurable computing resourcesUsually, requests sent as POST
Obtain options available
XML with SimpleXML or DOM extension
$xml = simplexml_load_string($content);$title = $xml->book["title"];$title = $xml->book["pages"];
-
8/9/2019 PHPandTheCloud-VitoChin
16/3916
PHP and the Cloud
Configurable computing resourcesJSON extension
json_encode() / json_decode()
Javascript Object Notation
Very popular interchange format: More compact
Interpret-able by Javascript AJAX requests
-
8/9/2019 PHPandTheCloud-VitoChin
17/39
17
PHP and the Cloud
Configurable computing resourcesJSON extension
{ "book":{"title":"PHP in the Cloud","pages":"100"
}}
$json = json_decode($jcontent);echo $json->book->title;echo $json->book->pages;
-
8/9/2019 PHPandTheCloud-VitoChin
18/39
18
Cloud service models
NIST states 3:Infrastructure as a Service
Platform as a Service
Software as a Service
-
8/9/2019 PHPandTheCloud-VitoChin
19/39
19
Infrastructure as a Service
Typically VM instances
Choice of OS
Freedom within the OS Some custom network features
Instances controlled via API
Specialised or custom Machine Images
-
8/9/2019 PHPandTheCloud-VitoChin
20/39
20
Infrastructure as a Service
Publicly available examples:Amazon Elastic Compute Cloud
Rackspace Cloud Servers
Microsoft Azure
PHP API provided by each vendor
Open source PHP alternatives are abundant(and sometimes better!)
-
8/9/2019 PHPandTheCloud-VitoChin
21/39
21
PHP and IaaS scenario
Bottlenecks: The IaaS cloud is not a silverbullet
-
8/9/2019 PHPandTheCloud-VitoChin
22/39
22
PHP and IaaS scenario
Identifying bottlenecks (xdebug)
-
8/9/2019 PHPandTheCloud-VitoChin
23/39
23
PHP and IaaS scenario
Bottleneck resolution
-
8/9/2019 PHPandTheCloud-VitoChin
24/39
24
PHP and IaaS scenario
Cloud Advantages:Low-cost scalability
Economies of scale
Capital expense to operational expense
Utility-like flexibility
-
8/9/2019 PHPandTheCloud-VitoChin
25/39
25
Platform as a Service
A platform to deploy your application
Scales up and down automatically
Convenient tools and servicesMemcacheMail
Image Processing
Authentication & Authorisation
Task queues
-
8/9/2019 PHPandTheCloud-VitoChin
26/39
26
PHP and Google AppEngine
Range of scalable services
Officially support only:
-
8/9/2019 PHPandTheCloud-VitoChin
27/39
27
PHP and Google AppEngine
PHP developers are not really missing outon features on the GAE.
The question to ask: How important isGoogle's scalability to your application?
?
-
8/9/2019 PHPandTheCloud-VitoChin
28/39
28
PHP and Google AppEngine
Pseudo-PHP via Quercus
Java implementation
Needs to keep up with PHP changes
-
8/9/2019 PHPandTheCloud-VitoChin
29/39
29
PHP and Google AppEngine
Pseudo-PHP via QuercusLacks community involvement:
PHP core and PECL community consists of a large
band of contributors from around the world Open-source solutions provided by the community
(such as extensions) are well embraced
Many extensions not available
-
8/9/2019 PHPandTheCloud-VitoChin
30/39
30
PHP and Rackspace Sites
PHP support (but not too perfect)
Automatic scalability
Virtual local storage routed to Cloud files
-
8/9/2019 PHPandTheCloud-VitoChin
31/39
31
PHP and Rackspace Sites
Downside:No instant control over supported version
Unsuitable for custom requirements No shell access
Not able to build custom libraries
No API
-
8/9/2019 PHPandTheCloud-VitoChin
32/39
32
Software as a Service
GUI and APIGoogle Apps
Salesforce
Twitter
Google Maps
Google Search
API Only: PayflowPro
There is a PHP wrapper for that
Almost always:
-
8/9/2019 PHPandTheCloud-VitoChin
33/39
33
PHP for SaaS
PHP's Bread and Butter
Architectural considerations
Multi-tenancy Be careful:
Reliability
SecurityDeployment
Maintenance
-
8/9/2019 PHPandTheCloud-VitoChin
34/39
34
PHP for the Cloud
Compatible philosophiesNot a binary Fort
X
-
8/9/2019 PHPandTheCloud-VitoChin
35/39
35
PHP for the Cloud
Compatible philosophiesThe Unix Philosophy: Write programs that do
one thing and do it well. Write programs to
work together. Write programs to handle textstreams, because that is a universal interface.
-
8/9/2019 PHPandTheCloud-VitoChin
36/39
36
What PHP is?
Do one thing and do it wellAn easier interface (wrapper) to C (and other)
libraries
Rails is like a rounded rectangle and PHP is like a ball of nails.
Terry Chay
-
8/9/2019 PHPandTheCloud-VitoChin
37/39
37
What PHP is?
Work togetherExtensions
Gmagick GraphicsMagick
CURL libcurl memcached libmemcached
See pecl.php.net
Web servers httpd
Browsers and UIs (e.g. GTK)
-
8/9/2019 PHPandTheCloud-VitoChin
38/39
38
Credits and sources
Photos and Images
Gartner's Hype Cycle illustrative diagram on slide 7 & 8 by Jeremy Kemp on Wikipedia
Trees on slide 18 by Gerald_G on http://www.openclipart.org/
Cachegrind generated 22 from xdebug (by Derick Rethans) used to generate visualisation
created with xdebugtoolkit and dot
Rack on slide 28 by Steve Jurvetson. Source: http://flickr.com/photos/jurvetson/157722937/
Fort on slide 34 by Jan F. on Wikipedia
UNIX License plate on slide 35 from http://www.unix.org/
Old images on slide 28, 30, 33 from http://www.oldbookillustrations.com
All other organisational logos are trademark of the respective organisations
-
8/9/2019 PHPandTheCloud-VitoChin
39/39
Questions?