SlideShare ist ein Scribd-Unternehmen logo
1 von 50
LAMP Optimization



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
50 Slides!
                                                  (counting this one)

                                    http://slideshare.net/csixty4



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
I’m not a sysadmin




LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
I’m not a sysadmin

                      but I know what I like.


LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
I
                                                                                       Like
                                                                                       Fast
                                                                                       Servers
LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
LAMP
                                                                  Linux
                                                                 Apache
                                                                 MySQL
                                                                  PHP


LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
Optimizing Linux
     Prevent swapping
     Disable atime updates
     Buy another machine



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
vmstat -S M
                                      Virtual memory statistics in
                                       Megabytes (or Kilobytes)




LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
“Free” drop +
                                 High “Swap” =
                                Poor performance



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
RAM is cheap.




LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
“Access Timestamp”



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
“I agree, we really should do
          something about atime.”
                                                                                   - Linus Torvalds, 2007



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
Edit /etc/fstab
                                                In the fourth column,
                                                add noatime,nodiratime
                                                Save. Reboot.




LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
Time is money.



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
Add another server
          Move database to its own server
          Load balance
          Cluster




LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
Optimizing Apache
     mod_cache
     Keep the riff-raff out
     Increase MaxClients



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
a2enmod cache mem_cache




LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
Cache static
                                      content in RAM




LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
Cache static
                                      content in RAM
                                                           It’s cheap.




LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
mod_evasive



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
Keep out vulnerability
                       scanners and attacks



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
More resources for
                               everyone else.



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
MaxClients in your httpd.conf




LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
Trial and error



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
Enough to handle
          simultaneous connections.



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
And RAM is still cheap.



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
Optimizing MySQL
     Key Buffer
     Query Cache
     InnoDB



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
Key Buffer in my.cnf



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
Caches table indexes



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
key_buffer_size=128M

                         20-25% (or so) of available RAM




LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
Query Buffer in my.cnf



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
Caches parsed SELECTs



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
query_buffer_size=64M

                                         Half of key_buffer_size




LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
You get the idea.
InnoDB database engine



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
Row vs. table locking



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
Faster UPDATE



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
Optimized for key access



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
Faster SELECT & UPDATE



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
Optimizing PHP
     Upgrade to PHP 5.3
     Install an accelerator
     Enable output buffering



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
PHP 5.3 has mysqlnd



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
Native Driver



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
Up to 30% faster



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
PHP Accelerators

          Alternative PHP Cache (APC) : 3x-5x faster
          eAccelerator
          XCache
          Zend Optimizer+




LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
Output Buffering



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
Actually makes code
                          run slightly slower



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
Browser gets
                            whole page at once



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
It certainly feels faster



LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
Questions?
     davidmichaelross.com
     daveross.tel




LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009

Weitere ähnliche Inhalte

Ähnlich wie LAMP Optimization

Profiling PHP & Javascript
Profiling PHP & JavascriptProfiling PHP & Javascript
Profiling PHP & JavascriptDave Ross
 
Lint - PHP & Javascript Code Checking
Lint - PHP & Javascript Code CheckingLint - PHP & Javascript Code Checking
Lint - PHP & Javascript Code CheckingDave Ross
 
Balsamiq Mockups
Balsamiq MockupsBalsamiq Mockups
Balsamiq MockupsDave Ross
 
RDF and SPARQL for PHP Developers (at New York Semantic Web Meetup)
RDF and SPARQL for PHP Developers (at New York Semantic Web Meetup)RDF and SPARQL for PHP Developers (at New York Semantic Web Meetup)
RDF and SPARQL for PHP Developers (at New York Semantic Web Meetup)Benjamin Nowack
 
NY WebPerf Sept '22 - Performance Mistakes - An HTTP Archive Deep Dive
NY WebPerf Sept '22 - Performance Mistakes - An HTTP Archive Deep DiveNY WebPerf Sept '22 - Performance Mistakes - An HTTP Archive Deep Dive
NY WebPerf Sept '22 - Performance Mistakes - An HTTP Archive Deep DivePaul Calvano
 
Ruby application based on http
Ruby application based on httpRuby application based on http
Ruby application based on httpRichard Huang
 
Spotify: Playing for millions, tuning for more
Spotify: Playing for millions, tuning for moreSpotify: Playing for millions, tuning for more
Spotify: Playing for millions, tuning for moreNick Barkas
 
Build a RESTful API with the Serverless Framework
Build a RESTful API with the Serverless FrameworkBuild a RESTful API with the Serverless Framework
Build a RESTful API with the Serverless Frameworkmasahitojp
 
