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

"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 

Kürzlich hochgeladen (20)

"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 

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