SlideShare a Scribd company logo
High
Performance
WordPress
with your host: Mikel King
Caching, Clustering & Tuning
http://j.konex.us/mk-twttr http://j.konex.us/mk-plus http://linkd.in/in-mk
Scaling WordPress
High Performance WordPress by @MikelKing http://jafdip.com
● PHP Apps like WordPress don’t scale =
LIES!
Scaling WordPress
High Performance WordPress by @MikelKing http://jafdip.com
● PHP Apps like WordPress don’t scale = LIES!
● PHP is not JAVA so Big IRON = FAIL
Scaling WordPress
High Performance WordPress by @MikelKing http://jafdip.com
● PHP Apps like WordPress don’t scale = LIES!
● PHP is not JAVA so Big IRON = FAIL
● Caching + DB Clustering + Apache Tuning
= Success!
Scaling WordPress
High Performance WordPress by @MikelKing http://jafdip.com
User level --
Files System --
Memory Resident --
Browser
Caching Plugins
Memcache
Realms of Caching
High Performance WordPress by @MikelKing http://jafdip.com
● Is easy to turn on and easier to fail.
● Requires access to Apache conf
&& ! .htaccess
● Requires proper WordPress CSS & JS
registration and enqueuing
Browser Caching
High Performance WordPress by @MikelKing http://jafdip.com
Apache Conf Example
# 480 weeks
<FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=290304000, public"
</FilesMatch>
# 2 DAYS
<FilesMatch ".(xml|txt)$">
Header set Cache-Control "max-age=172800, public, must-revalidate"
</FilesMatch>
# 2 HOURS
<FilesMatch ".(html|htm)$">
Header set Cache-Control "max-age=7200, must-revalidate"
</FilesMatch>
High Performance WordPress by @MikelKing http://jafdip.com
wp_register_script(
'top-menu',
$this->js_template_url . 'top_menu.js',
null,
self::VERSION,
self::IN_HEADER
);
wp_enqueue_script('top-menu');
Asset Registration
High Performance WordPress by @MikelKing http://jafdip.com
● Easy to setup
● Good for shared hosting
● NOT load balancer friendly
● Plugins are written in PHP
● Does NOT reliably cache DB Objects
● Relies on file system access
File System Caching
High Performance WordPress by @MikelKing http://jafdip.com
The Caching Game
High Performance WordPress by @MikelKing http://jafdip.com
W1 Server
High Performance WordPress by @MikelKing http://jafdip.com
W3 Server
High Performance WordPress by @MikelKing http://jafdip.com
W2 Server
High Performance WordPress by @MikelKing http://jafdip.com
M1 Server
High Performance WordPress by @MikelKing http://jafdip.com
M3 Server
High Performance WordPress by @MikelKing http://jafdip.com
M3 Server
High Performance WordPress by @MikelKing http://jafdip.com
M2 Server
High Performance WordPress by @MikelKing http://jafdip.com
W4 Server
High Performance WordPress by @MikelKing http://jafdip.com
Example of DB runaway
High Performance WordPress by @MikelKing http://jafdip.com
● Stores PHP code as compiled objects
● Capable of caching DB queries as objects
● May be clustered
● Is load balancer friendly
Memory Based Caching
High Performance WordPress by @MikelKing http://jafdip.com
Example of a memcache cluster
define('WP_CACHE', true);
$memcached_servers = array(
'default' => array(
'172.16.1.244:11211',
'172.16.1.229:11211',
'172.16.1.195:11211',
'172.16.1.227:11211',
'172.16.1.218:11211’,
'172.16.1.205:11211’
)
);
High Performance WordPress by @MikelKing http://jafdip.com
Example of a memcache cluster
memcache-top v0.6 (default port: 11211, color: on, refresh: 3 seconds)
INSTANCE USAGE HIT % CONN TIME EVICT/s READ/s WRITE/s
172.16.1.244:11211 0.9% 94.5% 146 3.5ms 0.0 30.2K 308.0K
172.16.1.229:11211 33.1% 98.2% 148 1.9ms 0.0 33.1K 253.3K
172.16.1.195:11211 39.0% 97.2% 148 2.2ms 0.0 22.4K 217.8K
172.16.1.227:11211 32.2% 98.7% 148 2.1ms 0.0 128.5K 975.1K
172.16.1.218:11211 0.0% 0.0% 10 2.1ms 0.0 2 276
172.16.1.205:11211 36.3% 90.8% 148 2.1ms 0.0 25.2K 223.8K
AVERAGE: 23.6% 79.9% 124 2.3ms 0.0 39.9K 329.7K
TOTAL: 0.7GB/ 3.0GB 748 14.0ms 0.0 239.4K 1.9M
High Performance WordPress by @MikelKing http://jafdip.com
Example of a DB on memcache
High Performance WordPress by @MikelKing http://jafdip.com
Memcache is a separate service to manage
Corruption can spread like a virus
Clearing the cache requires shutting down
the entire cluster
Caveats (It’s NOT all sunshine and rainbows)
High Performance WordPress by @MikelKing http://jafdip.com
● Convert ALL tables to InnoDB
● Convert ALL collation to UTF-8
● Set innodb_buffer_pool_size = 70-80% of
total DB server available RAM
● Set thread_cache_size = 4096
● Increase the mysql ulimits
Clustering with HyperDB
High Performance WordPress by @MikelKing http://jafdip.com
Full text search is supported in the InnoDB
engine as of MySql 5.6, prior to this only the
MyISAM engine had this feature.
InnoDB became the default storage engine
in MySql 5.5 and that prior to this version
you must compile it in as an optional item.
Caveats
High Performance WordPress by @MikelKing http://jafdip.com
Debian/Ubunutu Ulimits
Excerpt: /etc/security/limits.conf
mysql soft nofile 10240
mysql hard nofile 40960
mysql soft nproc 10240
mysql hard nproc 40960
High Performance WordPress by @MikelKing http://jafdip.com
FreeBSD Ulimits
Excerpt: /etc/login.conf
daemon:
:memorylocked=64M:
:memoryuse=unlimited:
:tc=default:
High Performance WordPress by @MikelKing http://jafdip.com
Windows Ulimits
High Performance WordPress by @MikelKing http://jafdip.com
Master
$wpdb->add_database(array(
'host’ => '172.16.1.7:3336',
'user’ => 'db_admin',
'password’ => 'My$c3r3t',
'name’ => 'prod_db',
'write’ => 1,
'read’ => 1,
'dataset’ => 'global',
'timeout’ => 0.2,
'lag_threshold’ => 2,
));
Slave
$wpdb->add_database(array(
'host' => '172.16.1.9:3336’,
'user' => 'db_admin',
'password' => 'My$c3r3t',
'name' => 'prod_db',
'write' => 0,
'read’ => 1,
'dataset’ => 'global',
'timeout’ => 0.2,
'lag_threshold’ => 2,
));
HyperDB Conf (db-config.php)
High Performance WordPress by @MikelKing http://jafdip.com
● Eliminate file reads.
● Reduce the number of server limit
● Increase the allocated RAM
● Install mod_deflate
● Install mod_gzip2
Tuning Apache
High Performance WordPress by @MikelKing http://jafdip.com
House Keeping
Use the PHP native filter_var & filter_input in lieu of regex and built-
in WordPress methods
Drop WP & plugin based Search in favor of a search service
• Solr (requires a separate Java based server)
• Sphinx (is a separate service
• Elastisearch (requires a separate Hadoop server)
• GSS ( a.k.a. Google Site Search)
Enterprise Environments
High Performance WordPress by @MikelKing http://jafdip.com
General House Keeping
● Cleanout the functions.php
● Turn off unnecessary auto loaded items in wp_options
● Optimize your database with a plug-in like WP Optimize
● Leverage the power of a CDN to eliminate your serving
environment’s latency issues.
These items apply sites of any size even if you are
on shared hosting
High Performance WordPress by @MikelKing http://jafdip.com
This has been
High
Performance
WordPress
with your host: Mikel King
Caching, Clustering & Tuning
http://j.konex.us/mk-twttr http://j.konex.us/mk-plus http://linkd.in/in-mk
akhirnya
High Performance WordPress by @MikelKing http://jafdip.com

More Related Content

What's hot

Memcached: What is it and what does it do?
Memcached: What is it and what does it do?Memcached: What is it and what does it do?
Memcached: What is it and what does it do?
Brian Moon
 
Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)
WordCamp Cape Town
 
