SlideShare ist ein Scribd-Unternehmen logo
1 von 57
High availability PHP
Building scalable PHP systems
Building scalable PHP systems
Graham Weldon
Platform as a Service Development & Operations Group
Architecture Committee Office
Rakuten, Inc.
About me
• PHP Developer (15 years)
• Game Developer
• Dev Ops
• CakePHP Contributor
• Public Speaker for PHP
• Public Speaker for Open
Source
• Used to live in Australia
• Moved to Tokyo, Japan to work
for Rakuten, Inc.
• I love Tokyo (and Sapporo!)
(CakeMatsuri) PHP Matsuri
(CakeMatsuri) PHP Matsuri
2009
(CakeMatsuri) PHP Matsuri
2009 2010
(CakeMatsuri) PHP Matsuri
2009 2010 2011
(CakeMatsuri) PHP Matsuri
2009 20122010 2011
(CakeMatsuri) PHP Matsuri
2009 201320122010 2011
What I do at work
Rakuten’s PaaS
Rakuten’s PaaS
• We build on top of Cloud Foundry
• Build new services
• Build new runtimes
• Support application developers
• Ensure a stable, forward-thinking platform is available
• Internal use only
• Highly available
• Easily scalable
By the way ...
• We’re hiring!
• If you’re interested in:
• large systems
• scalable architecture
• solving challenging problems
• Ask me for information!
• @predominant
• graham.weldon@mail.rakuten.com
We’re Hiring!
• Rakuten
Platform as a Service
• http://bit.ly/rakutenpaas
What does “Highly available” mean?
• No “single point of failure”
• Redundancy
• Failover systems
What does “Highly available” mean?
• In the event of a system failure
there are backup / alternative
systems available to take over
• No system failure should result
in applications being “down” or
offline
• The system is designed to
continue operating in the event
of failure
What does “scalable” mean?
• Easy to add more servers
• Distribute the load of users
amongst many servers
• Transparently add to the
compute pool to provide faster
response times
+
+
+
System design / architecture
Simple Web Setup
Internet
Simple Web Setup
Internet LimitedLimited
BandwidthBandwidth
Simple Web Setup
Internet LimitedLimited
BandwidthBandwidth
SingleSingle
WebserverWebserver
Simple Web Setup
Internet LimitedLimited
BandwidthBandwidth
SingleSingle
WebserverWebserver
Single DatabaseSingle Database
Simple Web Setup
Internet LimitedLimited
BandwidthBandwidth
SingleSingle
WebserverWebserver
Single DatabaseSingle Database
No FailoverNo Failover
solutionsolution
Simple Web Setup
Internet LimitedLimited
BandwidthBandwidth
SingleSingle
WebserverWebserver
Single DatabaseSingle Database
No FailoverNo Failover
solutionsolution
No scalingNo scaling
Simple Setup
• We have all done this before
• It works well for very small sites
• You will encounter problems when the number of users grows
• There is no way to recover from system failure
• Any failure will produce extensive downtime
A better solution
Internet
A better solution
Internet
PrimaryPrimary
Backup /Backup /
FailoverFailover
Traffic goes to the primary server
A better solution
Internet
PrimaryPrimary
Backup /Backup /
FailoverFailover
When a failure occurs on the
primary server...
A better solution
Internet
PrimaryPrimary
Backup /Backup /
FailoverFailover
Traffic is redirected to the
backup server
A better solution
Internet
PrimaryPrimary
Backup /Backup /
FailoverFailover
FailoverFailover
availableavailable
A better solution
Internet
PrimaryPrimary
Backup /Backup /
FailoverFailover
FailoverFailover
availableavailableFailover reliesFailover relies
on DNSon DNS
A better solution
Internet
PrimaryPrimary
Backup /Backup /
FailoverFailover
FailoverFailover
availableavailableFailover reliesFailover relies
on DNSon DNS
NotNot
scalablescalable
A better solution
Internet
PrimaryPrimary
Backup /Backup /
FailoverFailover
FailoverFailover
availableavailableFailover reliesFailover relies
on DNSon DNS
NotNot
scalablescalable
Database SyncDatabase Sync
problems?problems?
A better solution
• A backup is now available
• We can switch traffic to the backup server in case of failure
• Highly available?
• A little bit
• Scalable?
• No
• Its a better solution than the previous example
• But its not ideal
An even better solution
Internet
Load BalancersLoad Balancers
Load balancers distribute the load
An even better solution
Internet
Load BalancersLoad Balancers
WebWeb
ServersServers
A pool of webservers are available
to handle the incoming traffic
An even better solution
Internet
Load BalancersLoad Balancers
WebWeb
ServersServers
DBDB
ServersServers
Webservers connect to a database cluster
to distribute load
An even better solution
Internet
Load BalancersLoad Balancers
WebWeb
ServersServers
DBDB
ServersServers
LoadLoad
balancedbalanced
An even better solution
Internet
Load BalancersLoad Balancers
WebWeb
ServersServers
DBDB
ServersServers
ScalableScalable
LoadLoad
balancedbalanced
An even better solution
Internet
Load BalancersLoad Balancers
WebWeb
ServersServers
DBDB
ServersServers
FailoverFailover
availableavailable
ScalableScalable
LoadLoad
balancedbalanced
A perfect solution?
• There are good solutions available
• No solution is perfect
• Consider the parts of the system that can fail
• Build it in a highly available way
• Allow additional servers / services to be added through configuration
• Or.. through auto detection
Scaling PHP
A Case Study of the Rakuten Platform
Web Server
• Nginx
• Why?
• Fast
• Reliable
• Stable
• Low resource usage
• Designed for high speed
• Easy configuration
Optimization
• PageSpeed
• Optimization tool from Google
• Open Source
• Easy to install
• Lots of options
• Optimizes your pages
• Image processing
• JS/CSS compression
PHP
• PHP-FPM
• “Fast Process Manager”
• Easy to configure
• Fast when configured right
• Process pooling
• Simple to setup
Databases
• A range of options
• Redis
• MongoDB
• Clusterix (MySQL Compatible)
• Each in a clustered setup
• Highly available
• Scalable
Database considerations
• Optimize queries
• Use fast disks!
• Large memory
• Lots of CPU
• Database is often a bottleneck
• Make sure you have enough
resources
Content Delivery
• Use a Content Delivery
Network for static content
• Or.. use a separate server for
delivering static content to
ensure PHP has the
processing power it needs
• Speeds up browser requests
for static files
• Allows concurrent requests
with less work / effort
Varnish
• HTTP accelerator
• In-memory caching
• Huge performance increases
• 300-1000x speed increase
Special considerations
Session Storage
• You need a common place for all servers to access for session storage
• We recommend Redis
• Common storage ensures that sessions will be maintained
• Without common storage, users will lose their session data between
page requests.
Session Storage
Web Servers Session Store
Session Storage
• php.ini
• session.save_handler = ‘redis’
• session.save_path = ‘tcp://host:port, ...’
Opcode Caching
• OpCache (Extension)
• Bundled with PHP 5.5+
• Available as an extension for earlier versions
• Faster than XCache
• Simple to setup
• OpCache will cache per-server
• You might want to pre-warm the cache for all servers
• I don’t have a better solution for this yet
Thankyou!
Any questions?
• We’re looking for talented engineers!
• Interested in DevOps?
• Interested in highly available systems?
• Contact me!
• @predominant
• Rakuten
Platform as a Servicehttp://bit.ly/rakutenpaas
• Rakuten
Public Cloud Section
http://bit.ly/rakutenpcs
20130714   php matsuri - highly available php