Lazy Load '22 - Performance Mistakes - An HTTP Archive Deep Dive
Lazy Load  '22 - Performance Mistakes - An HTTP Archive Deep DiveLazy Load  '22 - Performance Mistakes - An HTTP Archive Deep Dive
Lazy Load '22 - Performance Mistakes - An HTTP Archive Deep DivePaul Calvano
 
Last Month in PHP - April 2016
Last Month in PHP - April 2016Last Month in PHP - April 2016
Last Month in PHP - April 2016Eric Poe
 
Oh Crap, My Code is Slow - Madison PHP 2016
Oh Crap, My Code is Slow - Madison PHP 2016Oh Crap, My Code is Slow - Madison PHP 2016
Oh Crap, My Code is Slow - Madison PHP 2016Chris Tankersley
 
Symfony e grandi numeri: si può fare!
Symfony e grandi numeri: si può fare!Symfony e grandi numeri: si può fare!
Symfony e grandi numeri: si può fare!Daniel Londero
 
Making My Own CPAN
Making My Own CPANMaking My Own CPAN
Making My Own CPANbrian d foy
 
High Performance WordPress - WordCamp Jerusalem 2010
High Performance WordPress - WordCamp Jerusalem 2010High Performance WordPress - WordCamp Jerusalem 2010
High Performance WordPress - WordCamp Jerusalem 2010Barry Abrahamson
 
LAMPApache is the most commonly used web server on the Internet..docx
LAMPApache is the most commonly used web server on the Internet..docxLAMPApache is the most commonly used web server on the Internet..docx
LAMPApache is the most commonly used web server on the Internet..docxjesseniasaddler
 
Guidelines for the pcap final
Guidelines for the pcap finalGuidelines for the pcap final
Guidelines for the pcap finalkhajur
 
Guidelines for the pcap final
Guidelines for the pcap finalGuidelines for the pcap final
Guidelines for the pcap finalkhajur
 
Coding Web Performance
Coding Web PerformanceCoding Web Performance
Coding Web PerformanceKoji Ishimoto
 
Searching CPAN Offline
Searching CPAN OfflineSearching CPAN Offline
Searching CPAN Offlineacme
 
Contributing To Rails By Plugin Gem
Contributing To Rails By Plugin GemContributing To Rails By Plugin Gem
Contributing To Rails By Plugin GemDaniel Lv
 

Ähnlich wie LAMP Optimization (20)

Profiling PHP & Javascript
Profiling PHP & JavascriptProfiling PHP & Javascript
Profiling PHP & Javascript
 
Lint - PHP & Javascript Code Checking
Lint - PHP & Javascript Code CheckingLint - PHP & Javascript Code Checking
Lint - PHP & Javascript Code Checking
 
Balsamiq Mockups
Balsamiq MockupsBalsamiq Mockups
Balsamiq Mockups
 
RDF and SPARQL for PHP Developers (at New York Semantic Web Meetup)
RDF and SPARQL for PHP Developers (at New York Semantic Web Meetup)RDF and SPARQL for PHP Developers (at New York Semantic Web Meetup)
RDF and SPARQL for PHP Developers (at New York Semantic Web Meetup)
 
NY WebPerf Sept '22 - Performance Mistakes - An HTTP Archive Deep Dive
NY WebPerf Sept '22 - Performance Mistakes - An HTTP Archive Deep DiveNY WebPerf Sept '22 - Performance Mistakes - An HTTP Archive Deep Dive
NY WebPerf Sept '22 - Performance Mistakes - An HTTP Archive Deep Dive
 
Ruby application based on http
Ruby application based on httpRuby application based on http
Ruby application based on http
 
Spotify: Playing for millions, tuning for more
Spotify: Playing for millions, tuning for moreSpotify: Playing for millions, tuning for more
Spotify: Playing for millions, tuning for more
 
Build a RESTful API with the Serverless Framework
Build a RESTful API with the Serverless FrameworkBuild a RESTful API with the Serverless Framework
Build a RESTful API with the Serverless Framework
 
Lazy Load '22 - Performance Mistakes - An HTTP Archive Deep Dive
Lazy Load  '22 - Performance Mistakes - An HTTP Archive Deep DiveLazy Load  '22 - Performance Mistakes - An HTTP Archive Deep Dive
Lazy Load '22 - Performance Mistakes - An HTTP Archive Deep Dive
 
Last Month in PHP - April 2016
Last Month in PHP - April 2016Last Month in PHP - April 2016
Last Month in PHP - April 2016
 
Oh Crap, My Code is Slow - Madison PHP 2016
Oh Crap, My Code is Slow - Madison PHP 2016Oh Crap, My Code is Slow - Madison PHP 2016
Oh Crap, My Code is Slow - Madison PHP 2016
 
