SlideShare ist ein Scribd-Unternehmen logo
1 von 35
ExpressionEngine Performance &
Optimization:
Laying a Solid Foundation (& Caching)
CHR IS WE L L S – CE O – NE XCE SS .NE T L LC
The Ambassador Bridge (USA/Canada)
• Completed in 1929 (Longest suspension bridge worldwide)
• Busiest international trade crossing in North America!
• Carries 25% of all US/Canadian merchandise trade

• Drive south to go north?
• Owned by a private citizen !?
The Ambassador Bridge (USA/Canada)

The DetroitWindsor tunnel
Detroit, MI USA
is cool too!

Windsor, Ontario
Canada
Today’s Topics
• Why is the foundation important?
• MySQL choices

• PHP & the Apache/PHP hand-off
• Caching overview
• ExpressionEngine internal caching

• ExpressionEngine (modified) template caching
• Caching with CE cache
• Caching the caches with Varnish

• Clustering ExpressionEngine
Perspective
• Nexcess is a 13 year old company
• 90 employees (customer service being the largest contingent)
• Staff of 48 in support/customer service (all U.S./Michigan based)

• Wholly owned data centers in the U.S.
• Partner data centers in the U.K. and Australia
• For better or worse we are not designers
• Hosting company / infrastructure view of the system
• We often are developers but again with a view that differs from web
application developers
Why Care About The Foundation?
• Security, Stability, Performance
• Proper security/stability/performance permeates to the bare metal

• Do what you can with the access you have, ask questions about what is out of reach
• Assume nothing
The Foundation
• Linux
• Reboot-less updates (including on the kernel level)

• Apache (of Nginx)
• MySQL (Percona Server)
• PHP
• ExpressionEngine
MySQL (For Very High Traffic Sites)
• Don’t use MySQL!
• Use Percona Server!

• Percona Server is a simple MySQL replacement
• Percona is much better under stress
• Percona has a very good implementation of InnoDB tables (called XtraDB)

• Use InnoDB!
• Row (instead of table) level locking
• Tune InnoDB for your CPU / RAM configuration – it matters!
• A sample my.cnf is on our github account: https://github.com/nexcess/ee-whitepaperv1-configs

• MariaDB is an alternative as well although we haven’t benchmarked it (yet)
PHP Basics
• Use APC (as an opcode cache only)
• apc.shm_size
• apc.num_files_hint
• apc_stat

= 256M (at least)
= 10000 (at least)
= 0 (for production)

• Bump PHP’s memory_limit (128M works well)
• Turn off open_basedir
• Leaving it on kills the realpath cache
• Security concerns can be handled with tighter file system security

• Use a recent version of PHP (5.4.x+)
• 5.4.x is fast!
• 5.4.x has a much lower memory footprint than prior versions

• Invoke PHP in the right way
The PHP Hand-off
• This handoff is critical for both security and performance
• Apache + mod_php
• Runs as webserver user
• Unified mega-process

• Apache + suPHP / phpSuEXEC
• Runs as you
• Expensive to create

• Apache + PHP-FPM
• Runs as you

• Cheap to use
• Scales more efficiently than all of the above
The PHP Hand-off – Apache+mod_php
The PHP Hand-off – Apache+suExec[PHP]
The PHP Hand-off – Apache+PHP-FPM
File System Permissions Matter

YES! Do This!!
File System Permissions Matter

666 and 777 settings are both evil!
Fixing File System Permissions
Fix it!! (relative to your web root)
1. Own your files / directories

chmod

find -exec chown eecms.eecms {} ;

2. Make browsing directories for others non-trivial.
find -type d -exec chmod 711 {} ;

3. Make sure the webserver can read it all

711

On What?

Means

Directories You can do anything, others
can ‘list’

644

Files

You can read/write, others
can read

600

Files

You can read/write, others
have no access

find -type f -exec chmod 644 {} ;

4. PHP scripts are for your eyes only
find -type f -name “*.php” -exec chmod 600 {} ;

NOTE – config.php and database.php are 600! This is good!
NOTE2 – This only works in a PHP-FPM or suPHP world!
NOTE3 –You may need root level assistance to achieve this
The Need For Caching
• Any DB (or file) based CMS introduces complexity
• More complexity means slower page loads

• A single sub-optimal query can kill a site’s performance
• This all sounds pretty dire 
• More queries does not necessarily mean slower page loads!
• Developers need strike a balance between speed, complexity and
maintainability
• Caching can fix it!!
ExpressionEngine Built-in Caching
• Tag Caching
• Caches tag results (to disk)