Memcached Presentation
Memcached PresentationMemcached Presentation
Memcached Presentation
Asif Ali
 
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
Wim Godden
 
Performance all teh things
Performance all teh thingsPerformance all teh things
Performance all teh things
Marcus Deglos
 
Optimizing WordPress for Performance - WordCamp Houston
Optimizing WordPress for Performance - WordCamp HoustonOptimizing WordPress for Performance - WordCamp Houston
Optimizing WordPress for Performance - WordCamp Houston
Chris Olbekson
 
Memcached: What is it and what does it do? (PHP Version)
Memcached: What is it and what does it do? (PHP Version)Memcached: What is it and what does it do? (PHP Version)
Memcached: What is it and what does it do? (PHP Version)
Brian Moon
 
Web agencies: An analysis of the OVH infrastructure to optimise your web proj...
Web agencies: An analysis of the OVH infrastructure to optimise your web proj...Web agencies: An analysis of the OVH infrastructure to optimise your web proj...
Web agencies: An analysis of the OVH infrastructure to optimise your web proj...
OVHcloud
 
Caching
CachingCaching
Caching
Nascenia IT
 
Scaling WordPress On A Small Budget
Scaling WordPress On A Small BudgetScaling WordPress On A Small Budget
Scaling WordPress On A Small Budget
Brecht Ryckaert
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
Wim Godden
 
