SlideShare a Scribd company logo
1 of 29
Download to read offline
High Performance PHP &
MySQL Scaling Techniques

         Eli White
       http://eliw.com/
What's all this then?

● Introduction

● Standard Solution

● Quick PHP Solutions

● APC User Variables

● Memcached

● Purpose Driven Database Servers

● Database Partitioning

         The Knight Rider Methodology to Software Development
                  Eli White - ZendCon 08 - 9/17/2008
Introduction



              Performance is a problem



Scaling your performance is a bigger problem




   The Knight Rider Methodology to Software Development
            Eli White - ZendCon 08 - 9/17/2008
Standard Solution




How most people setup a basic solution that scales 'so far'.




         The Knight Rider Methodology to Software Development
                  Eli White - ZendCon 08 - 9/17/2008
Standard Solution

Many PHP Servers behind a load balancer:




The Knight Rider Methodology to Software Development
         Eli White - ZendCon 08 - 9/17/2008
Standard Solution

Many MySQL slaves, talking to a master




The Knight Rider Methodology to Software Development
         Eli White - ZendCon 08 - 9/17/2008
Standard Solution

Randomized or 'planned' PHP to MySQL relations




   The Knight Rider Methodology to Software Development
            Eli White - ZendCon 08 - 9/17/2008
Quick PHP Solutions




A number of things that will speed up PHP,
       if that is your bottleneck.




 The Knight Rider Methodology to Software Development
          Eli White - ZendCon 08 - 9/17/2008
Use an opcode cache



PHP by default recompiles every page, every request.


              APC (Alternative PHP Cache)
            http://pecl.php.net/package/APC




      The Knight Rider Methodology to Software Development
               Eli White - ZendCon 08 - 9/17/2008
Stop using PHP




Specifically move to faster server software, such as
     thttpd for static HTML pages, images, etc.




     The Knight Rider Methodology to Software Development
              Eli White - ZendCon 08 - 9/17/2008
Pregenerate Content




If pages do not need to be instantly updated,
      generate them on a regular basis.




  The Knight Rider Methodology to Software Development
           Eli White - ZendCon 08 - 9/17/2008
Cache content


Half-way between dynamic and pregenerated.

               Cache it as you create it.


                  Example: jpcache
              http://www.jpcache.com/

            Or Smarty does this for you.


  The Knight Rider Methodology to Software Development
           Eli White - ZendCon 08 - 9/17/2008
Memcached




                         What is it?




The Knight Rider Methodology to Software Development
         Eli White - ZendCon 08 - 9/17/2008
Memcached Performance gains


Allows complicated processing to be done once.

      Cache chunks of data that are used
          on many different pages.

       Still be able to dynamically create
      pages, but using some cached data.



   The Knight Rider Methodology to Software Development
            Eli White - ZendCon 08 - 9/17/2008
Memcached Server Farm




Setting up a pool of servers
 ● PHP Provides the basics of distributing load
   across servers.


Taking it to the next level
 ● Failover protection, Redundancy, etc.

       The Knight Rider Methodology to Software Development
                Eli White - ZendCon 08 - 9/17/2008
Memcached disadvantages / issues


● Coding the actual caching decisions

● Out of date / Old data

● Perpetuating slave lag

● Scaling it further / Getting the most out of caching

● Balancing the farm load



        The Knight Rider Methodology to Software Development
                 Eli White - ZendCon 08 - 9/17/2008
Creating Generic Memcached Solutions

● Create generic/abstract system (classes) to hide
  connections, load balancing, fail over, and server farm
  aspects for you.
 ● You only ever say 'store' or 'retrieve'


● Next Step: Create a system (classes) to even abstract that
  further. To completely hide how the data is stored,
  retrieved, and cached.
 ● You just 'ask for the data', and the classes handle everything.


           The Knight Rider Methodology to Software Development
                    Eli White - ZendCon 08 - 9/17/2008
APC User Variables




                         What is it?




The Knight Rider Methodology to Software Development
         Eli White - ZendCon 08 - 9/17/2008
APC User Variables Pros & Cons

Advantages:
 ● You already have the ability to do it.
 ● Local memory access, no network traffic.
 ● Stores data as native PHP types in local memory.