• Good for pinpointing bad tags/queries and caching them on the spot
• BUT… The 1st instance of the tag will still be slower

• Template Caching
• Caches entire templates (to disk)

• Dynamic Channel Query Caching
• Caches parts of the channel entries (to disk)
• MySQL’s query cache can help here too

• Query Disabling
• More a pruning measure than caching but still effective
Benchmarking Caching Strategies
• “Agile Records” default install
• 100,000 additional news entries (thanks EllisLab!)
• This is an atypically sized ExpressionEngine site (i.e. BIG)
• We’re trying to push the limits!

• Dell R410 (What equates to our EEP-400 offering)
• Dual E5620 quad core CPUs
• 16GB RAM
• 4 x 147GB 15k SAS drives (RAID 10)

• Software Snapshot
• ExpressionEngine 2.7.0
• CentOS 6.4 (64-bit)
• PHP 5.3.24 (5.4 would have been faster)
• Percona Server 5.5
Cache
“warming” in
progress

Transactions /
sec go from 7 to
~80!
A warm cache
makes a big
difference 
Avg. response
time goes from
~8 to ~0!

Concurrency = 30
900 Random URLs
200
concurrent
users @ ~260 physical
Server’s
trans/sec
resources
exhausted 
Nexcess’ Memcache Patch
• Replaces the on-disk portions of ExpressionEngine’s default caching
with memcache
• No code (customer) code changes needed

• Memcache is an in-memory data store
• Key/value based
• Very fast compared to disk

• Avoids file-system IO limitations
• File locking
• Read/write performance

• Created as a stop-gap on higher traffic sites
• Open source – BUT BE CAREFUL!
~8 transactions /
sec faster

Concurrency = 30
900 Random URLs
Much better high
traffic performance!
Causing Effect’s Cache Plug-in
• Created by Aaron Waldon of Causing Effect
• Very flexible cache addition to ExpressionEngine
• Memory or file-based back-end, with failover
• Leverage fast memory caching
• Fall back to file based caching if any daemon fails

• Full static page capability
• Good for OMG events

• Benchmarks are done using the full page static caching
• Given EE’s flexible nature this was the easiest/best test
CE Cache’s static
caching hits ~100. EE’s template
caching was ~80
trans/sec

Our patch raised
this to ~88

Concurrency = 30
900 Random URLs
Aaron’s hits a
pretty
consistent 500
trans/sec

Our patch
peaked @ ~360
trans/sec
Caching the Caches With Varnish
• Varnish is a caching HTTP reverse proxy (i.e. web application
accelerator)

• Varnish caches entire rendered pages in memory
• Once a page is in Varnish it bypasses:
• The webserver (Apache)
• The web application (PHP/MySQL)
• And everything else lower in the stack!

• Application level caching still matters!
• Cache misses hit the application

• Using Varnish with even brief (1 minute or less) timeouts can still help

• SO JUST TURN IT ON FOR MY SITE ALREADY!!
Varnish is ~550 

All previous were
~80 – 100
trans/sec

Concurrency = 30
900 Random URLs
Varnish @ ~1000 trans/sec
CE Cache Static Files
The Nexcess patch
EE template caching
Pushing ExpressionEngine Further
• Pitfalls to avoid
• File synchronization
• File-based caching causes flock() contention

• Clustering
•
•
•
•

Load balanced over many web application servers
Unified in-memory caching with dedicated caching server
Varnish front-end servers
DB clustering

• THE FOG…
• Hybrid cloud solution
• Provides on-demand expansion where it counts
• Offload PHP-FPM to the Fog
Final Thoughts
• Detroit is not so bad. Lots of inbound Canadian and outbound U.S.
merchandise passes through it at least!
• Don’t build your house on a rock pillar in the ocean
• 666 & 777 are evil
• PHP-FPM is the way to go
• Use Percona Server over MySQL and InnoDB on high traffic sites
• Caching is good – decide which works for you
• Choose the fastest cache mechanism that makes sense
• In memory caches are almost always the best option

• Varnish is good but requires TLC

• The sky is the limit when it comes to ExpressionEngine performance!
More Information
• Our github repository is at:

https://github.com/nexcess
• Our new performance whitepaper is available at:
http://www.nexcess.net/eecms-best-practices-whitepaper
Thank You!
Questions?
Chris Wells – clwells@nexcess.net

Weitere ähnliche Inhalte

Was ist angesagt?

SM16 - Can i move my stuff to openstack
SM16 - Can i move my stuff to openstackSM16 - Can i move my stuff to openstack
SM16 - Can i move my stuff to openstackpittmantony
 