Symfony e grandi numeri: si può fare!
Symfony e grandi numeri: si può fare!Symfony e grandi numeri: si può fare!
Symfony e grandi numeri: si può fare!
 
Making My Own CPAN
Making My Own CPANMaking My Own CPAN
Making My Own CPAN
 
High Performance WordPress - WordCamp Jerusalem 2010
High Performance WordPress - WordCamp Jerusalem 2010High Performance WordPress - WordCamp Jerusalem 2010
High Performance WordPress - WordCamp Jerusalem 2010
 
LAMPApache is the most commonly used web server on the Internet..docx
LAMPApache is the most commonly used web server on the Internet..docxLAMPApache is the most commonly used web server on the Internet..docx
LAMPApache is the most commonly used web server on the Internet..docx
 
Guidelines for the pcap final
Guidelines for the pcap finalGuidelines for the pcap final
Guidelines for the pcap final
 
Guidelines for the pcap final
Guidelines for the pcap finalGuidelines for the pcap final
Guidelines for the pcap final
 
Coding Web Performance
Coding Web PerformanceCoding Web Performance
Coding Web Performance
 
Searching CPAN Offline
Searching CPAN OfflineSearching CPAN Offline
Searching CPAN Offline
 
Contributing To Rails By Plugin Gem
Contributing To Rails By Plugin GemContributing To Rails By Plugin Gem
Contributing To Rails By Plugin Gem
 

Mehr von Dave Ross

Stylesheets of the future with Sass and Compass
Stylesheets of the future with Sass and CompassStylesheets of the future with Sass and Compass
Stylesheets of the future with Sass and CompassDave Ross
 
HTML5 History & Features
HTML5 History & FeaturesHTML5 History & Features
HTML5 History & FeaturesDave Ross
 
A geek's guide to getting hired
A geek's guide to getting hiredA geek's guide to getting hired
A geek's guide to getting hiredDave Ross
 
Date and Time programming in PHP & Javascript
Date and Time programming in PHP & JavascriptDate and Time programming in PHP & Javascript
Date and Time programming in PHP & JavascriptDave Ross
 
Simulated Eye Tracking with Attention Wizard
Simulated Eye Tracking with Attention WizardSimulated Eye Tracking with Attention Wizard
Simulated Eye Tracking with Attention WizardDave Ross
 
What's new in HTML5?
What's new in HTML5?What's new in HTML5?
What's new in HTML5?Dave Ross
 
The Canvas Tag
The Canvas TagThe Canvas Tag
The Canvas TagDave Ross
 
The FPDF Library
The FPDF LibraryThe FPDF Library
The FPDF LibraryDave Ross
 
SQL Injection in PHP
SQL Injection in PHPSQL Injection in PHP
SQL Injection in PHPDave Ross
 
Web App Security: XSS and CSRF
Web App Security: XSS and CSRFWeb App Security: XSS and CSRF
Web App Security: XSS and CSRFDave Ross
 
The Mobile Web: A developer's perspective
The Mobile Web: A developer's perspectiveThe Mobile Web: A developer's perspective
The Mobile Web: A developer's perspectiveDave Ross
 
Google Maps API
Google Maps APIGoogle Maps API
Google Maps APIDave Ross
 
Everything You Need to Know in Order to Start Using jQuery
Everything You Need to Know in Order to Start Using jQueryEverything You Need to Know in Order to Start Using jQuery
Everything You Need to Know in Order to Start Using jQueryDave Ross
 
PHPUnit Automated Unit Testing Framework
PHPUnit Automated Unit Testing FrameworkPHPUnit Automated Unit Testing Framework
PHPUnit Automated Unit Testing FrameworkDave Ross
 
Apache mod_rewrite
Apache mod_rewriteApache mod_rewrite
Apache mod_rewriteDave Ross
 
Caching Data For Performance
Caching Data For PerformanceCaching Data For Performance
Caching Data For PerformanceDave Ross
 
Intro to Php Security
Intro to Php SecurityIntro to Php Security
Intro to Php SecurityDave Ross
 

Mehr von Dave Ross (20)

Stylesheets of the future with Sass and Compass
Stylesheets of the future with Sass and CompassStylesheets of the future with Sass and Compass
Stylesheets of the future with Sass and Compass
 
HTML5 History & Features
HTML5 History & FeaturesHTML5 History & Features
HTML5 History & Features
 
A geek's guide to getting hired
A geek's guide to getting hiredA geek's guide to getting hired
A geek's guide to getting hired
 
Date and Time programming in PHP & Javascript
Date and Time programming in PHP & JavascriptDate and Time programming in PHP & Javascript
Date and Time programming in PHP & Javascript
 