Weitere ähnliche Inhalte

Was ist angesagt?

Scaling High Traffic Web Applications
Scaling High Traffic Web ApplicationsScaling High Traffic Web Applications
Scaling High Traffic Web ApplicationsAchievers Tech
 
ChinaNetCloud_magentocom (china)_2014
ChinaNetCloud_magentocom (china)_2014ChinaNetCloud_magentocom (china)_2014
ChinaNetCloud_magentocom (china)_2014Bluecom Group
 
WebsitePerformance
WebsitePerformanceWebsitePerformance
WebsitePerformanceVivek Jain
 
DrupalCampLA 2014 - Drupal backend performance and scalability
DrupalCampLA 2014 - Drupal backend performance and scalabilityDrupalCampLA 2014 - Drupal backend performance and scalability
DrupalCampLA 2014 - Drupal backend performance and scalabilitycherryhillco
 
ChinaNetCloud Magento Operations - Magentocom Conference - Nov 2014
ChinaNetCloud Magento Operations - Magentocom Conference - Nov 2014ChinaNetCloud Magento Operations - Magentocom Conference - Nov 2014
ChinaNetCloud Magento Operations - Magentocom Conference - Nov 2014ChinaNetCloud
 
WordPress Optimization with Litespeed Cache #wpjkt14
WordPress Optimization with Litespeed Cache  #wpjkt14WordPress Optimization with Litespeed Cache  #wpjkt14
WordPress Optimization with Litespeed Cache #wpjkt14WordPress
 