MySQL Performance Tuning - GNUnify 2010
MySQL Performance Tuning - GNUnify 2010MySQL Performance Tuning - GNUnify 2010
MySQL Performance Tuning - GNUnify 2010OSSCube
 
High performance WordPress
High performance WordPressHigh performance WordPress
High performance WordPressMikel King
 
Cool MariaDB Plugins
Cool MariaDB Plugins Cool MariaDB Plugins
Cool MariaDB Plugins Colin Charles
 
OSDC 2016 - Tuning Linux for your Database by Colin Charles
OSDC 2016 - Tuning Linux for your Database by Colin CharlesOSDC 2016 - Tuning Linux for your Database by Colin Charles
OSDC 2016 - Tuning Linux for your Database by Colin CharlesNETWAYS
 
IT PRO|DEV CONNECTIONS 2013 - The X-Files of SQL Server
IT PRO|DEV CONNECTIONS 2013 - The X-Files of SQL Server IT PRO|DEV CONNECTIONS 2013 - The X-Files of SQL Server
IT PRO|DEV CONNECTIONS 2013 - The X-Files of SQL Server Antonios Chatzipavlis
 
Deploying ssd in the data center 2014
Deploying ssd in the data center 2014Deploying ssd in the data center 2014
Deploying ssd in the data center 2014Howard Marks
 
Alfresco scalability and performnce
Alfresco   scalability and performnceAlfresco   scalability and performnce
Alfresco scalability and performncePaul Hampton
 
Lamp Introduction 20100419
Lamp Introduction 20100419Lamp Introduction 20100419
Lamp Introduction 20100419Vu Hung Nguyen
 
Performance tuning with zend framework
Performance tuning with zend frameworkPerformance tuning with zend framework
Performance tuning with zend frameworkAlan Seiden
 
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
 
EasyEngine - Command-Line tool to manage WordPress Sites on Nginx
EasyEngine - Command-Line tool to manage WordPress Sites on NginxEasyEngine - Command-Line tool to manage WordPress Sites on Nginx
EasyEngine - Command-Line tool to manage WordPress Sites on NginxrtCamp
 
HBase: Extreme makeover
HBase: Extreme makeoverHBase: Extreme makeover
HBase: Extreme makeoverbigbase
 
Speeding Up The Snail
Speeding Up The SnailSpeeding Up The Snail
Speeding Up The SnailMarcus Deglos
 
505 kobal exadata
505 kobal exadata505 kobal exadata
505 kobal exadataKam Chan
 
Tuning Linux for your database FLOSSUK 2016
Tuning Linux for your database FLOSSUK 2016Tuning Linux for your database FLOSSUK 2016
Tuning Linux for your database FLOSSUK 2016Colin Charles
 
WiredTiger Overview
WiredTiger OverviewWiredTiger Overview
WiredTiger OverviewWiredTiger
 
AEM WITH MONGODB
AEM WITH MONGODBAEM WITH MONGODB
AEM WITH MONGODBNate Nelson
 
High Performance WordPress - WordCamp Jerusalem 2010
High Performance WordPress - WordCamp Jerusalem 2010High Performance WordPress - WordCamp Jerusalem 2010
High Performance WordPress - WordCamp Jerusalem 2010Barry Abrahamson
 

Was ist angesagt? (20)

SM16 - Can i move my stuff to openstack
SM16 - Can i move my stuff to openstackSM16 - Can i move my stuff to openstack
SM16 - Can i move my stuff to openstack
 
MySQL Performance Tuning - GNUnify 2010
MySQL Performance Tuning - GNUnify 2010MySQL Performance Tuning - GNUnify 2010
MySQL Performance Tuning - GNUnify 2010
 
High performance WordPress
High performance WordPressHigh performance WordPress
High performance WordPress
 
Cool MariaDB Plugins
Cool MariaDB Plugins Cool MariaDB Plugins
Cool MariaDB Plugins
 
OSDC 2016 - Tuning Linux for your Database by Colin Charles
OSDC 2016 - Tuning Linux for your Database by Colin CharlesOSDC 2016 - Tuning Linux for your Database by Colin Charles
OSDC 2016 - Tuning Linux for your Database by Colin Charles
 
IT PRO|DEV CONNECTIONS 2013 - The X-Files of SQL Server
IT PRO|DEV CONNECTIONS 2013 - The X-Files of SQL Server IT PRO|DEV CONNECTIONS 2013 - The X-Files of SQL Server
IT PRO|DEV CONNECTIONS 2013 - The X-Files of SQL Server
 
