SlideShare a Scribd company logo
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
20130714   php matsuri - highly available php
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

More Related Content

What's hot (20)

Scaling High Traffic Web Applications
Scaling High Traffic Web ApplicationsScaling High Traffic Web Applications
Scaling High Traffic Web Applications
Achievers Tech
 
ChinaNetCloud_magentocom (china)_2014
ChinaNetCloud_magentocom (china)_2014ChinaNetCloud_magentocom (china)_2014
ChinaNetCloud_magentocom (china)_2014
Bluecom Group
 
WebsitePerformance
WebsitePerformanceWebsitePerformance
WebsitePerformance
Vivek 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 scalability
cherryhillco
 
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
ChinaNetCloud
 
WordPress Optimization with Litespeed Cache #wpjkt14
WordPress Optimization with Litespeed Cache  #wpjkt14WordPress Optimization with Litespeed Cache  #wpjkt14
WordPress Optimization with Litespeed Cache #wpjkt14
WordPress
 
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
AJ Bahnken
 
Scalable Web Architectures - Common Patterns & Approaches
Scalable Web Architectures - Common Patterns & ApproachesScalable Web Architectures - Common Patterns & Approaches
Scalable Web Architectures - Common Patterns & Approaches
Cal 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 Details
Achievers Tech
 
Website Performance
Website PerformanceWebsite Performance
Website Performance
Hugo 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 2010
Alan 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 website
Csaba Toth
 
Magento security best practices 2015
Magento security best practices 2015Magento security best practices 2015
Magento security best practices 2015
Philippe 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 Plugins
Joe Querin
 
Robust WordPress Installation using L2MP Stack
Robust WordPress Installation using L2MP StackRobust WordPress Installation using L2MP Stack
Robust WordPress Installation using L2MP Stack
Alex Bertens
 
The Characteristics of a Successful SPA
The Characteristics of a Successful SPAThe Characteristics of a Successful SPA
The Characteristics of a Successful SPA
Gil Fink
 
Website design & developemet
Website design & developemetWebsite design & developemet
Website design & developemet
Apurva 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 Zarafa
Zarafa
 
Zero downtime deployments with laravel envoy
Zero downtime deployments with laravel envoyZero downtime deployments with laravel envoy
Zero downtime deployments with laravel envoy
Tung Nguyen
 
Caching 101 - WordCamp OC
Caching 101 - WordCamp OCCaching 101 - WordCamp OC
Caching 101 - WordCamp OC
Eugene Kovshilovsky
 
Scaling High Traffic Web Applications
Scaling High Traffic Web ApplicationsScaling High Traffic Web Applications
Scaling High Traffic Web Applications
Achievers Tech
 
ChinaNetCloud_magentocom (china)_2014
ChinaNetCloud_magentocom (china)_2014ChinaNetCloud_magentocom (china)_2014
ChinaNetCloud_magentocom (china)_2014
Bluecom Group
 
WebsitePerformance
WebsitePerformanceWebsitePerformance
WebsitePerformance
Vivek 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 scalability
cherryhillco
 
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
ChinaNetCloud
 
WordPress Optimization with Litespeed Cache #wpjkt14
WordPress Optimization with Litespeed Cache  #wpjkt14WordPress Optimization with Litespeed Cache  #wpjkt14
WordPress Optimization with Litespeed Cache #wpjkt14
WordPress
 
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
AJ Bahnken
 
Scalable Web Architectures - Common Patterns & Approaches
Scalable Web Architectures - Common Patterns & ApproachesScalable Web Architectures - Common Patterns & Approaches
Scalable Web Architectures - Common Patterns & Approaches
Cal 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 Details
Achievers Tech
 
Website Performance
Website PerformanceWebsite Performance
Website Performance
Hugo 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 2010
Alan 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 website
Csaba Toth
 
Magento security best practices 2015
Magento security best practices 2015Magento security best practices 2015
Magento security best practices 2015
Philippe 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 Plugins
Joe Querin
 
Robust WordPress Installation using L2MP Stack
Robust WordPress Installation using L2MP StackRobust WordPress Installation using L2MP Stack
Robust WordPress Installation using L2MP Stack
Alex Bertens
 
The Characteristics of a Successful SPA
The Characteristics of a Successful SPAThe Characteristics of a Successful SPA
The Characteristics of a Successful SPA
Gil Fink
 
