php development in the cloud
DESCRIPTION
An overview of cloud computing for PHP developers. This is a slightly updated version of my earlier 'PHP and the Cloud' slides, mostly to reflect my new company's layout.TRANSCRIPT
![Page 2: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/2.jpg)
Contents
WARNING
This is not Yet Another “Store files on Amazon S3” talk.
2
![Page 3: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/3.jpg)
What is the Cloud?
3
![Page 4: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/4.jpg)
What is the Cloud?
4
![Page 5: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/5.jpg)
Gartner’s Hype Cycle
5
![Page 6: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/6.jpg)
Gartner’s Hype Cycle
6
![Page 7: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/7.jpg)
Gartner’s Hype Cycle on Clouds
7
![Page 8: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/8.jpg)
Clouds According to NIST
“Cloud computing is a model for enabling convenient, on-demand network access to a shared pool of configurable computing resources that can be rapidly provisioned and released with
minimal management effort or service provider interaction.
This cloud model promotes availability and is composed of five essential characteristics, three service models, and four
deployment models.”
National Institute of Standards and Technology
http://csrc.nist.gov/groups/SNS/cloud-computing/
8
![Page 9: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/9.jpg)
NIST: Five Characteristics
Things that are considered cloud:
‣ On-demand, self-service
‣ Broad network access
‣ Resource pooling
‣ Rapid elasticity
‣ Measured service
9
![Page 10: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/10.jpg)
NIST: Three Service Models
Cloud applications are:
‣ Software as a Service
‣ Platform as a Service
‣ Infrastructure as a Service
10
![Page 11: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/11.jpg)
NIST: Four Deployment Models
‣ Private cloud
‣ Community cloud
‣ Public cloud
‣ Hybrid cloud
11
![Page 12: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/12.jpg)
Infrastructure as a Service
12
![Page 13: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/13.jpg)
Standard layers in a typical application:
Application Layers
13
Network
Hardware
Operating System
Storage
System Software
Application
![Page 14: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/14.jpg)
Infrastructure as a Service
Parts of the infrastructure offered as service to your app:
14
Network
Hardware
Operating System
Storage
System Software
Application
![Page 15: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/15.jpg)
Infrastructure as a Service
‣ Pitfalls:• Vendor lock-in
• Security
• Integrity of the service provider
‣ Advantages:• Easily scalable
• Move from capital expense to operational expense
• Metered use
• Don’t worry about hardware...
15
![Page 16: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/16.jpg)
Infrastructure as a Service
16
![Page 17: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/17.jpg)
The Hardware/OS Layer
‣ Typically offered as Virtual Machine images
‣ Gives ‘throw hardware at the problem’ a new dimension
‣ Elastic load balancing divides traffic over instances
17
![Page 18: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/18.jpg)
Example: The Rackspace Cloud
‣ The RackspaceCloud is what used to be called Mosso
‣ Powerful API for managing your cloud
‣ Easy access in PHP through Aleksey Korzun’s PHP API:• http://github.com/AlekseyKorzun/php-cloudservers
‣ Concepts• Images (various operating systems)
• Flavors (configuration: mem, cpu, disk)
18
![Page 19: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/19.jpg)
The Rackspace Cloud in PHP
19
![Page 20: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/20.jpg)
The Rackspace Cloud in PHP
20
![Page 21: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/21.jpg)
Clouds for Development
‣Private Cloud:• Flexible development environments• Easy to simulate large scale environments• Easy to set up multiple clusters
21
![Page 22: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/22.jpg)
Example: Terremark’s Infinicloud
22
![Page 23: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/23.jpg)
Terremark’s InfiniCloud
23
![Page 24: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/24.jpg)
IaaS Architecture Prepare your app to run on IaaS
24
![Page 25: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/25.jpg)
Horizontal Scalability
‣ If you run your app on multiple servers today, would it work?
‣ Typical problem areas:• Sessions
• Files
25
![Page 26: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/26.jpg)
Horizontal Scalability
‣ Danga - http://www.danga.com/• People behind LiveJournal / SixApart
• Creators of tools to help make software horizontally scalable
• Memcache - distributed caching, session clustering‣ http://github.com/andreiz/php-memcached
• MogileFS - distributed file storage‣ http://projects.usrportage.de/index.fcgi/php-mogilefs
• Gearman - distributed parallel job processing / message queue‣ http://pecl.php.net/package/gearman/
26
![Page 27: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/27.jpg)
Elasticity
‣ Fewer bottlenecks• More elasticity
• Easier to scale
27
![Page 28: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/28.jpg)
Elasticity
28
![Page 29: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/29.jpg)
Elasticity
29
![Page 30: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/30.jpg)
Abstraction
‣ Abstract services where possible
30
![Page 31: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/31.jpg)
Abstraction
‣ Con:• Common denominator functionality
• Adds some overhead
‣ Pro:• Reduce vendor lock-in
• Increase flexibility
• Save development time
• No need to learn different APIs
• Promotes competition between providers
31
![Page 32: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/32.jpg)
Abstraction
‣ Zend’s SimpleCloud• http://simplecloud.org
• Good attempt at generic cloud abstraction
32
![Page 33: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/33.jpg)
Characteristics Of Your Application
‣ Service oriented
‣ Stateless
‣ Low coupling
‣ Modularity
‣ Interoperability
33
![Page 34: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/34.jpg)
Infra as a Service = SLA Hell?
‣ Find out service levels of infrastructure components
‣ Get proper support
‣ Create “What if...” scenarios• What if Amazon is down?
• What if SupaDupaCloudStore goes bankrupt?
‣ Who owns the data?
‣ Pay attention to license agreements
34
![Page 35: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/35.jpg)
Platform as a Service
35
![Page 36: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/36.jpg)
Complete platform offered as a service:
Platform as a Service
36
Network
Hardware
Operating System
Storage
System Software
Application
![Page 37: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/37.jpg)
Platform as a Service
‣ Platform scales up and down as necessary
‣ Same pitfalls and advantages as IaaS, plus:• Don’t worry about scalability
37
![Page 38: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/38.jpg)
Platform as a Service
38
![Page 39: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/39.jpg)
Google AppEngine
‣ http://code.google.com/appengine/
‣ Python and Java
‣ Able to run PHP via Quercus (Java PHP interpreter)• http://www.webdigi.co.uk/blog/2009/run-php-on-the-google-app-engine/
• http://www.caucho.com/resin-3.0/quercus/
‣ Technology needs to prove itself• Example sites running on Quercus:‣ http://www.webmonkey.com/
‣ http://www.style.com/stylefile/
39
![Page 40: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/40.jpg)
The Rackspace Cloud ‘Sites’
40
![Page 41: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/41.jpg)
Rackspace’s TrueHybrid
‣ Platform selects the best operating system for your site
‣ Magically blends Windows and Linux, ASP.NET and PHP
41
![Page 42: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/42.jpg)
Other Platforms for PHP
‣ NING• http://ning.com
• Social Network PaaS
‣ Force.com• Salesforce cloud platform
• Business applications
‣ PHPFog• http://phpfog.com
• Cloud platform for PHP apps
• Quite young, looks very promising
42
![Page 43: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/43.jpg)
Software as a Service
43
![Page 44: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/44.jpg)
Software as a Service
Everything in the cloud:
44
Network
Hardware
Operating System
Storage
System Software
Application
![Page 45: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/45.jpg)
Software as a Service
‣ Complete applications or application components
‣ Popular phrase: “We are moving our ... to the cloud”
‣ Examples:• Gmail
• Google Apps (office apps, calendar, email)
• Salesforce for CRM
‣ Often built on IaaS• Dropbox file sharing (makes use of Amazon S3 for storage)
• Jungledisk backups (same)
45
![Page 46: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/46.jpg)
Software as a Service
46
![Page 47: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/47.jpg)
Example: Salesforce
‣ Gives access to all your data in Salesforce using SOAP
‣ PHP library available
‣ Documentation abundant• http://developer.force.com/
‣ Salesforce was SaaS way before term ‘cloud’ was coined
‣ Most developer friendly SaaS• Documentation
• Sandbox functionality (paid)
47
![Page 48: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/48.jpg)
Example: Salesforce
48
Source adapted from tutorial at http://www.mikesimonds.com
![Page 49: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/49.jpg)
Example: Google Apps
‣ Many features available through Zend_Gdata_* in ZF• Information retrieval
• Document storage
• Calendering
• Account Configuration
49
![Page 50: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/50.jpg)
Example: Google Apps
50
![Page 51: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/51.jpg)
General SaaS suggestions
‣ Want to work with X from PHP?• Google ‘X php api’ or ‘X php tutorial’
• You’re almost never the first to want to work with it
‣ Cloud apps are easier to work with than most desktop/noncloud apps.
‣ Testing• You don’t want to jeopardize your production data
• See if there is a sandbox feature (Salesforce has one)
• If not, create test accounts
51
![Page 52: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/52.jpg)
The ‘Warcraft Effect’
Clouds are living entities that change when you’re not looking
52
![Page 53: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/53.jpg)
Creating SaaS
53
![Page 54: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/54.jpg)
Creating SaaS
‣ In 2 years Cloud Infrastructure will be a commodity• It’ll be all about application development
‣ Building an application for multiple users/customers
‣ Things to pay attention to:• Reliability (one customer getting in the way of another)
• Security (competitors seeing each other’s data)
• Deployment
• Maintenance
54
![Page 55: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/55.jpg)
Multi-Tenancy evolution
Source: http://msdn.microsoft.com/en-us/library/aa479069.aspx
55
![Page 56: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/56.jpg)
Multi-tenant Databases
56
![Page 57: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/57.jpg)
Multi-tenant Databases
57
![Page 58: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/58.jpg)
Things to think about
‣ Privacy
‣ Shared data
‣ Collaboration
‣ Interoperability
‣ Vendor lock
58
![Page 59: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/59.jpg)
Putting it all togetherCloud Computing In Practice
59
![Page 60: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/60.jpg)
A Hybrid IT Cloud
60
![Page 61: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/61.jpg)
A Hybrid IT Cloud
61
![Page 62: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/62.jpg)
SummaryIf you were sleeping, wake up now!
62
![Page 63: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/63.jpg)
Summary
‣What is the Cloud?
• The cloud = IaaS + PaaS + SaaS
‣ If you have trouble remembering:
• Cloud = Platform, Infrastructure & Software as a Service
63
![Page 64: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/64.jpg)
Summary
‣ With your next PHP application:• See if you can run it on a Cloud Platform
• See if you can run parts on Cloud Infrastructure
• See if you can use Software as a Service components
• See if you can offer it as a service
• Keep your architecture ‘cloud ready’
‣ Think about clouds!• In a couple of years, we’ll all be doing it
64
![Page 65: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/65.jpg)
Food for ThoughtLet’s leave you with something to think about
65
![Page 66: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/66.jpg)
Food for Thought
Are you worried about this?
66
Cloud
Where’s my data?!
Cloud Provider
![Page 67: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/67.jpg)
Food for Thought
Then what about this?
67
Financial System
Where’s my money?!
Bank
Our money has been in the cloud since the 18th century!
![Page 69: Php Development In The Cloud](https://reader037.vdocument.in/reader037/viewer/2022103115/557cf5a3d8b42a071b8b4814/html5/thumbnails/69.jpg)
Credits
Pictures used (under Creative Commons Attribution licenses)
Cloud (slide 3): http://flickr.com/photos/kables/6324973/
Cat + harddisk: http://flickr.com/photos/sirmildredpierce/42928070/ (adapted)
Rubber Band Man: http://flickr.com/photos/thenovys/3791884189/
Clipart used (royalty free and public domain)
http://www.clker.com/