Deploying ssd in the data center 2014
Deploying ssd in the data center 2014Deploying ssd in the data center 2014
Deploying ssd in the data center 2014
 
mogpres
mogpresmogpres
mogpres
 
Alfresco scalability and performnce
Alfresco   scalability and performnceAlfresco   scalability and performnce
Alfresco scalability and performnce
 
Lamp Introduction 20100419
Lamp Introduction 20100419Lamp Introduction 20100419
Lamp Introduction 20100419
 
Performance tuning with zend framework
Performance tuning with zend frameworkPerformance tuning with zend framework
Performance tuning with zend framework
 
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)
 
EasyEngine - Command-Line tool to manage WordPress Sites on Nginx
EasyEngine - Command-Line tool to manage WordPress Sites on NginxEasyEngine - Command-Line tool to manage WordPress Sites on Nginx
EasyEngine - Command-Line tool to manage WordPress Sites on Nginx
 
HBase: Extreme makeover
HBase: Extreme makeoverHBase: Extreme makeover
HBase: Extreme makeover
 
Speeding Up The Snail
Speeding Up The SnailSpeeding Up The Snail
Speeding Up The Snail
 
505 kobal exadata
505 kobal exadata505 kobal exadata
505 kobal exadata
 
Tuning Linux for your database FLOSSUK 2016
Tuning Linux for your database FLOSSUK 2016Tuning Linux for your database FLOSSUK 2016
Tuning Linux for your database FLOSSUK 2016
 
WiredTiger Overview
WiredTiger OverviewWiredTiger Overview
WiredTiger Overview
 
AEM WITH MONGODB
AEM WITH MONGODBAEM WITH MONGODB
AEM WITH MONGODB
 
High Performance WordPress - WordCamp Jerusalem 2010
High Performance WordPress - WordCamp Jerusalem 2010High Performance WordPress - WordCamp Jerusalem 2010
High Performance WordPress - WordCamp Jerusalem 2010
 

Andere mochten auch

How to start developing your own ExpressionEngine addons
How to start developing your own ExpressionEngine addonsHow to start developing your own ExpressionEngine addons
How to start developing your own ExpressionEngine addonsLeevi Graham
 
412 Arrangeren Is De Core Business Van Elke Docent Wim De Boer, Leo Bakker ...
412 Arrangeren Is De Core Business Van Elke Docent   Wim De Boer, Leo Bakker ...412 Arrangeren Is De Core Business Van Elke Docent   Wim De Boer, Leo Bakker ...
412 Arrangeren Is De Core Business Van Elke Docent Wim De Boer, Leo Bakker ...SURFfoundation
 

Andere mochten auch (6)

How to start developing your own ExpressionEngine addons
How to start developing your own ExpressionEngine addonsHow to start developing your own ExpressionEngine addons
How to start developing your own ExpressionEngine addons
 
Project management
Project managementProject management
Project management
 
Branding Turístico
Branding TurísticoBranding Turístico
Branding Turístico
 
Old Dog, New Tricks
Old Dog, New TricksOld Dog, New Tricks
Old Dog, New Tricks
 
Marketing Turístico
Marketing TurísticoMarketing Turístico
Marketing Turístico
 
412 Arrangeren Is De Core Business Van Elke Docent Wim De Boer, Leo Bakker ...
412 Arrangeren Is De Core Business Van Elke Docent   Wim De Boer, Leo Bakker ...412 Arrangeren Is De Core Business Van Elke Docent   Wim De Boer, Leo Bakker ...
412 Arrangeren Is De Core Business Van Elke Docent Wim De Boer, Leo Bakker ...
 

Ähnlich wie EECI 2013 - ExpressionEngine Performance & Optimization - Laying a Solid Foundation

Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…Atwix
 
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)Nexcess.net LLC
 
Disaggregated Container Attached Storage - Yet Another Topology with What Pur...
Disaggregated Container Attached Storage - Yet Another Topology with What Pur...Disaggregated Container Attached Storage - Yet Another Topology with What Pur...
Disaggregated Container Attached Storage - Yet Another Topology with What Pur...DoKC
 
Disaggregated Container Attached Storage - Yet Another Topology with What Pur...
Disaggregated Container Attached Storage - Yet Another Topology with What Pur...Disaggregated Container Attached Storage - Yet Another Topology with What Pur...
Disaggregated Container Attached Storage - Yet Another Topology with What Pur...DoKC
 
NAVER Ceph Storage on ssd for Container
NAVER Ceph Storage on ssd for ContainerNAVER Ceph Storage on ssd for Container
NAVER Ceph Storage on ssd for ContainerJangseon Ryu
 