Simulated Eye Tracking with Attention Wizard
Simulated Eye Tracking with Attention WizardSimulated Eye Tracking with Attention Wizard
Simulated Eye Tracking with Attention Wizard
 
What's new in HTML5?
What's new in HTML5?What's new in HTML5?
What's new in HTML5?
 
The Canvas Tag
The Canvas TagThe Canvas Tag
The Canvas Tag
 
Wordpress
WordpressWordpress
Wordpress
 
The FPDF Library
The FPDF LibraryThe FPDF Library
The FPDF Library
 
FirePHP
FirePHPFirePHP
FirePHP
 
SQL Injection in PHP
SQL Injection in PHPSQL Injection in PHP
SQL Injection in PHP
 
Web App Security: XSS and CSRF
Web App Security: XSS and CSRFWeb App Security: XSS and CSRF
Web App Security: XSS and CSRF
 
The Mobile Web: A developer's perspective
The Mobile Web: A developer's perspectiveThe Mobile Web: A developer's perspective
The Mobile Web: A developer's perspective
 
Google Maps API
Google Maps APIGoogle Maps API
Google Maps API
 
Everything You Need to Know in Order to Start Using jQuery
Everything You Need to Know in Order to Start Using jQueryEverything You Need to Know in Order to Start Using jQuery
Everything You Need to Know in Order to Start Using jQuery
 
Subversion
SubversionSubversion
Subversion
 
PHPUnit Automated Unit Testing Framework
PHPUnit Automated Unit Testing FrameworkPHPUnit Automated Unit Testing Framework
PHPUnit Automated Unit Testing Framework
 
Apache mod_rewrite
Apache mod_rewriteApache mod_rewrite
Apache mod_rewrite
 
Caching Data For Performance
Caching Data For PerformanceCaching Data For Performance
Caching Data For Performance
 
Intro to Php Security
Intro to Php SecurityIntro to Php Security
Intro to Php Security
 

Kürzlich hochgeladen

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 DiscoveryTrustArc
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
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 Takeoffsammart93
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
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
 
🐬 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
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
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...DianaGray10
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 

Kürzlich hochgeladen (20)

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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 

LAMP Optimization

  • 1. LAMP Optimization LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 2. 50 Slides! (counting this one) http://slideshare.net/csixty4 LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 3. I’m not a sysadmin LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 4. I’m not a sysadmin but I know what I like. LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 5. I Like Fast Servers LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 6. LAMP Linux Apache MySQL PHP LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 7. Optimizing Linux Prevent swapping Disable atime updates Buy another machine LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 8. vmstat -S M Virtual memory statistics in Megabytes (or Kilobytes) LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 9. “Free” drop + High “Swap” = Poor performance LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 10. RAM is cheap. LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 11. “Access Timestamp” LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 12. “I agree, we really should do something about atime.” - Linus Torvalds, 2007 LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 13. Edit /etc/fstab In the fourth column, add noatime,nodiratime Save. Reboot. LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 14. Time is money. LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 15. Add another server Move database to its own server Load balance Cluster LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 16. Optimizing Apache mod_cache Keep the riff-raff out Increase MaxClients LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 17. a2enmod cache mem_cache LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 18. Cache static content in RAM LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 19. Cache static content in RAM It’s cheap. LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 20. mod_evasive LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 21. Keep out vulnerability scanners and attacks LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 22. More resources for everyone else. LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 23. MaxClients in your httpd.conf LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 24. Trial and error LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 25. Enough to handle simultaneous connections. LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 26. And RAM is still cheap. LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 27.
  • 28. Optimizing MySQL Key Buffer Query Cache InnoDB LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 29. Key Buffer in my.cnf LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 30. Caches table indexes LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 31. key_buffer_size=128M 20-25% (or so) of available RAM LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 32. Query Buffer in my.cnf LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 33. Caches parsed SELECTs LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 34. query_buffer_size=64M Half of key_buffer_size LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 35. You get the idea.
  • 36. InnoDB database engine LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 37. Row vs. table locking LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 38. Faster UPDATE LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 39. Optimized for key access LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 40. Faster SELECT & UPDATE LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 41. Optimizing PHP Upgrade to PHP 5.3 Install an accelerator Enable output buffering LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 42. PHP 5.3 has mysqlnd LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 43. Native Driver LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 44. Up to 30% faster LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 45. PHP Accelerators Alternative PHP Cache (APC) : 3x-5x faster eAccelerator XCache Zend Optimizer+ LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 46. Output Buffering LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 47. Actually makes code run slightly slower LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 48. Browser gets whole page at once LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 49. It certainly feels faster LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
  • 50. Questions? davidmichaelross.com daveross.tel LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009