stop eating resources and optimize wordpress
DESCRIPTION
In this talk from WordCamp Raleigh 2014, Jeff Matson discusses how to better optimize your WordPress site for server performance and quick loading times for your visitors.TRANSCRIPT
STOP EATING RESOURCESSTOP EATING RESOURCESAND OPTIMIZE YOURAND OPTIMIZE YOUR
WORDPRESS SITEWORDPRESS SITEJEFF MATSON | INMOTION HOSTINGJEFF MATSON | INMOTION HOSTING
@TheJeffMatson | jeffmatson.net
@InMotionHosting | inmotionhosting.com
WHY DO I NEED TO OPTIMIZE IT?WHY DO I NEED TO OPTIMIZE IT?
BECAUSE YOUR HOST HATES SLOW,BECAUSE YOUR HOST HATES SLOW,RESOURCE INTENSIVE SITES.RESOURCE INTENSIVE SITES.
Seriously, somewhere a sysadmin is crying over a bloated siteright now.
Hopefully, it's not yours.
IMAGINE A WORLD...IMAGINE A WORLD...
...WITHOUT ANY BLOATED...WITHOUT ANY BLOATEDSITESSITES
No load spikes
Happier hosts
Faster support calls
More features
HAPPY SERVERHAPPY SERVER
HAPPY HOSTHAPPY HOST
HAPPY CUSTOMERHAPPY CUSTOMER
YOUR VISITORS ARE IMPATIENTYOUR VISITORS ARE IMPATIENTUsers don't want to waste their time with your slow site.
STOP PAYING FOR RESOURCES YOU DON'TSTOP PAYING FOR RESOURCES YOU DON'TNEEDNEED
Bigger sites require bigger hardware.
Bigger hardware costs more money.
Lower operating costs means more money in your pocket.
OK, OK, I GET IT...OK, OK, I GET IT...
...BUT HOW DO I FIX IT?...BUT HOW DO I FIX IT?
REMOVE UNNECESSARY GARBAGEREMOVE UNNECESSARY GARBAGE
If nobody cares about your slider or other junk, kill it.
GIVE YOUR IMAGES THE SHRINK RAY!GIVE YOUR IMAGES THE SHRINK RAY!Compress your images as much as you possibly can
Use the exact size image you are displaying
Use progressive JPEGs
Minify your CSS and JS
Combine your stylesheets
Combine your JS
CACHE EVERYTHINGCACHE EVERYTHING
VARNISH EXISTS FOR A REASONVARNISH EXISTS FOR A REASON
USE IT!USE IT!It's impact on server load is absolutely insane.
(I'll prove it to you later)
ON SHARED HOSTING?ON SHARED HOSTING?
CACHE IT TO THE DISK!CACHE IT TO THE DISK!W3 Total Cache does an excellent job of doing exactly that.
DOES THE AVERAGE VISITOR SEE ANYTHINGDOES THE AVERAGE VISITOR SEE ANYTHINGTWICE?TWICE?
LET THEM KEEP IT!LET THEM KEEP IT!Every browser out there will cache content if you tell it to.
STOP REQUESTS THAT DON'T MATTERSTOP REQUESTS THAT DON'T MATTER
Block any bots that aren't useful to you
CDNS ARE A WONDERFUL THINGCDNS ARE A WONDERFUL THINGLet servers that are designed for serving static content do thework for you.
Your users will get the static content faster while weight islifted from the server.
MONITOR YOUR QUERIESMONITOR YOUR QUERIESUnderstand exactly what is going on with your site at all times.
REAL-WORLD EXAMPLEREAL-WORLD EXAMPLETIME!TIME!
TESTING ENVIRONMENTTESTING ENVIRONMENTTwenty Fourteen theme
Default JetPack install
5 posts with large featured images
5 paragraphs of text per post
BASELINE STATSBASELINE STATS
Server load increases almost immediately
>5s page load time at ~17 active clients
1.4 minute load time at 50 active clients
BASIC DISK CACHING ENABLEDBASIC DISK CACHING ENABLED
>5s page load time at ~20 active clients
1.3 minute load time at 50 active clients
DISK CACHING AND IMAGE OPTIMIZATIONDISK CACHING AND IMAGE OPTIMIZATION
Page load times rise slightly lower than with just caching alone
1.2 minute load time at 50 active clients
LET'S ADD MAXCDN TO THE MIXLET'S ADD MAXCDN TO THE MIX
>5s page load time at ~30 active clients
28.78 second load time at 50 active clients
BASIC DISK CACHING ON AN SSDBASIC DISK CACHING ON AN SSD
Page load times stayed between 1.5 and 2 seconds
Never increased above 2 seconds with 50 active visitors
VARNISH CACHING AND MAXCDNVARNISH CACHING AND MAXCDN
Page load time was always under 1 second
Usually under 25ms
First errors came at 322 pages per second
WHY DID VARNISH WORK SO WELL?WHY DID VARNISH WORK SO WELL?Processing PHP takes resources so caching that data makesthe server more efficient.
Data is being served directly from RAM.
As a result, the server load never spiked up until we startedserving enromous amounts of information.
WHAT HAVE WE LEARNED?WHAT HAVE WE LEARNED?Varnish is your friend.
If you can't use varnish, use a host with SSDs, cache with W3Total Cache, and use a CDN.
Every extra bit of processing will hurt your site.
QUESTIONS?QUESTIONS?JEFF MATSON | INMOTION HOSTINGJEFF MATSON | INMOTION HOSTING
@TheJeffMatson | jeffmatson.net
@InMotionHosting | inmotionhosting.com