Gophers Riding Elephants: Writing PostgreSQL tools in Go
Gophers Riding Elephants: Writing PostgreSQL tools in GoGophers Riding Elephants: Writing PostgreSQL tools in Go
Gophers Riding Elephants: Writing PostgreSQL tools in GoAJ Bahnken
 
Scalable Web Architectures - Common Patterns & Approaches
Scalable Web Architectures - Common Patterns & ApproachesScalable Web Architectures - Common Patterns & Approaches
Scalable Web Architectures - Common Patterns & ApproachesCal Henderson
 
Profiling and Tuning a Web Application - The Dirty Details
Profiling and Tuning a Web Application - The Dirty DetailsProfiling and Tuning a Web Application - The Dirty Details
Profiling and Tuning a Web Application - The Dirty DetailsAchievers Tech
 
Website Performance
Website PerformanceWebsite Performance
Website PerformanceHugo Fonseca
 
Lg conf upgrade migrate and virtualisation with share-point 2010
Lg conf   upgrade migrate and virtualisation with share-point 2010Lg conf   upgrade migrate and virtualisation with share-point 2010
Lg conf upgrade migrate and virtualisation with share-point 2010Alan Richards
 
Setting up a free open source java e-commerce website
Setting up a free open source java e-commerce websiteSetting up a free open source java e-commerce website
Setting up a free open source java e-commerce websiteCsaba Toth
 
Magento security best practices 2015
Magento security best practices 2015Magento security best practices 2015
Magento security best practices 2015Philippe Humeau
 
WordCamp Kent 2019 - WP 101: Local Development - Themes and Plugins
WordCamp Kent 2019 - WP 101: Local Development - Themes and PluginsWordCamp Kent 2019 - WP 101: Local Development - Themes and Plugins
WordCamp Kent 2019 - WP 101: Local Development - Themes and PluginsJoe Querin
 
Robust WordPress Installation using L2MP Stack
Robust WordPress Installation using L2MP StackRobust WordPress Installation using L2MP Stack
Robust WordPress Installation using L2MP StackAlex Bertens
 
The Characteristics of a Successful SPA
The Characteristics of a Successful SPAThe Characteristics of a Successful SPA
The Characteristics of a Successful SPAGil Fink
 
Website design & developemet
Website design & developemetWebsite design & developemet
Website design & developemetApurva Tripathi
 
Zarafa SummerCamp 2012 - Exchange Web Services on Zarafa
Zarafa SummerCamp 2012 - Exchange Web Services on ZarafaZarafa SummerCamp 2012 - Exchange Web Services on Zarafa
Zarafa SummerCamp 2012 - Exchange Web Services on ZarafaZarafa
 
Zero downtime deployments with laravel envoy
Zero downtime deployments with laravel envoyZero downtime deployments with laravel envoy
Zero downtime deployments with laravel envoyTung Nguyen
 

Was ist angesagt? (20)

Scaling High Traffic Web Applications
Scaling High Traffic Web ApplicationsScaling High Traffic Web Applications
Scaling High Traffic Web Applications
 
ChinaNetCloud_magentocom (china)_2014
ChinaNetCloud_magentocom (china)_2014ChinaNetCloud_magentocom (china)_2014
ChinaNetCloud_magentocom (china)_2014
 
WebsitePerformance
WebsitePerformanceWebsitePerformance
WebsitePerformance
 
DrupalCampLA 2014 - Drupal backend performance and scalability
DrupalCampLA 2014 - Drupal backend performance and scalabilityDrupalCampLA 2014 - Drupal backend performance and scalability
DrupalCampLA 2014 - Drupal backend performance and scalability
 
ChinaNetCloud Magento Operations - Magentocom Conference - Nov 2014
ChinaNetCloud Magento Operations - Magentocom Conference - Nov 2014ChinaNetCloud Magento Operations - Magentocom Conference - Nov 2014
ChinaNetCloud Magento Operations - Magentocom Conference - Nov 2014
 
WordPress Optimization with Litespeed Cache #wpjkt14
WordPress Optimization with Litespeed Cache  #wpjkt14WordPress Optimization with Litespeed Cache  #wpjkt14
WordPress Optimization with Litespeed Cache #wpjkt14
 
Gophers Riding Elephants: Writing PostgreSQL tools in Go
Gophers Riding Elephants: Writing PostgreSQL tools in GoGophers Riding Elephants: Writing PostgreSQL tools in Go
Gophers Riding Elephants: Writing PostgreSQL tools in Go
 
