Speed optimization of WordPress

hastywittedmarriedInternet and Web Development

Dec 8, 2013 (3 years and 7 months ago)

108 views



Speed optimization of WordPress
Keeping WordPress swift. What influences the speed.
Keeping the database clean and effective.
Peter Baran
Foliovision
May 7, 2013


WordPress story 2.2 – 3.5

Increase of functionality

Increase in support functions and frameworks


WordPress story 2.2 – 3.5

Size of wp-includes 1.8MB → 6.3MB


WordPress story 2.2 – 3.5

Increase in critical database tables like posts

Huge amount of plugins and themes


Common HTTP request


Web server

Apache HTTP Server

Unusable in default configuration

LiteSpeed

Commercial alternative to Apache HTTP Server

NginX

Event-based web server

Ignores .htaccess


Web server


Web server

42 requests

2 requests for PHP

7 requests for CSS + JS

33 requests for images

40 flat files


PHP and Cache
Different types of cache

Varnish and HTTP Accelerators

Caching on the other side of Web server

HTML Caching for WordPress

WP Super Cache

Hyper Cache

W3 Total Cache

Other

Caching requests

Cache certain parts of site


PHP and Cache
Different types of cache


PHP and Cache
WP Super Cache, Hyper Cache, W3 Total Cache

W3 Total Cache

Many features: Cache, minify, memcached, CDN

Too complex, nowhere near KISS

WP Super Cache

Discontinued

Hyper Cache

KISS and reliable


PHP and Cache
Other

Caching menu, sidebar

CDN

Good idea

Need to pick correct provider

Gravatar Cache

APC and PHP accelerators


WordPress
Plugin optimization

Huge amount of plugins

24,610 plugins in official WP Plugins Repository

Many others that are paid

Quick progress of WordPress

New “features”

WordPress API


WordPress
Plugin optimization

Plugin creation fundamentals

Study WP API

WP_Object_Cache, wp_cache_add, wp_cache_set,
wp_cache_get

KISS

Be careful with interaction with rest of WP

Using WP functions

Be careful in resources usage (DB and HTTP requests)


WordPress
Theme
and WordPress optimization

Frameworks for themes

Plugin interaction

Test to do before launching a theme

Use database profiler (WPDB Profiler)

Check for necessity of CSS and JS files

Test site as both logged and unlogged user

Watch out for ineffective WP functions

Displaying comments

Displaying posts in archive pages

WP MU, files rewrite


WordPress
Theme and WordPress optimization

Lookout for repeating and similar queries


Database
InnoDB vs. MyISAM

InnoDB pros:

Better data integrity, support for transactions

Quicker insert and update of data

InnoDB cons:

Tables don't store rows count

Memory requirements

No full text indexation


Database
InnoDB vs. MyISAM

MyISAM pros:

Simple engine and overall quickness

Has full text indexation

Quicker for select

MyISAM cons:

Bad data integrity, problems with database crash

Row data stored in whole


Database
WordPress DB structure

Posts table

Revisions, custom post types, wp_menu

Comments table

Spam storage


Database
Other optimization

MySQL magical word: EXPLAIN

Checkout for bad indexation


Thank you
Peter Baran
http://foliovision.com