Website design & developemet
Website design & developemetWebsite design & developemet
Website design & developemet
Apurva 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 Zarafa
Zarafa
 
Zero downtime deployments with laravel envoy
Zero downtime deployments with laravel envoyZero downtime deployments with laravel envoy
Zero downtime deployments with laravel envoy
Tung Nguyen
 

Similar to 20130714 php matsuri - highly available php (20)

Custom coded projects
Custom coded projectsCustom coded projects
Custom coded projects
Marko 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 Website
SiteGround.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 Magento
Mathew Beane
 
Connections Migrations the easy way Soccnx10
Connections Migrations the easy way Soccnx10Connections Migrations the easy way Soccnx10
Connections Migrations the easy way Soccnx10
Sharon James
 
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
LetsConnect
 
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
Konstantin Gredeskoul
 
SharePoint 2016 Upgrade Planning
SharePoint 2016 Upgrade PlanningSharePoint 2016 Upgrade Planning
SharePoint 2016 Upgrade Planning
Chandima Kulathilake
 
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
Matomy
 
Performance stack
Performance stackPerformance stack
Performance stack
Shayne Bartlett
 
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
Carlo 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 -oops
Joseph 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 Storage
Mark McHenry
 
WordPress Hosting Basics
WordPress Hosting BasicsWordPress Hosting Basics
WordPress Hosting Basics
Chris 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 Workbench
Howard Greenberg
 
The 5 Minute MySQL DBA
The 5 Minute MySQL DBAThe 5 Minute MySQL DBA
The 5 Minute MySQL DBA
Irawan Soetomo
 
Technical track-afterimaging Progress Database
Technical track-afterimaging Progress DatabaseTechnical track-afterimaging Progress Database
Technical track-afterimaging Progress Database
Vinh Nguyen
 
Learn WordPress - Live Session 2 Slides
Learn WordPress - Live Session 2 SlidesLearn WordPress - Live Session 2 Slides
Learn WordPress - Live Session 2 Slides
Ahmed Mohammed Nagdy
 
Custom coded projects
Custom coded projectsCustom coded projects
Custom coded projects
Marko 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 Website
SiteGround.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 Magento
Mathew Beane
 
Connections Migrations the easy way Soccnx10
Connections Migrations the easy way Soccnx10Connections Migrations the easy way Soccnx10
Connections Migrations the easy way Soccnx10
Sharon James
 
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
LetsConnect
 
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
Konstantin 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 Docker
Matomy
 
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
Carlo 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 -oops
Joseph 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 Storage
Mark McHenry
 
WordPress Hosting Basics
WordPress Hosting BasicsWordPress Hosting Basics
WordPress Hosting Basics
Chris 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 Workbench
Howard Greenberg
 
The 5 Minute MySQL DBA
The 5 Minute MySQL DBAThe 5 Minute MySQL DBA
The 5 Minute MySQL DBA
Irawan Soetomo
 
Technical track-afterimaging Progress Database
Technical track-afterimaging Progress DatabaseTechnical track-afterimaging Progress Database
Technical track-afterimaging Progress Database
Vinh Nguyen
 
Learn WordPress - Live Session 2 Slides
Learn WordPress - Live Session 2 SlidesLearn WordPress - Live Session 2 Slides
Learn WordPress - Live Session 2 Slides
Ahmed Mohammed Nagdy
 

More from Graham Weldon (20)

HackLang Introduction
HackLang IntroductionHackLang Introduction
HackLang Introduction
Graham Weldon
 
CakePHP and Open Source - Newcastle University
CakePHP and Open Source - Newcastle UniversityCakePHP and Open Source - Newcastle University
CakePHP and Open Source - Newcastle University
Graham Weldon
 
SydPHP March 2012 Meetup
SydPHP March 2012 MeetupSydPHP March 2012 Meetup
SydPHP March 2012 Meetup
Graham Weldon
 
SydPHP June 2012 - GovHack overview
SydPHP June 2012 - GovHack overviewSydPHP June 2012 - GovHack overview
SydPHP June 2012 - GovHack overview
Graham Weldon
 
SydPHP April 2012
SydPHP April 2012SydPHP April 2012
SydPHP April 2012
Graham Weldon
 
SydPHP May 2012 - Deployment
SydPHP May 2012 - DeploymentSydPHP May 2012 - Deployment
SydPHP May 2012 - Deployment
Graham Weldon
 