MySQL Performance Tuning London Meetup June 2017
MySQL Performance Tuning London Meetup June 2017MySQL Performance Tuning London Meetup June 2017
MySQL Performance Tuning London Meetup June 2017Ivan Zoratti
 
Still All on One Server: Perforce at Scale
Still All on One Server: Perforce at Scale Still All on One Server: Perforce at Scale
Still All on One Server: Perforce at Scale Perforce
 
2015 deploying flash in the data center
2015 deploying flash in the data center2015 deploying flash in the data center
2015 deploying flash in the data centerHoward Marks
 
2015 deploying flash in the data center
2015 deploying flash in the data center2015 deploying flash in the data center
2015 deploying flash in the data centerHoward Marks
 
Nexcess Magento Imagine 2014 Performance Breakout
Nexcess Magento Imagine 2014 Performance BreakoutNexcess Magento Imagine 2014 Performance Breakout
Nexcess Magento Imagine 2014 Performance BreakoutNexcess.net LLC
 
DrupalCampLA 2014 - Drupal backend performance and scalability
DrupalCampLA 2014 - Drupal backend performance and scalabilityDrupalCampLA 2014 - Drupal backend performance and scalability
DrupalCampLA 2014 - Drupal backend performance and scalabilitycherryhillco
 
Optimizing Latency-sensitive queries for Presto at Facebook: A Collaboration ...
Optimizing Latency-sensitive queries for Presto at Facebook: A Collaboration ...Optimizing Latency-sensitive queries for Presto at Facebook: A Collaboration ...
Optimizing Latency-sensitive queries for Presto at Facebook: A Collaboration ...Alluxio, Inc.
 
Ceph Community Talk on High-Performance Solid Sate Ceph
Ceph Community Talk on High-Performance Solid Sate Ceph Ceph Community Talk on High-Performance Solid Sate Ceph
Ceph Community Talk on High-Performance Solid Sate Ceph Ceph Community
 
Designing enterprise drupal
Designing enterprise drupalDesigning enterprise drupal
Designing enterprise drupalJason Burnett
 
Pure Speed Drupal 4 Gov talk
Pure Speed Drupal 4 Gov talkPure Speed Drupal 4 Gov talk
Pure Speed Drupal 4 Gov talkBryan Ollendyke
 
Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i  Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i Zend by Rogue Wave Software
 

Ähnlich wie EECI 2013 - ExpressionEngine Performance & Optimization - Laying a Solid Foundation (20)

Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
 
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
 
Drupal performance
Drupal performanceDrupal performance
Drupal performance
 
Disaggregated Container Attached Storage - Yet Another Topology with What Pur...
Disaggregated Container Attached Storage - Yet Another Topology with What Pur...Disaggregated Container Attached Storage - Yet Another Topology with What Pur...
Disaggregated Container Attached Storage - Yet Another Topology with What Pur...
 
Disaggregated Container Attached Storage - Yet Another Topology with What Pur...
Disaggregated Container Attached Storage - Yet Another Topology with What Pur...Disaggregated Container Attached Storage - Yet Another Topology with What Pur...
Disaggregated Container Attached Storage - Yet Another Topology with What Pur...
 
NAVER Ceph Storage on ssd for Container
NAVER Ceph Storage on ssd for ContainerNAVER Ceph Storage on ssd for Container
NAVER Ceph Storage on ssd for Container
 
MySQL Performance Tuning London Meetup June 2017
MySQL Performance Tuning London Meetup June 2017MySQL Performance Tuning London Meetup June 2017
MySQL Performance Tuning London Meetup June 2017
 
Top ten-list
Top ten-listTop ten-list
Top ten-list
 
Running MySQL on Linux
Running MySQL on LinuxRunning MySQL on Linux
Running MySQL on Linux
 
Still All on One Server: Perforce at Scale
Still All on One Server: Perforce at Scale Still All on One Server: Perforce at Scale
Still All on One Server: Perforce at Scale
 
2015 deploying flash in the data center
2015 deploying flash in the data center2015 deploying flash in the data center
2015 deploying flash in the data center
 
2015 deploying flash in the data center
2015 deploying flash in the data center2015 deploying flash in the data center
2015 deploying flash in the data center
 
Performance stack
Performance stackPerformance stack
Performance stack
 
Nexcess Magento Imagine 2014 Performance Breakout
Nexcess Magento Imagine 2014 Performance BreakoutNexcess Magento Imagine 2014 Performance Breakout
Nexcess Magento Imagine 2014 Performance Breakout
 
