SlideShare una empresa de Scribd logo
1 de 55
Descargar para leer sin conexión
Mastering WordPress
        Vol.1



          2012.08.23 - wokamoto
Introduce Myself
I’m a member of WordPress Plugins/
JSeries, and making WordPress plugins.


   Head Cleaner - Cleaning tags from your
   WordPress header and footer.

   OAuth Provider - A plugin to allow WordPress
   to use an OAuth authenticator.


    http://profiles.wordpress.org/wokamoto
I’ve just released AMI which is
performance tuned for
WordPress .

     http://megumi-cloud.com/
Recntly I’ve written a book.
WordPress speeding up & smart
  operation must-have guide
Outline
About improving performance of a
site using WordPress

  Identifying bottlenecks

  Improvement with plugins

  Improvement on the server side
Identifying bottlenecks
The reasons of slowness


 PHP processing is slow
 MySQL processing is slow
 Problem of Internet line
PHP processing is slow


Plugins or themes are inefficient

WordPress runs futilely

Too many access to process
MySQL processing is slow


  Too many plugins cause too many queries

  Queries are not properly optimized

  MySQL is not properly optimized
Problem of Internet line


 Many big files such as images

 Loads many CSS, JS files

 JS loaded from outside is slow
Debug Bar and
Debug Bar Extendar
http://wordpress.org/extend/plugins/debug-bar/

http://wordpress.org/extend/plugins/debug-bar-
extender/
After installed the plugins, add the
lines below to wp-config.php

 define('SAVEQUERIES', true);
 define('WP_DEBUG', true);
 define('WP_DEBUG_DISPLAY', false);
Identifying bottlenecks
    with Debug Bar
Add check point to the Profile
   tab of Debug Bar to show

<?php
if ( function_exists("dbgx_checkpoint") )
     dbgx_checkpoint( $note="Note" );
?>
Try not to run
WordPress as few as
     possible
Accessing to non-existent
 files makes WordPress run
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
Files that browser crawlers
 check for the presence of

  /favicon.ico
  /apple-touch-icon.png
  /robots.txt
  /crossdomain.xml
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME}
! !.(html?|xml|txt|xsl|js|css|jpe?g|png|gif|ico)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
Avoid duplication of
    JavaScript
<?php wp_enqueue_script('jquery'); ?>
Using only jQuery on its’
   Google AJAX Libraries
<?php
wp_deregister_script('jquery');
wp_enqueue_script(
  'jquery',
  'http:/ /ajax.googleapis.com/ajax/libs/
jquery/1.7.2/jquery.min.js',
  array(),
  '1.7.2');
?>
Setting periods of
validity for static files
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType text/html "access plus 1 seconds"
ExpiresByType image/gif "access plus 30 days"
ExpiresByType image/jpeg "access plus 30 days"
ExpiresByType image/png "access plus 30 days"
ExpiresByType image/x-icon "access plus 30 days"
ExpiresByType text/css "access plus 7 days"
ExpiresByType text/javascript "access plus 7 days"
ExpiresByType application/x-javascript "access plus 7 days"
</IfModule>
Note for setting Expires

wp_enqueue_style(
  'my-theme-style',
  get_template_directory_uri() . '/style.css',
  array(),
  date('YmdHis',
     filemtime(get_template_directory() . '/style.css') )
  );
Sending text files with
   gzip compressed
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE/[1-6] !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png|ico|pdf)$
no-gzip dont-vary
SetEnvIfNoCase Request_URI _.utxt$ no-gzip
DeflateCompressionLevel 4
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-httpd-php
</IfModule>
Try to avoid
using .htaccess
When AllowOverride is enabled to /, then
/wp-includes/js/jquery/jquery.js is accessed, Apache
checkes every files below.


         /.htaccess

         /wp-includes/.htaccess

         /wp-includes/js/.htaccess

         /wp-includes/js/jquery/.htaccess
Optimizing image files
http://wordpress.org/extend/plugins/wp-smushit/
Dividing sources into
   several servers
http://wordpress.org/extend/plugins/wp-flickr-press/
http://wordpress.org/extend/plugins/tantan-s3/
Distributing contents
      using CDN
http://wordpress.org/extend/plugins/wpbooster-cdn-
client/
Optimizing CSS and JS
http://wordpress.org/extend/plugins/head-cleaner/
Disabled
Enabled
Cache outputs of
   WordPress
Object Cache
Common case of speed up WordPress

<?php bloginfo('stylesheet_url') ?>

Writing template tags in theme files causes accessing
MySQL server and makes it slow, so let’s write CSS’s URL
in theme files.

http://example.jp/wp-content/themes/example/style.css

残念ながら、この手法にはあまり効果がありません。
wp_cache_add( $key, $data, $group )

wp_cache_replace( $key, $data, $group )

wp_cache_set( $key, $data, $group )

wp_cache_get( $key, $group )