Scalable Web Architectures - Common Patterns & Approaches
Scalable Web Architectures - Common Patterns & ApproachesScalable Web Architectures - Common Patterns & Approaches
Scalable Web Architectures - Common Patterns & Approaches
 
Profiling and Tuning a Web Application - The Dirty Details
Profiling and Tuning a Web Application - The Dirty DetailsProfiling and Tuning a Web Application - The Dirty Details
Profiling and Tuning a Web Application - The Dirty Details
 
Website Performance
Website PerformanceWebsite Performance
Website Performance
 
Lg conf upgrade migrate and virtualisation with share-point 2010
Lg conf   upgrade migrate and virtualisation with share-point 2010Lg conf   upgrade migrate and virtualisation with share-point 2010
Lg conf upgrade migrate and virtualisation with share-point 2010
 
Setting up a free open source java e-commerce website
Setting up a free open source java e-commerce websiteSetting up a free open source java e-commerce website
Setting up a free open source java e-commerce website
 
Magento security best practices 2015
Magento security best practices 2015Magento security best practices 2015
Magento security best practices 2015
 
WordCamp Kent 2019 - WP 101: Local Development - Themes and Plugins
WordCamp Kent 2019 - WP 101: Local Development - Themes and PluginsWordCamp Kent 2019 - WP 101: Local Development - Themes and Plugins
WordCamp Kent 2019 - WP 101: Local Development - Themes and Plugins
 
Robust WordPress Installation using L2MP Stack
Robust WordPress Installation using L2MP StackRobust WordPress Installation using L2MP Stack
Robust WordPress Installation using L2MP Stack
 
The Characteristics of a Successful SPA
The Characteristics of a Successful SPAThe Characteristics of a Successful SPA
The Characteristics of a Successful SPA
 
Website design & developemet
Website design & developemetWebsite design & developemet
Website design & developemet
 
Zarafa SummerCamp 2012 - Exchange Web Services on Zarafa
Zarafa SummerCamp 2012 - Exchange Web Services on ZarafaZarafa SummerCamp 2012 - Exchange Web Services on Zarafa
Zarafa SummerCamp 2012 - Exchange Web Services on Zarafa
 
Zero downtime deployments with laravel envoy
Zero downtime deployments with laravel envoyZero downtime deployments with laravel envoy
Zero downtime deployments with laravel envoy
 
Caching 101 - WordCamp OC
Caching 101 - WordCamp OCCaching 101 - WordCamp OC
Caching 101 - WordCamp OC
 

Ähnlich wie 20130714 php matsuri - highly available php

Custom coded projects
Custom coded projectsCustom coded projects
Custom coded projectsMarko Heijnen
 
Squeeze Maximum Performance From Your Joomla Website
Squeeze Maximum Performance From Your Joomla WebsiteSqueeze Maximum Performance From Your Joomla Website
Squeeze Maximum Performance From Your Joomla WebsiteSiteGround.com
 
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)Nexcess.net LLC
 
Midwest PHP - Scaling Magento
Midwest PHP - Scaling MagentoMidwest PHP - Scaling Magento
Midwest PHP - Scaling MagentoMathew Beane
 
Connections Upgrades and Migrations the Easy Way
Connections Upgrades and Migrations the Easy WayConnections Upgrades and Migrations the Easy Way
Connections Upgrades and Migrations the Easy WayLetsConnect
 
Connections Migrations the easy way Soccnx10
Connections Migrations the easy way Soccnx10Connections Migrations the easy way Soccnx10
Connections Migrations the easy way Soccnx10Sharon James
 
12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQLKonstantin Gredeskoul
 
Handling 1 Billion Requests/hr with Minimal Latency Using Docker
Handling 1 Billion Requests/hr with Minimal Latency Using DockerHandling 1 Billion Requests/hr with Minimal Latency Using Docker
Handling 1 Billion Requests/hr with Minimal Latency Using DockerMatomy
 
Infrastructure as Data with Ansible for easier Continuous Delivery
Infrastructure as Data with Ansible for easier Continuous DeliveryInfrastructure as Data with Ansible for easier Continuous Delivery
Infrastructure as Data with Ansible for easier Continuous DeliveryCarlo Bonamico
 
Php training in bhubaneswar
Php training in bhubaneswar Php training in bhubaneswar
Php training in bhubaneswar litbbsr
 
Php training in bhubaneswar
Php training in bhubaneswar Php training in bhubaneswar
Php training in bhubaneswar litbbsr
 
Building perfect sql servers, every time -oops
Building perfect sql servers, every time -oopsBuilding perfect sql servers, every time -oops
Building perfect sql servers, every time -oopsJoseph D'Antoni
 