DrupalCampLA 2014 - Drupal backend performance and scalability
DrupalCampLA 2014 - Drupal backend performance and scalabilityDrupalCampLA 2014 - Drupal backend performance and scalability
DrupalCampLA 2014 - Drupal backend performance and scalability
 
Optimizing Latency-sensitive queries for Presto at Facebook: A Collaboration ...
Optimizing Latency-sensitive queries for Presto at Facebook: A Collaboration ...Optimizing Latency-sensitive queries for Presto at Facebook: A Collaboration ...
Optimizing Latency-sensitive queries for Presto at Facebook: A Collaboration ...
 
Ceph Community Talk on High-Performance Solid Sate Ceph
Ceph Community Talk on High-Performance Solid Sate Ceph Ceph Community Talk on High-Performance Solid Sate Ceph
Ceph Community Talk on High-Performance Solid Sate Ceph
 
Designing enterprise drupal
Designing enterprise drupalDesigning enterprise drupal
Designing enterprise drupal
 
Pure Speed Drupal 4 Gov talk
Pure Speed Drupal 4 Gov talkPure Speed Drupal 4 Gov talk
Pure Speed Drupal 4 Gov talk
 
Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i  Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i
 

Mehr von Nexcess.net LLC

Nexcess - Peers Reseller
Nexcess - Peers Reseller Nexcess - Peers Reseller
Nexcess - Peers Reseller Nexcess.net LLC
 
Magento Imagine 2015 - Aspirin For Your MySQL Headaches
Magento Imagine 2015 - Aspirin For Your MySQL HeadachesMagento Imagine 2015 - Aspirin For Your MySQL Headaches
Magento Imagine 2015 - Aspirin For Your MySQL HeadachesNexcess.net LLC
 
Chris Wells Magento Imagine 2015 Breakout - Leveraging the Cloud for Ecommerce
Chris Wells Magento Imagine 2015 Breakout - Leveraging the Cloud for EcommerceChris Wells Magento Imagine 2015 Breakout - Leveraging the Cloud for Ecommerce
Chris Wells Magento Imagine 2015 Breakout - Leveraging the Cloud for EcommerceNexcess.net LLC
 
MagentoLive Australia 2014 - The Importance of Performance & Security and Sim...
MagentoLive Australia 2014 - The Importance of Performance & Security and Sim...MagentoLive Australia 2014 - The Importance of Performance & Security and Sim...
MagentoLive Australia 2014 - The Importance of Performance & Security and Sim...Nexcess.net LLC
 
Magento Live UK Nexcess Performance & Security Session
Magento Live UK Nexcess Performance & Security SessionMagento Live UK Nexcess Performance & Security Session
Magento Live UK Nexcess Performance & Security SessionNexcess.net LLC
 
The Importance of Site Performance and Simple Steps to Achieve It
The Importance of Site Performance and Simple Steps to Achieve ItThe Importance of Site Performance and Simple Steps to Achieve It
The Importance of Site Performance and Simple Steps to Achieve ItNexcess.net LLC
 

Mehr von Nexcess.net LLC (6)

Nexcess - Peers Reseller
Nexcess - Peers Reseller Nexcess - Peers Reseller
Nexcess - Peers Reseller
 
Magento Imagine 2015 - Aspirin For Your MySQL Headaches
Magento Imagine 2015 - Aspirin For Your MySQL HeadachesMagento Imagine 2015 - Aspirin For Your MySQL Headaches
Magento Imagine 2015 - Aspirin For Your MySQL Headaches
 
Chris Wells Magento Imagine 2015 Breakout - Leveraging the Cloud for Ecommerce
Chris Wells Magento Imagine 2015 Breakout - Leveraging the Cloud for EcommerceChris Wells Magento Imagine 2015 Breakout - Leveraging the Cloud for Ecommerce
Chris Wells Magento Imagine 2015 Breakout - Leveraging the Cloud for Ecommerce
 
MagentoLive Australia 2014 - The Importance of Performance & Security and Sim...
MagentoLive Australia 2014 - The Importance of Performance & Security and Sim...MagentoLive Australia 2014 - The Importance of Performance & Security and Sim...
MagentoLive Australia 2014 - The Importance of Performance & Security and Sim...
 
Magento Live UK Nexcess Performance & Security Session
Magento Live UK Nexcess Performance & Security SessionMagento Live UK Nexcess Performance & Security Session
Magento Live UK Nexcess Performance & Security Session
 