wp_cache_delete( $key, $group )

wp_cache_flush()
Object cached data are usually discarded
              every time.
Plugins to use persistently
    object cached data.


http://wordpress.org/extend/plugins/wp-file-cache/

http://wordpress.org/extend/plugins/apc/

http://wordpress.org/extend/plugins/memcached/
Caching the result of DB
        queries.
http://wordpress.org/extend/plugins/db-cache-
reloaded-fix/
Cache the whole of
WordPress’s outputs.
http://wordpress.org/extend/plugins/wp-super-cache/
http://wordpress.org/extend/plugins/nginx-champuru/
Tuning up MySQL
$ wget mysqltuner.pl
$ chmod +x mysqltuner.pl
$ ./mysqltuner.pl
Twitter : @wokamoto

Más contenido relacionado

La actualidad más candente

Use Symfony2 components inside WordPress
Use Symfony2 components inside WordPress Use Symfony2 components inside WordPress
Use Symfony2 components inside WordPress
Maurizio Pelizzone
 
Don't sh** in the Pool
Don't sh** in the PoolDon't sh** in the Pool
Don't sh** in the Pool
Chris Jean
 

La actualidad más candente (20)

Use Symfony2 components inside WordPress
Use Symfony2 components inside WordPress Use Symfony2 components inside WordPress
Use Symfony2 components inside WordPress
 
Front End Website Optimization
Front End Website OptimizationFront End Website Optimization
Front End Website Optimization
 
Doing Things the WordPress Way
Doing Things the WordPress WayDoing Things the WordPress Way
Doing Things the WordPress Way
 
Intro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentIntro to WordPress Plugin Development
Intro to WordPress Plugin Development
 
WordPress Security : What We Learnt When We Were Hacked : WordCamp Mumbai 2017
WordPress Security : What We Learnt When We Were Hacked : WordCamp Mumbai 2017WordPress Security : What We Learnt When We Were Hacked : WordCamp Mumbai 2017
WordPress Security : What We Learnt When We Were Hacked : WordCamp Mumbai 2017
 
How to develope plugin in wordpress: 6 simple steps.
How to develope plugin in wordpress: 6 simple steps.How to develope plugin in wordpress: 6 simple steps.
How to develope plugin in wordpress: 6 simple steps.
 
Wordpress development: A Modern Approach
Wordpress development:  A Modern ApproachWordpress development:  A Modern Approach
Wordpress development: A Modern Approach
 
Using HTML5 sensibly
Using HTML5 sensiblyUsing HTML5 sensibly
Using HTML5 sensibly
 
Multimedia on the web - HTML5 video and audio
Multimedia on the web - HTML5 video and audioMultimedia on the web - HTML5 video and audio
Multimedia on the web - HTML5 video and audio
 
I Can Haz More Performanz?
I Can Haz More Performanz?I Can Haz More Performanz?
I Can Haz More Performanz?
 
Getting started with WordPress development
Getting started with WordPress developmentGetting started with WordPress development
Getting started with WordPress development
 
Speed up Your Joomla Site for Ultimate Performance
Speed up Your Joomla Site for Ultimate PerformanceSpeed up Your Joomla Site for Ultimate Performance
Speed up Your Joomla Site for Ultimate Performance
 
Using composer with WordPress
Using composer with WordPressUsing composer with WordPress
Using composer with WordPress
 
Ako na vlastne WP temy
Ako na vlastne WP temyAko na vlastne WP temy
Ako na vlastne WP temy
 
WordCamp SF 2011: Debugging in WordPress
WordCamp SF 2011: Debugging in WordPressWordCamp SF 2011: Debugging in WordPress
WordCamp SF 2011: Debugging in WordPress
 
Building a resposive slider plugin for WordPress theme
Building a resposive slider plugin for WordPress themeBuilding a resposive slider plugin for WordPress theme
Building a resposive slider plugin for WordPress theme
 
Don't sh** in the Pool
Don't sh** in the PoolDon't sh** in the Pool
Don't sh** in the Pool
 
Word press development for non developers
Word press development for non developers Word press development for non developers
Word press development for non developers
 
How to Issue and Activate Free SSL using Let's Encrypt
How to Issue and Activate Free SSL using Let's EncryptHow to Issue and Activate Free SSL using Let's Encrypt
How to Issue and Activate Free SSL using Let's Encrypt
 
Fundamentals of HTML5
Fundamentals of HTML5Fundamentals of HTML5
Fundamentals of HTML5
 

Destacado (6)

Sacss sp5
Sacss sp5Sacss sp5
Sacss sp5
 
Word press on conoha このべん #3
Word press on conoha このべん #3Word press on conoha このべん #3
Word press on conoha このべん #3
 
Nsets vs nnset (1) (1)
Nsets vs nnset (1) (1)Nsets vs nnset (1) (1)
Nsets vs nnset (1) (1)
 