Performance Tuning - MuraCon 2012
Performance Tuning - MuraCon 2012Performance Tuning - MuraCon 2012
Performance Tuning - MuraCon 2012
eballisty
 
cache concepts and varnish-cache
cache concepts and varnish-cachecache concepts and varnish-cache
cache concepts and varnish-cache
Marc Cortinas Val
 
Caching and tuning fun for high scalability @ PHPTour
Caching and tuning fun for high scalability @ PHPTourCaching and tuning fun for high scalability @ PHPTour
Caching and tuning fun for high scalability @ PHPTour
Wim Godden
 
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
Marcus Deglos
 
Wordpress hosting canada
Wordpress hosting canadaWordpress hosting canada
Wordpress hosting canada
newfasthost
 
WordPress Performance & Scalability
WordPress Performance & ScalabilityWordPress Performance & Scalability
WordPress Performance & Scalability
Joseph Scott
 
Cache hcm-topdev
Cache hcm-topdevCache hcm-topdev
Cache hcm-topdev
Thanh Chau
 
Speeding Up The Snail
Speeding Up The SnailSpeeding Up The Snail
Speeding Up The Snail
Marcus Deglos
 
Running and Scaling Magento on AWS
Running and Scaling Magento on AWSRunning and Scaling Magento on AWS
Running and Scaling Magento on AWS
AOE
 

What's hot (20)

Memcached: What is it and what does it do?
Memcached: What is it and what does it do?Memcached: What is it and what does it do?
Memcached: What is it and what does it do?
 
Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)
 
Memcached Presentation
Memcached PresentationMemcached Presentation
Memcached Presentation
 
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
 
Performance all teh things
Performance all teh thingsPerformance all teh things
Performance all teh things
 
Optimizing WordPress for Performance - WordCamp Houston
Optimizing WordPress for Performance - WordCamp HoustonOptimizing WordPress for Performance - WordCamp Houston
Optimizing WordPress for Performance - WordCamp Houston
 
Memcached: What is it and what does it do? (PHP Version)
Memcached: What is it and what does it do? (PHP Version)Memcached: What is it and what does it do? (PHP Version)
Memcached: What is it and what does it do? (PHP Version)
 
Web agencies: An analysis of the OVH infrastructure to optimise your web proj...
Web agencies: An analysis of the OVH infrastructure to optimise your web proj...Web agencies: An analysis of the OVH infrastructure to optimise your web proj...
Web agencies: An analysis of the OVH infrastructure to optimise your web proj...
 