The Importance of Site Performance and Simple Steps to Achieve It
The Importance of Site Performance and Simple Steps to Achieve ItThe Importance of Site Performance and Simple Steps to Achieve It
The Importance of Site Performance and Simple Steps to Achieve It
 

Kürzlich hochgeladen

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
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 SavingEdi Saputra
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
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
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
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
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 

Kürzlich hochgeladen (20)

Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
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...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
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
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 

EECI 2013 - ExpressionEngine Performance & Optimization - Laying a Solid Foundation

  • 1. ExpressionEngine Performance & Optimization: Laying a Solid Foundation (& Caching) CHR IS WE L L S – CE O – NE XCE SS .NE T L LC
  • 2. The Ambassador Bridge (USA/Canada) • Completed in 1929 (Longest suspension bridge worldwide) • Busiest international trade crossing in North America! • Carries 25% of all US/Canadian merchandise trade • Drive south to go north? • Owned by a private citizen !?
  • 3. The Ambassador Bridge (USA/Canada) The DetroitWindsor tunnel Detroit, MI USA is cool too! Windsor, Ontario Canada
  • 4. Today’s Topics • Why is the foundation important? • MySQL choices • PHP & the Apache/PHP hand-off • Caching overview • ExpressionEngine internal caching • ExpressionEngine (modified) template caching • Caching with CE cache • Caching the caches with Varnish • Clustering ExpressionEngine
  • 5. Perspective • Nexcess is a 13 year old company • 90 employees (customer service being the largest contingent) • Staff of 48 in support/customer service (all U.S./Michigan based) • Wholly owned data centers in the U.S. • Partner data centers in the U.K. and Australia • For better or worse we are not designers • Hosting company / infrastructure view of the system • We often are developers but again with a view that differs from web application developers
  • 6. Why Care About The Foundation? • Security, Stability, Performance • Proper security/stability/performance permeates to the bare metal • Do what you can with the access you have, ask questions about what is out of reach • Assume nothing
  • 7. The Foundation • Linux • Reboot-less updates (including on the kernel level) • Apache (of Nginx) • MySQL (Percona Server) • PHP • ExpressionEngine
  • 8. MySQL (For Very High Traffic Sites) • Don’t use MySQL! • Use Percona Server! • Percona Server is a simple MySQL replacement • Percona is much better under stress • Percona has a very good implementation of InnoDB tables (called XtraDB) • Use InnoDB! • Row (instead of table) level locking • Tune InnoDB for your CPU / RAM configuration – it matters! • A sample my.cnf is on our github account: https://github.com/nexcess/ee-whitepaperv1-configs • MariaDB is an alternative as well although we haven’t benchmarked it (yet)
  • 9. PHP Basics • Use APC (as an opcode cache only) • apc.shm_size • apc.num_files_hint • apc_stat = 256M (at least) = 10000 (at least) = 0 (for production) • Bump PHP’s memory_limit (128M works well) • Turn off open_basedir • Leaving it on kills the realpath cache • Security concerns can be handled with tighter file system security • Use a recent version of PHP (5.4.x+) • 5.4.x is fast! • 5.4.x has a much lower memory footprint than prior versions • Invoke PHP in the right way
  • 10. The PHP Hand-off • This handoff is critical for both security and performance • Apache + mod_php • Runs as webserver user • Unified mega-process • Apache + suPHP / phpSuEXEC • Runs as you • Expensive to create • Apache + PHP-FPM • Runs as you • Cheap to use • Scales more efficiently than all of the above
  • 11. The PHP Hand-off – Apache+mod_php
  • 12. The PHP Hand-off – Apache+suExec[PHP]
  • 13. The PHP Hand-off – Apache+PHP-FPM
  • 14. File System Permissions Matter YES! Do This!!
  • 15. File System Permissions Matter 666 and 777 settings are both evil!
  • 16. Fixing File System Permissions Fix it!! (relative to your web root) 1. Own your files / directories chmod find -exec chown eecms.eecms {} ; 2. Make browsing directories for others non-trivial. find -type d -exec chmod 711 {} ; 3. Make sure the webserver can read it all 711 On What? Means Directories You can do anything, others can ‘list’ 644 Files You can read/write, others can read 600 Files You can read/write, others have no access find -type f -exec chmod 644 {} ; 4. PHP scripts are for your eyes only find -type f -name “*.php” -exec chmod 600 {} ; NOTE – config.php and database.php are 600! This is good! NOTE2 – This only works in a PHP-FPM or suPHP world! NOTE3 –You may need root level assistance to achieve this
  • 17. The Need For Caching • Any DB (or file) based CMS introduces complexity • More complexity means slower page loads • A single sub-optimal query can kill a site’s performance • This all sounds pretty dire  • More queries does not necessarily mean slower page loads! • Developers need strike a balance between speed, complexity and maintainability • Caching can fix it!!
  • 18. ExpressionEngine Built-in Caching • Tag Caching • Caches tag results (to disk) • Good for pinpointing bad tags/queries and caching them on the spot • BUT… The 1st instance of the tag will still be slower • Template Caching • Caches entire templates (to disk) • Dynamic Channel Query Caching • Caches parts of the channel entries (to disk) • MySQL’s query cache can help here too • Query Disabling • More a pruning measure than caching but still effective
  • 19. Benchmarking Caching Strategies • “Agile Records” default install • 100,000 additional news entries (thanks EllisLab!) • This is an atypically sized ExpressionEngine site (i.e. BIG) • We’re trying to push the limits! • Dell R410 (What equates to our EEP-400 offering) • Dual E5620 quad core CPUs • 16GB RAM • 4 x 147GB 15k SAS drives (RAID 10) • Software Snapshot • ExpressionEngine 2.7.0 • CentOS 6.4 (64-bit) • PHP 5.3.24 (5.4 would have been faster) • Percona Server 5.5
  • 20. Cache “warming” in progress Transactions / sec go from 7 to ~80! A warm cache makes a big difference  Avg. response time goes from ~8 to ~0! Concurrency = 30 900 Random URLs
  • 21. 200 concurrent users @ ~260 physical Server’s trans/sec resources exhausted 
  • 22. Nexcess’ Memcache Patch • Replaces the on-disk portions of ExpressionEngine’s default caching with memcache • No code (customer) code changes needed • Memcache is an in-memory data store • Key/value based • Very fast compared to disk • Avoids file-system IO limitations • File locking • Read/write performance • Created as a stop-gap on higher traffic sites • Open source – BUT BE CAREFUL!
  • 23. ~8 transactions / sec faster Concurrency = 30 900 Random URLs
  • 24. Much better high traffic performance!
  • 25. Causing Effect’s Cache Plug-in • Created by Aaron Waldon of Causing Effect • Very flexible cache addition to ExpressionEngine • Memory or file-based back-end, with failover • Leverage fast memory caching • Fall back to file based caching if any daemon fails • Full static page capability • Good for OMG events • Benchmarks are done using the full page static caching • Given EE’s flexible nature this was the easiest/best test
  • 26. CE Cache’s static caching hits ~100. EE’s template caching was ~80 trans/sec Our patch raised this to ~88 Concurrency = 30 900 Random URLs
  • 27. Aaron’s hits a pretty consistent 500 trans/sec Our patch peaked @ ~360 trans/sec
  • 28. Caching the Caches With Varnish • Varnish is a caching HTTP reverse proxy (i.e. web application accelerator) • Varnish caches entire rendered pages in memory • Once a page is in Varnish it bypasses: • The webserver (Apache) • The web application (PHP/MySQL) • And everything else lower in the stack! • Application level caching still matters! • Cache misses hit the application • Using Varnish with even brief (1 minute or less) timeouts can still help • SO JUST TURN IT ON FOR MY SITE ALREADY!!
  • 29.
  • 30. Varnish is ~550  All previous were ~80 – 100 trans/sec Concurrency = 30 900 Random URLs
  • 31. Varnish @ ~1000 trans/sec CE Cache Static Files The Nexcess patch EE template caching
  • 32. Pushing ExpressionEngine Further • Pitfalls to avoid • File synchronization • File-based caching causes flock() contention • Clustering • • • • Load balanced over many web application servers Unified in-memory caching with dedicated caching server Varnish front-end servers DB clustering • THE FOG… • Hybrid cloud solution • Provides on-demand expansion where it counts • Offload PHP-FPM to the Fog
  • 33. Final Thoughts • Detroit is not so bad. Lots of inbound Canadian and outbound U.S. merchandise passes through it at least! • Don’t build your house on a rock pillar in the ocean • 666 & 777 are evil • PHP-FPM is the way to go • Use Percona Server over MySQL and InnoDB on high traffic sites • Caching is good – decide which works for you • Choose the fastest cache mechanism that makes sense • In memory caches are almost always the best option • Varnish is good but requires TLC • The sky is the limit when it comes to ExpressionEngine performance!
  • 34. More Information • Our github repository is at: https://github.com/nexcess • Our new performance whitepaper is available at: http://www.nexcess.net/eecms-best-practices-whitepaper
  • 35. Thank You! Questions? Chris Wells – clwells@nexcess.net