PHD Virtual: Optimizing Backups for Any Storage
PHD Virtual: Optimizing Backups for Any StoragePHD Virtual: Optimizing Backups for Any Storage
PHD Virtual: Optimizing Backups for Any StorageMark McHenry
 
WordPress Hosting Basics
WordPress Hosting BasicsWordPress Hosting Basics
WordPress Hosting BasicsChris Burgess
 
August Webinar - Water Cooler Talks: A Look into a Developer's Workbench
August Webinar - Water Cooler Talks: A Look into a Developer's WorkbenchAugust Webinar - Water Cooler Talks: A Look into a Developer's Workbench
August Webinar - Water Cooler Talks: A Look into a Developer's WorkbenchHoward Greenberg
 
The 5 Minute MySQL DBA
The 5 Minute MySQL DBAThe 5 Minute MySQL DBA
The 5 Minute MySQL DBAIrawan Soetomo
 
Technical track-afterimaging Progress Database
Technical track-afterimaging Progress DatabaseTechnical track-afterimaging Progress Database
Technical track-afterimaging Progress DatabaseVinh Nguyen
 
Learn WordPress - Live Session 2 Slides
Learn WordPress - Live Session 2 SlidesLearn WordPress - Live Session 2 Slides
Learn WordPress - Live Session 2 SlidesAhmed Mohammed Nagdy
 

Ähnlich wie 20130714 php matsuri - highly available php (20)

Custom coded projects
Custom coded projectsCustom coded projects
Custom coded projects
 
Squeeze Maximum Performance From Your Joomla Website
Squeeze Maximum Performance From Your Joomla WebsiteSqueeze Maximum Performance From Your Joomla Website
Squeeze Maximum Performance From Your Joomla Website
 
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
 
Midwest PHP - Scaling Magento
Midwest PHP - Scaling MagentoMidwest PHP - Scaling Magento
Midwest PHP - Scaling Magento
 
Connections Upgrades and Migrations the Easy Way
Connections Upgrades and Migrations the Easy WayConnections Upgrades and Migrations the Easy Way
Connections Upgrades and Migrations the Easy Way
 
Connections Migrations the easy way Soccnx10
Connections Migrations the easy way Soccnx10Connections Migrations the easy way Soccnx10
Connections Migrations the easy way Soccnx10
 
12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL
 
SharePoint 2016 Upgrade Planning
SharePoint 2016 Upgrade PlanningSharePoint 2016 Upgrade Planning
SharePoint 2016 Upgrade Planning
 
Handling 1 Billion Requests/hr with Minimal Latency Using Docker
Handling 1 Billion Requests/hr with Minimal Latency Using DockerHandling 1 Billion Requests/hr with Minimal Latency Using Docker
Handling 1 Billion Requests/hr with Minimal Latency Using Docker
 
Performance stack
Performance stackPerformance stack
Performance stack
 
Infrastructure as Data with Ansible for easier Continuous Delivery
Infrastructure as Data with Ansible for easier Continuous DeliveryInfrastructure as Data with Ansible for easier Continuous Delivery
Infrastructure as Data with Ansible for easier Continuous Delivery
 
Php training in bhubaneswar
Php training in bhubaneswar Php training in bhubaneswar
Php training in bhubaneswar
 
Php training in bhubaneswar
Php training in bhubaneswar Php training in bhubaneswar
Php training in bhubaneswar
 
Building perfect sql servers, every time -oops
Building perfect sql servers, every time -oopsBuilding perfect sql servers, every time -oops
Building perfect sql servers, every time -oops
 
PHD Virtual: Optimizing Backups for Any Storage
PHD Virtual: Optimizing Backups for Any StoragePHD Virtual: Optimizing Backups for Any Storage
PHD Virtual: Optimizing Backups for Any Storage
 
WordPress Hosting Basics
WordPress Hosting BasicsWordPress Hosting Basics
WordPress Hosting Basics
 
August Webinar - Water Cooler Talks: A Look into a Developer's Workbench
August Webinar - Water Cooler Talks: A Look into a Developer's WorkbenchAugust Webinar - Water Cooler Talks: A Look into a Developer's Workbench
August Webinar - Water Cooler Talks: A Look into a Developer's Workbench
 
The 5 Minute MySQL DBA
The 5 Minute MySQL DBAThe 5 Minute MySQL DBA
The 5 Minute MySQL DBA
 
Technical track-afterimaging Progress Database
Technical track-afterimaging Progress DatabaseTechnical track-afterimaging Progress Database
Technical track-afterimaging Progress Database
 