Caching
CachingCaching
Caching
 
Scaling WordPress On A Small Budget
Scaling WordPress On A Small BudgetScaling WordPress On A Small Budget
Scaling WordPress On A Small Budget
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
 
Performance Tuning - MuraCon 2012
Performance Tuning - MuraCon 2012Performance Tuning - MuraCon 2012
Performance Tuning - MuraCon 2012
 
cache concepts and varnish-cache
cache concepts and varnish-cachecache concepts and varnish-cache
cache concepts and varnish-cache
 
Caching and tuning fun for high scalability @ PHPTour
Caching and tuning fun for high scalability @ PHPTourCaching and tuning fun for high scalability @ PHPTour
Caching and tuning fun for high scalability @ PHPTour
 
Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2Drupal, varnish, esi - Toulouse November 2
Drupal, varnish, esi - Toulouse November 2
 
Wordpress hosting canada
Wordpress hosting canadaWordpress hosting canada
Wordpress hosting canada
 
WordPress Performance & Scalability
WordPress Performance & ScalabilityWordPress Performance & Scalability
WordPress Performance & Scalability
 
Cache hcm-topdev
Cache hcm-topdevCache hcm-topdev
Cache hcm-topdev
 
Speeding Up The Snail
Speeding Up The SnailSpeeding Up The Snail
Speeding Up The Snail
 
Running and Scaling Magento on AWS
Running and Scaling Magento on AWSRunning and Scaling Magento on AWS
Running and Scaling Magento on AWS
 

Similar to High performance WordPress

Dockerizing WordPress
Dockerizing WordPressDockerizing WordPress
Dockerizing WordPress
dotCloud
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
Wim Godden
 
MySQL on Docker - Containerizing the Dolphin
MySQL on Docker - Containerizing the DolphinMySQL on Docker - Containerizing the Dolphin
MySQL on Docker - Containerizing the Dolphin
Severalnines
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
Wim Godden
 
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
Alessandro Arrichiello
 
phptek13 - Caching and tuning fun tutorial
phptek13 - Caching and tuning fun tutorialphptek13 - Caching and tuning fun tutorial
phptek13 - Caching and tuning fun tutorial
Wim Godden
 
Slides: Introducing the new ClusterControl 1.2.9 - with live demo
Slides: Introducing the new ClusterControl 1.2.9 - with live demo Slides: Introducing the new ClusterControl 1.2.9 - with live demo
Slides: Introducing the new ClusterControl 1.2.9 - with live demo
Severalnines
 
Docker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak PeekDocker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak Peek
msyukor
 
Dockerizing WordPress
Dockerizing WordPressDockerizing WordPress
Dockerizing WordPress
Docker, Inc.
 
Wordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccionWordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccion
Sysdig
 
Setting up a local WordPress Environment
Setting up a local WordPress EnvironmentSetting up a local WordPress Environment
Setting up a local WordPress Environment
Chris La Nauze
 
Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016
Ben Hall
 
WordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngineWordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngine
NGINX, Inc.
 
WordPress Need For Speed
WordPress Need For SpeedWordPress Need For Speed
WordPress Need For Speed
pdeschen
 
Developers, Be a Bada$$ with WP-CLI
Developers, Be a Bada$$ with WP-CLIDevelopers, Be a Bada$$ with WP-CLI
Developers, Be a Bada$$ with WP-CLI
WP Engine
 
Architecting cloud
Architecting cloudArchitecting cloud
Architecting cloud
Tahsin Hasan
 
Mysql 8 vs Mariadb 10.4 Highload++ 2019
Mysql 8 vs Mariadb 10.4 Highload++ 2019Mysql 8 vs Mariadb 10.4 Highload++ 2019
Mysql 8 vs Mariadb 10.4 Highload++ 2019
Alkin Tezuysal
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)
Ben Hall
 
Manage WordPress with Awesome using wp cli
Manage WordPress with Awesome using wp cliManage WordPress with Awesome using wp cli
Manage WordPress with Awesome using wp cli
GetSource
 
A WordPress workshop at Cefalo
A WordPress workshop at Cefalo A WordPress workshop at Cefalo
A WordPress workshop at Cefalo
Beroza Paul
 