このべん第二回 ~「できない子ほどかわいくしたい!ConoHa補完計画」勉強会
このべん第二回 ~「できない子ほどかわいくしたい!ConoHa補完計画」勉強会このべん第二回 ~「できない子ほどかわいくしたい!ConoHa補完計画」勉強会
このべん第二回 ~「できない子ほどかわいくしたい!ConoHa補完計画」勉強会
 
Ds 2600 280
Ds 2600 280Ds 2600 280
Ds 2600 280
 
High performance web server
High performance web serverHigh performance web server
High performance web server
 

Similar a Mastering WordPress Vol.1

Theming Wordpress for Your Showcases
Theming Wordpress for Your ShowcasesTheming Wordpress for Your Showcases
Theming Wordpress for Your Showcases
Jun Hu
 

Similar a Mastering WordPress Vol.1 (20)

Introduction to Plugin Programming, WordCamp Miami 2011
Introduction to Plugin Programming, WordCamp Miami 2011Introduction to Plugin Programming, WordCamp Miami 2011
Introduction to Plugin Programming, WordCamp Miami 2011
 
WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019
 
A new way to develop with WordPress!
A new way to develop with WordPress!A new way to develop with WordPress!
A new way to develop with WordPress!
 
WPDay Bologna 2013
WPDay Bologna 2013WPDay Bologna 2013
WPDay Bologna 2013
 
Web-Performance
Web-PerformanceWeb-Performance
Web-Performance
 
Creating Your First WordPress Plugin
Creating Your First WordPress PluginCreating Your First WordPress Plugin
Creating Your First WordPress Plugin
 
Optimize wordpress
Optimize wordpressOptimize wordpress
Optimize wordpress
 
WordPress Plugin Development- Rich Media Institute Workshop
WordPress Plugin Development- Rich Media Institute WorkshopWordPress Plugin Development- Rich Media Institute Workshop
WordPress Plugin Development- Rich Media Institute Workshop
 
WordPress Theme Workshop: Misc
WordPress Theme Workshop: MiscWordPress Theme Workshop: Misc
WordPress Theme Workshop: Misc
 
Use Xdebug to profile PHP
Use Xdebug to profile PHPUse Xdebug to profile PHP
Use Xdebug to profile PHP
 
Vagrant WordCamp Hamilton
Vagrant  WordCamp HamiltonVagrant  WordCamp Hamilton
Vagrant WordCamp Hamilton
 
Profiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / WebgrindProfiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / Webgrind
 
Debugging - Figuring it out yourself (WordCamp Dublin 2019)
Debugging - Figuring it out yourself (WordCamp Dublin 2019)Debugging - Figuring it out yourself (WordCamp Dublin 2019)
Debugging - Figuring it out yourself (WordCamp Dublin 2019)
 
Wordless, stop writing WordPress themes like it's 1998
Wordless, stop writing WordPress themes like it's 1998Wordless, stop writing WordPress themes like it's 1998
Wordless, stop writing WordPress themes like it's 1998
 
WordPress 2.5 Overview - Rich Media Institute
WordPress 2.5 Overview - Rich Media InstituteWordPress 2.5 Overview - Rich Media Institute
WordPress 2.5 Overview - Rich Media Institute
 
Optimizing wp
Optimizing wpOptimizing wp
Optimizing wp
 
Magento Performance Optimization 101
Magento Performance Optimization 101Magento Performance Optimization 101
Magento Performance Optimization 101
 
Theming Wordpress for Your Showcases
Theming Wordpress for Your ShowcasesTheming Wordpress for Your Showcases
Theming Wordpress for Your Showcases
 
Advanced WordPress Optimization - iGaming Supershow 2012
Advanced WordPress Optimization - iGaming Supershow 2012Advanced WordPress Optimization - iGaming Supershow 2012
Advanced WordPress Optimization - iGaming Supershow 2012
 
[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development
 

Más de Wataru OKAMOTO (8)

re:Invent 2015 参加報告
re:Invent 2015 参加報告re:Invent 2015 参加報告
re:Invent 2015 参加報告
 
Amimoto auto scaling
Amimoto auto scalingAmimoto auto scaling
Amimoto auto scaling
 
wp cli
wp cliwp cli
wp cli
 
Wckansai 2014
Wckansai 2014Wckansai 2014
Wckansai 2014
 
StaticPress
StaticPressStaticPress
StaticPress
 
WordPress Cloud Design Pattern
WordPress  Cloud Design PatternWordPress  Cloud Design Pattern
WordPress Cloud Design Pattern
 
Nginx + PHP
Nginx + PHPNginx + PHP
Nginx + PHP
 
WordPress を使いこなそう
WordPress を使いこなそうWordPress を使いこなそう
WordPress を使いこなそう
 

Último

Último (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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
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
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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?
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.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...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
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
 

Mastering WordPress Vol.1