Learn WordPress - Live Session 2 Slides
Learn WordPress - Live Session 2 SlidesLearn WordPress - Live Session 2 Slides
Learn WordPress - Live Session 2 Slides
 

Mehr von Graham Weldon

HackLang Introduction
HackLang IntroductionHackLang Introduction
HackLang IntroductionGraham Weldon
 
CakePHP and Open Source - Newcastle University
CakePHP and Open Source - Newcastle UniversityCakePHP and Open Source - Newcastle University
CakePHP and Open Source - Newcastle UniversityGraham Weldon
 
SydPHP March 2012 Meetup
SydPHP March 2012 MeetupSydPHP March 2012 Meetup
SydPHP March 2012 MeetupGraham Weldon
 
SydPHP June 2012 - GovHack overview
SydPHP June 2012 - GovHack overviewSydPHP June 2012 - GovHack overview
SydPHP June 2012 - GovHack overviewGraham Weldon
 
SydPHP May 2012 - Deployment
SydPHP May 2012 - DeploymentSydPHP May 2012 - Deployment
SydPHP May 2012 - DeploymentGraham Weldon
 
Building 3D apps with Javascript
Building 3D apps with JavascriptBuilding 3D apps with Javascript
Building 3D apps with JavascriptGraham Weldon
 
An introduction to Titanium
An introduction to TitaniumAn introduction to Titanium
An introduction to TitaniumGraham Weldon
 
PHP 5.4 - Begin your love affair with traits
PHP 5.4 - Begin your love affair with traitsPHP 5.4 - Begin your love affair with traits
PHP 5.4 - Begin your love affair with traitsGraham Weldon
 
MySQL Performance - SydPHP October 2011
MySQL Performance - SydPHP October 2011MySQL Performance - SydPHP October 2011
MySQL Performance - SydPHP October 2011Graham Weldon
 
CakePHP 2.0 - PHP Matsuri 2011
CakePHP 2.0 - PHP Matsuri 2011CakePHP 2.0 - PHP Matsuri 2011
CakePHP 2.0 - PHP Matsuri 2011Graham Weldon
 
The business behind open source
The business behind open sourceThe business behind open source
The business behind open sourceGraham Weldon
 
CakePHP 2.0 - It'll rock your world
CakePHP 2.0 - It'll rock your worldCakePHP 2.0 - It'll rock your world
CakePHP 2.0 - It'll rock your worldGraham Weldon
 
CakePHP - The Path to 2.0
CakePHP - The Path to 2.0CakePHP - The Path to 2.0
CakePHP - The Path to 2.0Graham Weldon
 
CakePHP Tutorial - OSDC 2010
CakePHP Tutorial - OSDC 2010CakePHP Tutorial - OSDC 2010
CakePHP Tutorial - OSDC 2010Graham Weldon
 
Debugging and Profiling PHP
Debugging and Profiling PHPDebugging and Profiling PHP
Debugging and Profiling PHPGraham Weldon
 
OSDC LIghtning Talk - Context Free Art
OSDC LIghtning Talk - Context Free ArtOSDC LIghtning Talk - Context Free Art
OSDC LIghtning Talk - Context Free ArtGraham Weldon
 
Re-imagining CakePHP (OSDC 2010)
Re-imagining CakePHP (OSDC 2010)Re-imagining CakePHP (OSDC 2010)
Re-imagining CakePHP (OSDC 2010)Graham Weldon
 
Re-imaginging CakePHP
Re-imaginging CakePHPRe-imaginging CakePHP
Re-imaginging CakePHPGraham Weldon
 

Mehr von Graham Weldon (20)

HackLang Introduction
HackLang IntroductionHackLang Introduction
HackLang Introduction
 
CakePHP and Open Source - Newcastle University
CakePHP and Open Source - Newcastle UniversityCakePHP and Open Source - Newcastle University
CakePHP and Open Source - Newcastle University
 
SydPHP March 2012 Meetup
SydPHP March 2012 MeetupSydPHP March 2012 Meetup
SydPHP March 2012 Meetup
 
SydPHP June 2012 - GovHack overview
SydPHP June 2012 - GovHack overviewSydPHP June 2012 - GovHack overview
SydPHP June 2012 - GovHack overview
 
SydPHP April 2012
SydPHP April 2012SydPHP April 2012
SydPHP April 2012
 
SydPHP May 2012 - Deployment
SydPHP May 2012 - DeploymentSydPHP May 2012 - Deployment
SydPHP May 2012 - Deployment
 
Building 3D apps with Javascript
Building 3D apps with JavascriptBuilding 3D apps with Javascript
Building 3D apps with Javascript
 