Similar to High performance WordPress (20)

Dockerizing WordPress
Dockerizing WordPressDockerizing WordPress
Dockerizing WordPress
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
 
MySQL on Docker - Containerizing the Dolphin
MySQL on Docker - Containerizing the DolphinMySQL on Docker - Containerizing the Dolphin
MySQL on Docker - Containerizing the Dolphin
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
 
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
 
phptek13 - Caching and tuning fun tutorial
phptek13 - Caching and tuning fun tutorialphptek13 - Caching and tuning fun tutorial
phptek13 - Caching and tuning fun tutorial
 
Slides: Introducing the new ClusterControl 1.2.9 - with live demo
Slides: Introducing the new ClusterControl 1.2.9 - with live demo Slides: Introducing the new ClusterControl 1.2.9 - with live demo
Slides: Introducing the new ClusterControl 1.2.9 - with live demo
 
Docker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak PeekDocker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak Peek
 
Dockerizing WordPress
Dockerizing WordPressDockerizing WordPress
Dockerizing WordPress
 
Wordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccionWordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccion
 
Setting up a local WordPress Environment
Setting up a local WordPress EnvironmentSetting up a local WordPress Environment
Setting up a local WordPress Environment
 
Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016
 
WordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngineWordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngine
 
WordPress Need For Speed
WordPress Need For SpeedWordPress Need For Speed
WordPress Need For Speed
 
Developers, Be a Bada$$ with WP-CLI
Developers, Be a Bada$$ with WP-CLIDevelopers, Be a Bada$$ with WP-CLI
Developers, Be a Bada$$ with WP-CLI
 
Architecting cloud
Architecting cloudArchitecting cloud
Architecting cloud
 
Mysql 8 vs Mariadb 10.4 Highload++ 2019
Mysql 8 vs Mariadb 10.4 Highload++ 2019Mysql 8 vs Mariadb 10.4 Highload++ 2019
Mysql 8 vs Mariadb 10.4 Highload++ 2019
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)
 
Manage WordPress with Awesome using wp cli
Manage WordPress with Awesome using wp cliManage WordPress with Awesome using wp cli
Manage WordPress with Awesome using wp cli
 
A WordPress workshop at Cefalo
A WordPress workshop at Cefalo A WordPress workshop at Cefalo
A WordPress workshop at Cefalo
 

Recently uploaded

TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Zilliz
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 

Recently uploaded (20)

TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 