Building 3D apps with Javascript
Building 3D apps with JavascriptBuilding 3D apps with Javascript
Building 3D apps with Javascript
Graham Weldon
 
An introduction to Titanium
An introduction to TitaniumAn introduction to Titanium
An introduction to Titanium
Graham 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 traits
Graham Weldon
 
MySQL Performance - SydPHP October 2011
MySQL Performance - SydPHP October 2011MySQL Performance - SydPHP October 2011
MySQL Performance - SydPHP October 2011
Graham Weldon
 
CakePHP 2.0 - PHP Matsuri 2011
CakePHP 2.0 - PHP Matsuri 2011CakePHP 2.0 - PHP Matsuri 2011
CakePHP 2.0 - PHP Matsuri 2011
Graham Weldon
 
Nginx in production
Nginx in productionNginx in production
Nginx in production
Graham Weldon
 
The business behind open source
The business behind open sourceThe business behind open source
The business behind open source
Graham 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 world
Graham Weldon
 
CakePHP - The Path to 2.0
CakePHP - The Path to 2.0CakePHP - The Path to 2.0
CakePHP - The Path to 2.0
Graham Weldon
 
CakePHP Tutorial - OSDC 2010
CakePHP Tutorial - OSDC 2010CakePHP Tutorial - OSDC 2010
CakePHP Tutorial - OSDC 2010
Graham Weldon
 
Debugging and Profiling PHP
Debugging and Profiling PHPDebugging and Profiling PHP
Debugging and Profiling PHP
Graham Weldon
 
OSDC LIghtning Talk - Context Free Art
OSDC LIghtning Talk - Context Free ArtOSDC LIghtning Talk - Context Free Art
OSDC LIghtning Talk - Context Free Art
Graham 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 CakePHP
Graham Weldon
 
HackLang Introduction
HackLang IntroductionHackLang Introduction
HackLang Introduction
Graham Weldon
 
CakePHP and Open Source - Newcastle University
CakePHP and Open Source - Newcastle UniversityCakePHP and Open Source - Newcastle University
CakePHP and Open Source - Newcastle University
Graham Weldon
 
SydPHP March 2012 Meetup
SydPHP March 2012 MeetupSydPHP March 2012 Meetup
SydPHP March 2012 Meetup
Graham Weldon
 
SydPHP June 2012 - GovHack overview
SydPHP June 2012 - GovHack overviewSydPHP June 2012 - GovHack overview
SydPHP June 2012 - GovHack overview
Graham Weldon
 
SydPHP May 2012 - Deployment
SydPHP May 2012 - DeploymentSydPHP May 2012 - Deployment
SydPHP May 2012 - Deployment
Graham Weldon
 
Building 3D apps with Javascript
Building 3D apps with JavascriptBuilding 3D apps with Javascript
Building 3D apps with Javascript
Graham Weldon
 
An introduction to Titanium
An introduction to TitaniumAn introduction to Titanium
An introduction to Titanium
Graham 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 traits
Graham Weldon
 
MySQL Performance - SydPHP October 2011
MySQL Performance - SydPHP October 2011MySQL Performance - SydPHP October 2011
MySQL Performance - SydPHP October 2011
Graham Weldon
 
CakePHP 2.0 - PHP Matsuri 2011
CakePHP 2.0 - PHP Matsuri 2011CakePHP 2.0 - PHP Matsuri 2011
CakePHP 2.0 - PHP Matsuri 2011
Graham Weldon
 
The business behind open source
The business behind open sourceThe business behind open source
The business behind open source
Graham 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 world
Graham Weldon
 
CakePHP - The Path to 2.0
CakePHP - The Path to 2.0CakePHP - The Path to 2.0
CakePHP - The Path to 2.0
Graham Weldon
 
CakePHP Tutorial - OSDC 2010
CakePHP Tutorial - OSDC 2010CakePHP Tutorial - OSDC 2010
CakePHP Tutorial - OSDC 2010
Graham Weldon
 
Debugging and Profiling PHP
Debugging and Profiling PHPDebugging and Profiling PHP
Debugging and Profiling PHP
Graham Weldon
 
OSDC LIghtning Talk - Context Free Art
OSDC LIghtning Talk - Context Free ArtOSDC LIghtning Talk - Context Free Art
OSDC LIghtning Talk - Context Free Art
Graham 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 CakePHP
Graham Weldon
 

Recently uploaded (20)

How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 

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
  • 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 • [email protected]
  • 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