An introduction to Titanium
An introduction to TitaniumAn introduction to Titanium
An introduction to Titanium
 
PHP 5.4 - Begin your love affair with traits
PHP 5.4 - Begin your love affair with traitsPHP 5.4 - Begin your love affair with traits
PHP 5.4 - Begin your love affair with traits
 
MySQL Performance - SydPHP October 2011
MySQL Performance - SydPHP October 2011MySQL Performance - SydPHP October 2011
MySQL Performance - SydPHP October 2011
 
CakePHP 2.0 - PHP Matsuri 2011
CakePHP 2.0 - PHP Matsuri 2011CakePHP 2.0 - PHP Matsuri 2011
CakePHP 2.0 - PHP Matsuri 2011
 
Nginx in production
Nginx in productionNginx in production
Nginx in production
 
The business behind open source
The business behind open sourceThe business behind open source
The business behind open source
 
CakePHP 2.0 - It'll rock your world
CakePHP 2.0 - It'll rock your worldCakePHP 2.0 - It'll rock your world
CakePHP 2.0 - It'll rock your world
 
CakePHP - The Path to 2.0
CakePHP - The Path to 2.0CakePHP - The Path to 2.0
CakePHP - The Path to 2.0
 
CakePHP Tutorial - OSDC 2010
CakePHP Tutorial - OSDC 2010CakePHP Tutorial - OSDC 2010
CakePHP Tutorial - OSDC 2010
 
Debugging and Profiling PHP
Debugging and Profiling PHPDebugging and Profiling PHP
Debugging and Profiling PHP
 
OSDC LIghtning Talk - Context Free Art
OSDC LIghtning Talk - Context Free ArtOSDC LIghtning Talk - Context Free Art
OSDC LIghtning Talk - Context Free Art
 
Re-imagining CakePHP (OSDC 2010)
Re-imagining CakePHP (OSDC 2010)Re-imagining CakePHP (OSDC 2010)
Re-imagining CakePHP (OSDC 2010)
 
Re-imaginging CakePHP
Re-imaginging CakePHPRe-imaginging CakePHP
Re-imaginging CakePHP
 

Kürzlich hochgeladen

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 

Kürzlich hochgeladen (20)

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 