High performance WordPress

  • 1. High Performance WordPress with your host: Mikel King Caching, Clustering & Tuning http://j.konex.us/mk-twttr http://j.konex.us/mk-plus http://linkd.in/in-mk
  • 2. Scaling WordPress High Performance WordPress by @MikelKing http://jafdip.com
  • 3. ● PHP Apps like WordPress don’t scale = LIES! Scaling WordPress High Performance WordPress by @MikelKing http://jafdip.com
  • 4. ● PHP Apps like WordPress don’t scale = LIES! ● PHP is not JAVA so Big IRON = FAIL Scaling WordPress High Performance WordPress by @MikelKing http://jafdip.com
  • 5. ● PHP Apps like WordPress don’t scale = LIES! ● PHP is not JAVA so Big IRON = FAIL ● Caching + DB Clustering + Apache Tuning = Success! Scaling WordPress High Performance WordPress by @MikelKing http://jafdip.com
  • 6. User level -- Files System -- Memory Resident -- Browser Caching Plugins Memcache Realms of Caching High Performance WordPress by @MikelKing http://jafdip.com
  • 7. ● Is easy to turn on and easier to fail. ● Requires access to Apache conf && ! .htaccess ● Requires proper WordPress CSS & JS registration and enqueuing Browser Caching High Performance WordPress by @MikelKing http://jafdip.com
  • 8. Apache Conf Example # 480 weeks <FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"> Header set Cache-Control "max-age=290304000, public" </FilesMatch> # 2 DAYS <FilesMatch ".(xml|txt)$"> Header set Cache-Control "max-age=172800, public, must-revalidate" </FilesMatch> # 2 HOURS <FilesMatch ".(html|htm)$"> Header set Cache-Control "max-age=7200, must-revalidate" </FilesMatch> High Performance WordPress by @MikelKing http://jafdip.com
  • 10. ● Easy to setup ● Good for shared hosting ● NOT load balancer friendly ● Plugins are written in PHP ● Does NOT reliably cache DB Objects ● Relies on file system access File System Caching High Performance WordPress by @MikelKing http://jafdip.com
  • 11. The Caching Game High Performance WordPress by @MikelKing http://jafdip.com
  • 12. W1 Server High Performance WordPress by @MikelKing http://jafdip.com
  • 13. W3 Server High Performance WordPress by @MikelKing http://jafdip.com
  • 14. W2 Server High Performance WordPress by @MikelKing http://jafdip.com
  • 15. M1 Server High Performance WordPress by @MikelKing http://jafdip.com
  • 16. M3 Server High Performance WordPress by @MikelKing http://jafdip.com
  • 17. M3 Server High Performance WordPress by @MikelKing http://jafdip.com
  • 18. M2 Server High Performance WordPress by @MikelKing http://jafdip.com
  • 19. W4 Server High Performance WordPress by @MikelKing http://jafdip.com
  • 20. Example of DB runaway High Performance WordPress by @MikelKing http://jafdip.com
  • 21. ● Stores PHP code as compiled objects ● Capable of caching DB queries as objects ● May be clustered ● Is load balancer friendly Memory Based Caching High Performance WordPress by @MikelKing http://jafdip.com
  • 22. Example of a memcache cluster define('WP_CACHE', true); $memcached_servers = array( 'default' => array( '172.16.1.244:11211', '172.16.1.229:11211', '172.16.1.195:11211', '172.16.1.227:11211', '172.16.1.218:11211’, '172.16.1.205:11211’ ) ); High Performance WordPress by @MikelKing http://jafdip.com
  • 23. Example of a memcache cluster memcache-top v0.6 (default port: 11211, color: on, refresh: 3 seconds) INSTANCE USAGE HIT % CONN TIME EVICT/s READ/s WRITE/s 172.16.1.244:11211 0.9% 94.5% 146 3.5ms 0.0 30.2K 308.0K 172.16.1.229:11211 33.1% 98.2% 148 1.9ms 0.0 33.1K 253.3K 172.16.1.195:11211 39.0% 97.2% 148 2.2ms 0.0 22.4K 217.8K 172.16.1.227:11211 32.2% 98.7% 148 2.1ms 0.0 128.5K 975.1K 172.16.1.218:11211 0.0% 0.0% 10 2.1ms 0.0 2 276 172.16.1.205:11211 36.3% 90.8% 148 2.1ms 0.0 25.2K 223.8K AVERAGE: 23.6% 79.9% 124 2.3ms 0.0 39.9K 329.7K TOTAL: 0.7GB/ 3.0GB 748 14.0ms 0.0 239.4K 1.9M High Performance WordPress by @MikelKing http://jafdip.com
  • 24. Example of a DB on memcache High Performance WordPress by @MikelKing http://jafdip.com
  • 25. Memcache is a separate service to manage Corruption can spread like a virus Clearing the cache requires shutting down the entire cluster Caveats (It’s NOT all sunshine and rainbows) High Performance WordPress by @MikelKing http://jafdip.com
  • 26. ● Convert ALL tables to InnoDB ● Convert ALL collation to UTF-8 ● Set innodb_buffer_pool_size = 70-80% of total DB server available RAM ● Set thread_cache_size = 4096 ● Increase the mysql ulimits Clustering with HyperDB High Performance WordPress by @MikelKing http://jafdip.com
  • 27. Full text search is supported in the InnoDB engine as of MySql 5.6, prior to this only the MyISAM engine had this feature. InnoDB became the default storage engine in MySql 5.5 and that prior to this version you must compile it in as an optional item. Caveats High Performance WordPress by @MikelKing http://jafdip.com
  • 28. Debian/Ubunutu Ulimits Excerpt: /etc/security/limits.conf mysql soft nofile 10240 mysql hard nofile 40960 mysql soft nproc 10240 mysql hard nproc 40960 High Performance WordPress by @MikelKing http://jafdip.com
  • 30. Windows Ulimits High Performance WordPress by @MikelKing http://jafdip.com
  • 31. Master $wpdb->add_database(array( 'host’ => '172.16.1.7:3336', 'user’ => 'db_admin', 'password’ => 'My$c3r3t', 'name’ => 'prod_db', 'write’ => 1, 'read’ => 1, 'dataset’ => 'global', 'timeout’ => 0.2, 'lag_threshold’ => 2, )); Slave $wpdb->add_database(array( 'host' => '172.16.1.9:3336’, 'user' => 'db_admin', 'password' => 'My$c3r3t', 'name' => 'prod_db', 'write' => 0, 'read’ => 1, 'dataset’ => 'global', 'timeout’ => 0.2, 'lag_threshold’ => 2, )); HyperDB Conf (db-config.php) High Performance WordPress by @MikelKing http://jafdip.com
  • 32. ● Eliminate file reads. ● Reduce the number of server limit ● Increase the allocated RAM ● Install mod_deflate ● Install mod_gzip2 Tuning Apache High Performance WordPress by @MikelKing http://jafdip.com
  • 33. House Keeping Use the PHP native filter_var & filter_input in lieu of regex and built- in WordPress methods Drop WP & plugin based Search in favor of a search service • Solr (requires a separate Java based server) • Sphinx (is a separate service • Elastisearch (requires a separate Hadoop server) • GSS ( a.k.a. Google Site Search) Enterprise Environments High Performance WordPress by @MikelKing http://jafdip.com
  • 34. General House Keeping ● Cleanout the functions.php ● Turn off unnecessary auto loaded items in wp_options ● Optimize your database with a plug-in like WP Optimize ● Leverage the power of a CDN to eliminate your serving environment’s latency issues. These items apply sites of any size even if you are on shared hosting High Performance WordPress by @MikelKing http://jafdip.com
  • 35. This has been High Performance WordPress with your host: Mikel King Caching, Clustering & Tuning http://j.konex.us/mk-twttr http://j.konex.us/mk-plus http://linkd.in/in-mk
  • 36. akhirnya High Performance WordPress by @MikelKing http://jafdip.com

Editor's Notes

  1. These candies represent page requests.
  2. The load balancer directs the user’s request for a blue page. Fortunately W1 has a copy of the page in it’s cache.
  3. The load balancer directs the user’s request for a green page. Fortunately W3 has a copy of the page in it’s cache.
  4. The load balancer directs the user’s request for a pink page. Unfortunately W2 does not have a copy of the page in it’s cache, therefore; a page must be completely built from scratch by WordPress before fulfilling the request.
  5. The load balancer directs the user’s request for a blue page. Fortunately M1 is able to access a copy of the page in memcache.
  6. The load balancer directs the user’s request for a blue page. Fortunately M3 is able to access a copy of the page in memcache.
  7. The load balancer directs the user’s request for a blue page. Fortunately M3 is able to access a copy of the page in memcache.
  8. M2 boots up and receives a user request for a pink page. Fortunately M2 is able to access a copy of the page already in memcache.
  9. W4 boots up and receives a user request for a green page. Unfortunately W4 is has no cache and must start from scratch.
  10. ----- Meeting Notes (8/4/14 23:18) ----- In this view of our New Relic graphs you see what happens when queries start bottlenecking in the DB system. Once the problem start only HUPing the web services to clear the condition.
  11. If you do not have control of your hosting environment you may not be able to upgrade to the current MySql server. If you do not require full text search in InnoDB then it WILL not be a problem.
  12. Using the internal WordPress search will slow down your systems. These search system index your site and serve the results from that outside index and do not impact the load on your WordPress systems. The native PHP filter_var and filter_input mthods are only supported in PHP versions 5.2 and later so you may need to upgrade in order to use it. The main benefit is that these methods are written in C and are an order of magnitude faster than anything you could write in PHP to do the same job. Do not use them in code you intend to publish back to the WordPress community like plugins and themes because you can not guarantee another user’s PHP environment.