Limitations:
 ● Data that is stored is local to that web server.
 ● Has to share memory resources with web server.


         The Knight Rider Methodology to Software Development
                  Eli White - ZendCon 08 - 9/17/2008
Purpose Driven MySQL Pools




Creating separate slave pools, that are close to identical in
            order to isolate high database load.




         The Knight Rider Methodology to Software Development
                  Eli White - ZendCon 08 - 9/17/2008
Purpose Driven Pool Example




 The Knight Rider Methodology to Software Development
          Eli White - ZendCon 08 - 9/17/2008
Database Partitioning


                                 What is it?


                  Simplest Definition:
Breaking up your database into a number of smaller ones.


      (And I'm not talking about built-in versions)



        The Knight Rider Methodology to Software Development
                 Eli White - ZendCon 08 - 9/17/2008
Pros & Cons of Partitioning



Pros                                     Cons
 ● Greater performance                      ● Loss of direct SQL support
 ● Tweakable / Scalable                     ● Increased PHP load
                                            ● Complicated programming




         The Knight Rider Methodology to Software Development
                  Eli White - ZendCon 08 - 9/17/2008
Main Types of Partitioning


   Horizontal                                               Vertical




                      Application Level


Discussion topic: Partitioning within same database

     The Knight Rider Methodology to Software Development
              Eli White - ZendCon 08 - 9/17/2008
Horizontal Partitioning

  “Moving various rows of your table into different tables”


Various methodologies:
  ●   Range Based
  ●   Date Based
  ●   Interlaced
  ●   User Based
  ●   Partial partitioning works well here

            The Knight Rider Methodology to Software Development
                     Eli White - ZendCon 08 - 9/17/2008
Vertical Partitioning


“Moving various columns of your table into different tables”


Various methodologies:
  ●   Move rarely used columns into auxiliary table
  ●   Move often empty columns into auxiliary table
  ●   Move columns that are not used in where clauses



            The Knight Rider Methodology to Software Development
                     Eli White - ZendCon 08 - 9/17/2008
Application Level Partitioning


 “Moving various tables of your DB onto different servers”


Various methodologies:
  ●   Move single tables to specific servers
  ●   Move groups of related tables together to allow joining




            The Knight Rider Methodology to Software Development
                     Eli White - ZendCon 08 - 9/17/2008
Generic code to handle partitioning



     Coding to partitions can get complicated.

  Make a set of functions/classes that understand
     the partitions so that you don't have to.

 Your code, again, should only be concerned with:
                Give me the data!



     The Knight Rider Methodology to Software Development
              Eli White - ZendCon 08 - 9/17/2008
Any Questions?


For this presentation & more:

       http://eliw.com/

More Related Content

What's hot

Webinar slides: How to Measure Database Availability?
Webinar slides: How to Measure Database Availability?Webinar slides: How to Measure Database Availability?
Webinar slides: How to Measure Database Availability?
Severalnines
 
Top 10 Tips for an Effective Postgres Deployment
Top 10 Tips for an Effective Postgres DeploymentTop 10 Tips for an Effective Postgres Deployment
Top 10 Tips for an Effective Postgres Deployment
EDB
 

What's hot (20)

5 Tips to Simplify the Management of Your Postgres Database
5 Tips to Simplify the Management of Your Postgres Database5 Tips to Simplify the Management of Your Postgres Database
5 Tips to Simplify the Management of Your Postgres Database
 
Active/Active Database Solutions with Log Based Replication in xDB 6.0
Active/Active Database Solutions with Log Based Replication in xDB 6.0Active/Active Database Solutions with Log Based Replication in xDB 6.0
Active/Active Database Solutions with Log Based Replication in xDB 6.0
 
Which Postgres is Right for You?
Which Postgres is Right for You? Which Postgres is Right for You?
Which Postgres is Right for You?
 
Exploring Postgres with Bruce Momjian
Exploring Postgres with Bruce MomjianExploring Postgres with Bruce Momjian
Exploring Postgres with Bruce Momjian
 
(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...
(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...
(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...
 
Hello World with EDB Postgres
Hello World with EDB PostgresHello World with EDB Postgres
Hello World with EDB Postgres
 
Webinar slides: How to Measure Database Availability?
Webinar slides: How to Measure Database Availability?Webinar slides: How to Measure Database Availability?
Webinar slides: How to Measure Database Availability?
 
DevOps Culture & Enablement with Postgres Plus Cloud Database
DevOps Culture & Enablement with Postgres Plus Cloud DatabaseDevOps Culture & Enablement with Postgres Plus Cloud Database
DevOps Culture & Enablement with Postgres Plus Cloud Database
 
IMCSummit 2015 - Day 2 Developer Track - Implementing a Highly Scalable In-Me...
IMCSummit 2015 - Day 2 Developer Track - Implementing a Highly Scalable In-Me...IMCSummit 2015 - Day 2 Developer Track - Implementing a Highly Scalable In-Me...
IMCSummit 2015 - Day 2 Developer Track - Implementing a Highly Scalable In-Me...
 
Postgres Point-in-Time Recovery
Postgres Point-in-Time RecoveryPostgres Point-in-Time Recovery
Postgres Point-in-Time Recovery
 
Business Continuity Considerations for a More Reliable Postgres Environment
Business Continuity Considerations for a More Reliable Postgres EnvironmentBusiness Continuity Considerations for a More Reliable Postgres Environment
Business Continuity Considerations for a More Reliable Postgres Environment
 
Migrating from Oracle to Postgres
Migrating from Oracle to PostgresMigrating from Oracle to Postgres
Migrating from Oracle to Postgres
 
Whats New in Postgres 12
Whats New in Postgres 12Whats New in Postgres 12
Whats New in Postgres 12
 
Tips to drive maria db cluster performance for nextcloud
Tips to drive maria db cluster performance for nextcloudTips to drive maria db cluster performance for nextcloud
Tips to drive maria db cluster performance for nextcloud
 
EDB Failover Manager - Features and Demo
EDB Failover Manager - Features and DemoEDB Failover Manager - Features and Demo
EDB Failover Manager - Features and Demo
 
Become a MySQL DBA - webinar series - slides: Which High Availability solution?
Become a MySQL DBA - webinar series - slides: Which High Availability solution?Become a MySQL DBA - webinar series - slides: Which High Availability solution?
Become a MySQL DBA - webinar series - slides: Which High Availability solution?
 
Minimize Headaches with Your Postgres Deployment
Minimize Headaches with Your Postgres DeploymentMinimize Headaches with Your Postgres Deployment
Minimize Headaches with Your Postgres Deployment
 
Postgres Takes Charge Around the World
Postgres Takes Charge Around the WorldPostgres Takes Charge Around the World
Postgres Takes Charge Around the World
 
Top 10 Tips for an Effective Postgres Deployment
Top 10 Tips for an Effective Postgres DeploymentTop 10 Tips for an Effective Postgres Deployment
Top 10 Tips for an Effective Postgres Deployment
 
Webinar slides: Our Guide to MySQL & MariaDB Performance Tuning
Webinar slides: Our Guide to MySQL & MariaDB Performance TuningWebinar slides: Our Guide to MySQL & MariaDB Performance Tuning
Webinar slides: Our Guide to MySQL & MariaDB Performance Tuning
 

Viewers also liked

Nginx Scripting - Extending Nginx Functionalities with Lua
Nginx Scripting - Extending Nginx Functionalities with LuaNginx Scripting - Extending Nginx Functionalities with Lua
Nginx Scripting - Extending Nginx Functionalities with Lua
Tony Fabeen
 

Viewers also liked (20)

Scaling PHP to 40 Million Uniques
Scaling PHP to 40 Million UniquesScaling PHP to 40 Million Uniques
Scaling PHP to 40 Million Uniques
 
Scaling a High Traffic Web Application: Our Journey from Java to PHP
Scaling a High Traffic Web Application: Our Journey from Java to PHPScaling a High Traffic Web Application: Our Journey from Java to PHP
Scaling a High Traffic Web Application: Our Journey from Java to PHP
 
Architechture of a social network for 30M users
Architechture of a social network for 30M usersArchitechture of a social network for 30M users
Architechture of a social network for 30M users
 
Web Performance, Scalability, and Testing Techniques - Boston PHP Meetup
Web Performance, Scalability, and Testing Techniques - Boston PHP MeetupWeb Performance, Scalability, and Testing Techniques - Boston PHP Meetup
Web Performance, Scalability, and Testing Techniques - Boston PHP Meetup
 
Accelerating Nginx Web Server Performance
Accelerating Nginx Web Server PerformanceAccelerating Nginx Web Server Performance
Accelerating Nginx Web Server Performance
 
5 critical-optimizations.v2
5 critical-optimizations.v25 critical-optimizations.v2
5 critical-optimizations.v2
 
Webpage Caches - the big picture (WordPress too)
Webpage Caches - the big picture (WordPress too)Webpage Caches - the big picture (WordPress too)
Webpage Caches - the big picture (WordPress too)
 
Running PHP on Nginx / PHP wgtn
Running PHP on Nginx / PHP wgtnRunning PHP on Nginx / PHP wgtn
Running PHP on Nginx / PHP wgtn
 
Caching and tuning fun for high scalability @ FOSDEM 2012
Caching and tuning fun for high scalability @ FOSDEM 2012Caching and tuning fun for high scalability @ FOSDEM 2012
Caching and tuning fun for high scalability @ FOSDEM 2012
 
PHP High Availability High Performance
PHP High Availability High PerformancePHP High Availability High Performance
PHP High Availability High Performance
 
PHPDay 2013 - High Performance PHP
PHPDay 2013 - High Performance PHPPHPDay 2013 - High Performance PHP
PHPDay 2013 - High Performance PHP
 
Maximizing PHP Performance with NGINX
Maximizing PHP Performance with NGINXMaximizing PHP Performance with NGINX
Maximizing PHP Performance with NGINX
 
How to scale PHP applications
How to scale PHP applicationsHow to scale PHP applications
How to scale PHP applications
 
Northeast PHP - High Performance PHP
Northeast PHP - High Performance PHPNortheast PHP - High Performance PHP
Northeast PHP - High Performance PHP
 
Nginx Scripting - Extending Nginx Functionalities with Lua
Nginx Scripting - Extending Nginx Functionalities with LuaNginx Scripting - Extending Nginx Functionalities with Lua
Nginx Scripting - Extending Nginx Functionalities with Lua
 
Nginx pres
Nginx presNginx pres
Nginx pres
 
How to secure your web applications with NGINX
How to secure your web applications with NGINXHow to secure your web applications with NGINX
How to secure your web applications with NGINX
 
How to monitor NGINX
How to monitor NGINXHow to monitor NGINX
How to monitor NGINX
 
How to be Successful with Responsive Sites (Koombea & NGINX) - English
How to be Successful with Responsive Sites (Koombea & NGINX) - EnglishHow to be Successful with Responsive Sites (Koombea & NGINX) - English
How to be Successful with Responsive Sites (Koombea & NGINX) - English
 
Load Balancing and Scaling with NGINX
Load Balancing and Scaling with NGINXLoad Balancing and Scaling with NGINX
Load Balancing and Scaling with NGINX
 

Similar to High Performance Php My Sql Scaling Techniques

001 hbase introduction
001 hbase introduction001 hbase introduction
001 hbase introduction
Scott Miao
 

Similar to High Performance Php My Sql Scaling Techniques (20)

Zendcon 2008 Knight Rider
Zendcon 2008 Knight RiderZendcon 2008 Knight Rider
Zendcon 2008 Knight Rider
 
How do I securely deploy Internet websites in PHP on my IBMi?
How do I securely deploy Internet websites in PHP on my IBMi?How do I securely deploy Internet websites in PHP on my IBMi?
How do I securely deploy Internet websites in PHP on my IBMi?
 
Qcon
QconQcon
Qcon
 
SD Times - Docker v2
SD Times - Docker v2SD Times - Docker v2
SD Times - Docker v2
 
Using Databases and Containers From Development to Deployment
Using Databases and Containers  From Development to DeploymentUsing Databases and Containers  From Development to Deployment
Using Databases and Containers From Development to Deployment
 
Developer-Friendly CI / CD for Kubernetes
Developer-Friendly CI / CD for KubernetesDeveloper-Friendly CI / CD for Kubernetes
Developer-Friendly CI / CD for Kubernetes
 
001 hbase introduction
001 hbase introduction001 hbase introduction
001 hbase introduction
 
ASP.NET MVC Zero to Hero
ASP.NET MVC Zero to HeroASP.NET MVC Zero to Hero
ASP.NET MVC Zero to Hero
 
Turbocharging php applications with zend server (workshop)
Turbocharging php applications with zend server (workshop)Turbocharging php applications with zend server (workshop)
Turbocharging php applications with zend server (workshop)
 
Gear6 and Scaling Website Performance: Caching Session and Profile Data with...
Gear6 and Scaling Website Performance:  Caching Session and Profile Data with...Gear6 and Scaling Website Performance:  Caching Session and Profile Data with...
Gear6 and Scaling Website Performance: Caching Session and Profile Data with...
 
JBoss Architect Forum London - October 2013 - Platform as a What?
JBoss Architect Forum London - October 2013 - Platform as a What?JBoss Architect Forum London - October 2013 - Platform as a What?
JBoss Architect Forum London - October 2013 - Platform as a What?
 
Viridians on Rails
Viridians on RailsViridians on Rails
Viridians on Rails
 
Cloud-Native .Net des applications containerisées .Net sur Linux, Windows e...
 Cloud-Native .Net des applications containerisées .Net sur Linux, Windows e... Cloud-Native .Net des applications containerisées .Net sur Linux, Windows e...
Cloud-Native .Net des applications containerisées .Net sur Linux, Windows e...
 
.Net Core - not your daddy's dotnet
.Net Core - not your daddy's dotnet.Net Core - not your daddy's dotnet
.Net Core - not your daddy's dotnet
 
MySQL's NoSQL -- Texas Linuxfest August 22nd 2015
MySQL's NoSQL  -- Texas Linuxfest August 22nd 2015MySQL's NoSQL  -- Texas Linuxfest August 22nd 2015
MySQL's NoSQL -- Texas Linuxfest August 22nd 2015
 
IBM Edge2015 Las Vegas
IBM Edge2015 Las VegasIBM Edge2015 Las Vegas
IBM Edge2015 Las Vegas
 
Building and managing applications fast for IBM i
Building and managing applications fast for IBM iBuilding and managing applications fast for IBM i
Building and managing applications fast for IBM i
 
Pivotal cloud cache for .net microservices
Pivotal cloud cache for .net microservicesPivotal cloud cache for .net microservices
Pivotal cloud cache for .net microservices
 
The NRB Group mainframe day 2021 - Containerisation on Z - Paul Pilotto - Seb...
The NRB Group mainframe day 2021 - Containerisation on Z - Paul Pilotto - Seb...The NRB Group mainframe day 2021 - Containerisation on Z - Paul Pilotto - Seb...
The NRB Group mainframe day 2021 - Containerisation on Z - Paul Pilotto - Seb...
 
Severalnines Training: MySQL® Cluster - Part IX
Severalnines Training: MySQL® Cluster - Part IXSeveralnines Training: MySQL® Cluster - Part IX
Severalnines Training: MySQL® Cluster - Part IX
 

More from ZendCon

More from ZendCon (20)

Framework Shootout
Framework ShootoutFramework Shootout
Framework Shootout
 
Zend_Tool: Practical use and Extending
Zend_Tool: Practical use and ExtendingZend_Tool: Practical use and Extending
Zend_Tool: Practical use and Extending
 
PHP on IBM i Tutorial
PHP on IBM i TutorialPHP on IBM i Tutorial
PHP on IBM i Tutorial
 
PHP on Windows - What's New
PHP on Windows - What's NewPHP on Windows - What's New
PHP on Windows - What's New
 
PHP and Platform Independance in the Cloud
PHP and Platform Independance in the CloudPHP and Platform Independance in the Cloud
PHP and Platform Independance in the Cloud
 
I18n with PHP 5.3
I18n with PHP 5.3I18n with PHP 5.3
I18n with PHP 5.3
 
Cloud Computing: The Hard Problems Never Go Away
Cloud Computing: The Hard Problems Never Go AwayCloud Computing: The Hard Problems Never Go Away
Cloud Computing: The Hard Problems Never Go Away
 
Planning for Synchronization with Browser-Local Databases
Planning for Synchronization with Browser-Local DatabasesPlanning for Synchronization with Browser-Local Databases
Planning for Synchronization with Browser-Local Databases
 
Magento - a Zend Framework Application
Magento - a Zend Framework ApplicationMagento - a Zend Framework Application
Magento - a Zend Framework Application
 
Enterprise-Class PHP Security
Enterprise-Class PHP SecurityEnterprise-Class PHP Security
Enterprise-Class PHP Security
 
PHP and IBM i - Database Alternatives
PHP and IBM i - Database AlternativesPHP and IBM i - Database Alternatives
PHP and IBM i - Database Alternatives
 
Zend Core on IBM i - Security Considerations
Zend Core on IBM i - Security ConsiderationsZend Core on IBM i - Security Considerations
Zend Core on IBM i - Security Considerations
 
Application Diagnosis with Zend Server Tracing
Application Diagnosis with Zend Server TracingApplication Diagnosis with Zend Server Tracing
Application Diagnosis with Zend Server Tracing
 
Insights from the Experts: How PHP Leaders Are Transforming High-Impact PHP A...
Insights from the Experts: How PHP Leaders Are Transforming High-Impact PHP A...Insights from the Experts: How PHP Leaders Are Transforming High-Impact PHP A...
Insights from the Experts: How PHP Leaders Are Transforming High-Impact PHP A...
 
Solving the C20K problem: Raising the bar in PHP Performance and Scalability
Solving the C20K problem: Raising the bar in PHP Performance and ScalabilitySolving the C20K problem: Raising the bar in PHP Performance and Scalability
Solving the C20K problem: Raising the bar in PHP Performance and Scalability
 
Joe Staner Zend Con 2008
Joe Staner Zend Con 2008Joe Staner Zend Con 2008
Joe Staner Zend Con 2008
 
Tiery Eyed
Tiery EyedTiery Eyed
Tiery Eyed
 
Make your PHP Application Software-as-a-Service (SaaS) Ready with the Paralle...
Make your PHP Application Software-as-a-Service (SaaS) Ready with the Paralle...Make your PHP Application Software-as-a-Service (SaaS) Ready with the Paralle...
Make your PHP Application Software-as-a-Service (SaaS) Ready with the Paralle...
 
DB2 Storage Engine for MySQL and Open Source Applications Session
DB2 Storage Engine for MySQL and Open Source Applications SessionDB2 Storage Engine for MySQL and Open Source Applications Session
DB2 Storage Engine for MySQL and Open Source Applications Session
 
Digital Identity
Digital IdentityDigital Identity
Digital Identity
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

High Performance Php My Sql Scaling Techniques

  • 1. High Performance PHP & MySQL Scaling Techniques Eli White http://eliw.com/
  • 2. What's all this then? ● Introduction ● Standard Solution ● Quick PHP Solutions ● APC User Variables ● Memcached ● Purpose Driven Database Servers ● Database Partitioning The Knight Rider Methodology to Software Development Eli White - ZendCon 08 - 9/17/2008
  • 3. Introduction Performance is a problem Scaling your performance is a bigger problem The Knight Rider Methodology to Software Development Eli White - ZendCon 08 - 9/17/2008
  • 4. Standard Solution How most people setup a basic solution that scales 'so far'. The Knight Rider Methodology to Software Development Eli White - ZendCon 08 - 9/17/2008
  • 5. Standard Solution Many PHP Servers behind a load balancer: The Knight Rider Methodology to Software Development Eli White - ZendCon 08 - 9/17/2008
  • 6. Standard Solution Many MySQL slaves, talking to a master The Knight Rider Methodology to Software Development Eli White - ZendCon 08 - 9/17/2008
  • 7. Standard Solution Randomized or 'planned' PHP to MySQL relations The Knight Rider Methodology to Software Development Eli White - ZendCon 08 - 9/17/2008
  • 8. Quick PHP Solutions A number of things that will speed up PHP, if that is your bottleneck. The Knight Rider Methodology to Software Development Eli White - ZendCon 08 - 9/17/2008
  • 9. Use an opcode cache PHP by default recompiles every page, every request. APC (Alternative PHP Cache) http://pecl.php.net/package/APC The Knight Rider Methodology to Software Development Eli White - ZendCon 08 - 9/17/2008
  • 10. Stop using PHP Specifically move to faster server software, such as thttpd for static HTML pages, images, etc. The Knight Rider Methodology to Software Development Eli White - ZendCon 08 - 9/17/2008
  • 11. Pregenerate Content If pages do not need to be instantly updated, generate them on a regular basis. The Knight Rider Methodology to Software Development Eli White - ZendCon 08 - 9/17/2008
  • 12. Cache content Half-way between dynamic and pregenerated. Cache it as you create it. Example: jpcache http://www.jpcache.com/ Or Smarty does this for you. The Knight Rider Methodology to Software Development Eli White - ZendCon 08 - 9/17/2008
  • 13. Memcached What is it? The Knight Rider Methodology to Software Development Eli White - ZendCon 08 - 9/17/2008
  • 14. Memcached Performance gains Allows complicated processing to be done once. Cache chunks of data that are used on many different pages. Still be able to dynamically create pages, but using some cached data. The Knight Rider Methodology to Software Development Eli White - ZendCon 08 - 9/17/2008
  • 15. Memcached Server Farm Setting up a pool of servers ● PHP Provides the basics of distributing load across servers. Taking it to the next level ● Failover protection, Redundancy, etc. The Knight Rider Methodology to Software Development Eli White - ZendCon 08 - 9/17/2008
  • 16. Memcached disadvantages / issues ● Coding the actual caching decisions ● Out of date / Old data ● Perpetuating slave lag ● Scaling it further / Getting the most out of caching ● Balancing the farm load The Knight Rider Methodology to Software Development Eli White - ZendCon 08 - 9/17/2008
  • 17. Creating Generic Memcached Solutions ● Create generic/abstract system (classes) to hide connections, load balancing, fail over, and server farm aspects for you. ● You only ever say 'store' or 'retrieve' ● Next Step: Create a system (classes) to even abstract that further. To completely hide how the data is stored, retrieved, and cached. ● You just 'ask for the data', and the classes handle everything. The Knight Rider Methodology to Software Development Eli White - ZendCon 08 - 9/17/2008
  • 18. APC User Variables What is it? The Knight Rider Methodology to Software Development Eli White - ZendCon 08 - 9/17/2008
  • 19. APC User Variables Pros & Cons Advantages: ● You already have the ability to do it. ● Local memory access, no network traffic. ● Stores data as native PHP types in local memory. Limitations: ● Data that is stored is local to that web server. ● Has to share memory resources with web server. The Knight Rider Methodology to Software Development Eli White - ZendCon 08 - 9/17/2008
  • 20. Purpose Driven MySQL Pools Creating separate slave pools, that are close to identical in order to isolate high database load. The Knight Rider Methodology to Software Development Eli White - ZendCon 08 - 9/17/2008
  • 21. Purpose Driven Pool Example The Knight Rider Methodology to Software Development Eli White - ZendCon 08 - 9/17/2008
  • 22. Database Partitioning What is it? Simplest Definition: Breaking up your database into a number of smaller ones. (And I'm not talking about built-in versions) The Knight Rider Methodology to Software Development Eli White - ZendCon 08 - 9/17/2008
  • 23. Pros & Cons of Partitioning Pros Cons ● Greater performance ● Loss of direct SQL support ● Tweakable / Scalable ● Increased PHP load ● Complicated programming The Knight Rider Methodology to Software Development Eli White - ZendCon 08 - 9/17/2008
  • 24. Main Types of Partitioning Horizontal Vertical Application Level Discussion topic: Partitioning within same database The Knight Rider Methodology to Software Development Eli White - ZendCon 08 - 9/17/2008
  • 25. Horizontal Partitioning “Moving various rows of your table into different tables” Various methodologies: ● Range Based ● Date Based ● Interlaced ● User Based ● Partial partitioning works well here The Knight Rider Methodology to Software Development Eli White - ZendCon 08 - 9/17/2008
  • 26. Vertical Partitioning “Moving various columns of your table into different tables” Various methodologies: ● Move rarely used columns into auxiliary table ● Move often empty columns into auxiliary table ● Move columns that are not used in where clauses The Knight Rider Methodology to Software Development Eli White - ZendCon 08 - 9/17/2008
  • 27. Application Level Partitioning “Moving various tables of your DB onto different servers” Various methodologies: ● Move single tables to specific servers ● Move groups of related tables together to allow joining The Knight Rider Methodology to Software Development Eli White - ZendCon 08 - 9/17/2008
  • 28. Generic code to handle partitioning Coding to partitions can get complicated. Make a set of functions/classes that understand the partitions so that you don't have to. Your code, again, should only be concerned with: Give me the data! The Knight Rider Methodology to Software Development Eli White - ZendCon 08 - 9/17/2008
  • 29. Any Questions? For this presentation & more: http://eliw.com/