20130714 php matsuri - highly available php

  • 1. High availability PHP Building scalable PHP systems Building scalable PHP systems Graham Weldon Platform as a Service Development & Operations Group Architecture Committee Office Rakuten, Inc.
  • 2. About me • PHP Developer (15 years) • Game Developer • Dev Ops • CakePHP Contributor • Public Speaker for PHP • Public Speaker for Open Source • Used to live in Australia • Moved to Tokyo, Japan to work for Rakuten, Inc. • I love Tokyo (and Sapporo!)
  • 8. (CakeMatsuri) PHP Matsuri 2009 201320122010 2011
  • 9.
  • 10. What I do at work
  • 12. Rakuten’s PaaS • We build on top of Cloud Foundry • Build new services • Build new runtimes • Support application developers • Ensure a stable, forward-thinking platform is available • Internal use only • Highly available • Easily scalable
  • 13. By the way ... • We’re hiring! • If you’re interested in: • large systems • scalable architecture • solving challenging problems • Ask me for information! • @predominant • graham.weldon@mail.rakuten.com
  • 14. We’re Hiring! • Rakuten Platform as a Service • http://bit.ly/rakutenpaas
  • 15. What does “Highly available” mean? • No “single point of failure” • Redundancy • Failover systems
  • 16. What does “Highly available” mean? • In the event of a system failure there are backup / alternative systems available to take over • No system failure should result in applications being “down” or offline • The system is designed to continue operating in the event of failure
  • 17. What does “scalable” mean? • Easy to add more servers • Distribute the load of users amongst many servers • Transparently add to the compute pool to provide faster response times + + +
  • 18. System design / architecture
  • 20. Simple Web Setup Internet LimitedLimited BandwidthBandwidth
  • 21. Simple Web Setup Internet LimitedLimited BandwidthBandwidth SingleSingle WebserverWebserver
  • 22. Simple Web Setup Internet LimitedLimited BandwidthBandwidth SingleSingle WebserverWebserver Single DatabaseSingle Database
  • 23. Simple Web Setup Internet LimitedLimited BandwidthBandwidth SingleSingle WebserverWebserver Single DatabaseSingle Database No FailoverNo Failover solutionsolution
  • 24. Simple Web Setup Internet LimitedLimited BandwidthBandwidth SingleSingle WebserverWebserver Single DatabaseSingle Database No FailoverNo Failover solutionsolution No scalingNo scaling
  • 25. Simple Setup • We have all done this before • It works well for very small sites • You will encounter problems when the number of users grows • There is no way to recover from system failure • Any failure will produce extensive downtime
  • 27. A better solution Internet PrimaryPrimary Backup /Backup / FailoverFailover Traffic goes to the primary server
  • 28. A better solution Internet PrimaryPrimary Backup /Backup / FailoverFailover When a failure occurs on the primary server...
  • 29. A better solution Internet PrimaryPrimary Backup /Backup / FailoverFailover Traffic is redirected to the backup server
  • 30. A better solution Internet PrimaryPrimary Backup /Backup / FailoverFailover FailoverFailover availableavailable
  • 31. A better solution Internet PrimaryPrimary Backup /Backup / FailoverFailover FailoverFailover availableavailableFailover reliesFailover relies on DNSon DNS
  • 32. A better solution Internet PrimaryPrimary Backup /Backup / FailoverFailover FailoverFailover availableavailableFailover reliesFailover relies on DNSon DNS NotNot scalablescalable
  • 33. A better solution Internet PrimaryPrimary Backup /Backup / FailoverFailover FailoverFailover availableavailableFailover reliesFailover relies on DNSon DNS NotNot scalablescalable Database SyncDatabase Sync problems?problems?
  • 34. A better solution • A backup is now available • We can switch traffic to the backup server in case of failure • Highly available? • A little bit • Scalable? • No • Its a better solution than the previous example • But its not ideal
  • 35. An even better solution Internet Load BalancersLoad Balancers Load balancers distribute the load
  • 36. An even better solution Internet Load BalancersLoad Balancers WebWeb ServersServers A pool of webservers are available to handle the incoming traffic
  • 37. An even better solution Internet Load BalancersLoad Balancers WebWeb ServersServers DBDB ServersServers Webservers connect to a database cluster to distribute load
  • 38. An even better solution Internet Load BalancersLoad Balancers WebWeb ServersServers DBDB ServersServers LoadLoad balancedbalanced
  • 39. An even better solution Internet Load BalancersLoad Balancers WebWeb ServersServers DBDB ServersServers ScalableScalable LoadLoad balancedbalanced
  • 40. An even better solution Internet Load BalancersLoad Balancers WebWeb ServersServers DBDB ServersServers FailoverFailover availableavailable ScalableScalable LoadLoad balancedbalanced
  • 41. A perfect solution? • There are good solutions available • No solution is perfect • Consider the parts of the system that can fail • Build it in a highly available way • Allow additional servers / services to be added through configuration • Or.. through auto detection
  • 42. Scaling PHP A Case Study of the Rakuten Platform
  • 43. Web Server • Nginx • Why? • Fast • Reliable • Stable • Low resource usage • Designed for high speed • Easy configuration
  • 44. Optimization • PageSpeed • Optimization tool from Google • Open Source • Easy to install • Lots of options • Optimizes your pages • Image processing • JS/CSS compression
  • 45. PHP • PHP-FPM • “Fast Process Manager” • Easy to configure • Fast when configured right • Process pooling • Simple to setup
  • 46. Databases • A range of options • Redis • MongoDB • Clusterix (MySQL Compatible) • Each in a clustered setup • Highly available • Scalable
  • 47. Database considerations • Optimize queries • Use fast disks! • Large memory • Lots of CPU • Database is often a bottleneck • Make sure you have enough resources
  • 48. Content Delivery • Use a Content Delivery Network for static content • Or.. use a separate server for delivering static content to ensure PHP has the processing power it needs • Speeds up browser requests for static files • Allows concurrent requests with less work / effort
  • 49. Varnish • HTTP accelerator • In-memory caching • Huge performance increases • 300-1000x speed increase
  • 51. Session Storage • You need a common place for all servers to access for session storage • We recommend Redis • Common storage ensures that sessions will be maintained • Without common storage, users will lose their session data between page requests.
  • 53. Session Storage • php.ini • session.save_handler = ‘redis’ • session.save_path = ‘tcp://host:port, ...’
  • 54. Opcode Caching • OpCache (Extension) • Bundled with PHP 5.5+ • Available as an extension for earlier versions • Faster than XCache • Simple to setup • OpCache will cache per-server • You might want to pre-warm the cache for all servers • I don’t have a better solution for this yet
  • 56. • We’re looking for talented engineers! • Interested in DevOps? • Interested in highly available systems? • Contact me! • @predominant • Rakuten Platform as a Servicehttp://bit.ly/rakutenpaas • Rakuten Public Cloud Section http://bit.ly/rakutenpcs