SlideShare a Scribd company logo
Performance: Not an Afterthought
DrupalSouth 2015
Nick Santamaria
• Senior Developer at Technocrat
• Acquia Certified Backend Developer
• drupal.org http://drupal.org/user/87915
• twitter @nicksanta
• Github nicksantamaria
Presentation Outline
• Introduction to performance & scalability
• Common problems
• Strategies for success
• Infrastructure design and considerations
• Debugging performance and scalability issues
• QA and discussion
Performance & Scalability
Performance & Scalability
Performance
The speed with which a single request can be executed.
Scalability
The ability of a request to maintain its performance under increasing load.
What is Performance?
Back-end Performance Components
• PHP
• Amount of code being executed (ie, number of modules)
• Efficiency of code
• Database
• Schema design
• Query execution time
What is Performance?
Back-end Performance Components
• API Requests
• PHP will wait until the request returns a result or times out
• Caching
• Drupal database
• Memcached / Redis / MongoDB
• Varnish
What is Performance?
Front-end Performance Components
• Network Overhead
• Local vs offshore datacenters
• Number of requests
• Payload Size
• Image optimisation
• CSS / JS Minification
• Markup size & compression
What is Performance?
Front-end Performance Components
• Javascript
• Number of scripts being included
• Synchronous vs asynchronous execution
• Code efficiency
What is Scalability?
“Why is scalability so hard? Because scalability cannot be an after-thought.”
- Werner Vogels, Amazon CTO
What is Scalability?
A system is said to be scalable if adding resources results
in proportionally increased performance.
9 women can not make a baby in 1 month.
Will doubling your site’s server resources double the traffic it can handle?
What is Scalability?
Scalability Components
• Caching
• Block cache
• Page cache
• Reverse proxy cache
• Opcode caching
• Infrastructure
• Web server load balancing
• Database clustering
• Caching backends - redis, memcached etc..
Common Problems
Common Problems
Too many modules - AKA “Open Buffet Syndrome”
Real life example
• 365 enabled modules
• 24 core modules
• 51 custom modules
• 72 exported features
• 750 files loaded on every request.
• 10 - 20% of PHP execution time was loading files, even with APC.
• CPU cycles wasted - 25,000+ calls to module_implements() per request.
• Pages with product/* paths are NEVER cached.
• Anonymous users who visit this page bypass page cache on all subsequent pages.
• … AND those visitors write to the database on every subsequent page view.
Common Problems
Anonymous users with sessions
Seems innocent, but this one line has consequences.
Common Problems
Complicated entity & field architecture
● Slows down form submission, rendering, views, and more.
Strategies for Success
Complicated entity & field architecture
• How many INSERT queries per save?
• node
• node_revision
• field_collection_item
• field_collection_item_revision
• field_data_field_collection_b
• field_revision_field_collection_b
• field_data_field_taxonomy_ref
• field_revision_field_taxonomy_ref
• field_data_field_collection_c
• field_revision_field_collection_c
• field_data_field_text
• field_revision_field_text
• file_managed
• field_data_field_media
• field_revision_field_media
Real world field collection implementations are
FAR more complicated than this example!
Common Problems
Others
• Never use views_php module - create custom views handlers and plugins.
• Complex faceted search using Drupal database - use Solr.
• dblog module enabled on production - use syslog.
• Carefully consider use of modules with node access functionality - they disable
block caching.
Common Problems
Others
• Never use views_php module - create custom views handlers and plugins.
• Complex faceted search using Drupal database - use Solr.
• dblog module enabled on production - use syslog.
• Carefully consider use of modules with node access functionality - they disable
block caching.
Strategies for Success
On-Demand Cache Purging
• Planning
• Divide the site into page “types”.
• For each type, build a list of events which would require a page
to be cleared from cache.
• Considerations
• No relative dates, ie “time ago”.
• Some page types may be more suited to periodic caching.
• Create a spidering script to warm the caches!
• Extend to other caches using CacheTags - drupal.org/project/cachetags
Strategies for Success
Strategies for Success
Authcache (2.x branch)
• Replaces Drupal’s default page caching allowing you to cache
authenticated pages.
• Huge scalability improvements for sites with a large proportion of
authenticated visitors.
• But also much, much more.
• Personalisation - authcache_p13n
• Form token magic - authcache_form
• Store page cache in Varnish - authcache_varnish
• Integrates with Cache Expiration
Strategies for Success
Authcache
• Planning
• Define which page types are cacheable.
• Design how you will segment your visitors (from a cache
perspective).
• Identify all personalised information which must be displayed.
• Considerations
• Forms can be tricky - ensure you test thoroughly.
• Ensure your analytics / marketing / tracking services are
compatible.
• See Commerce Kickstart for great out-of-the-box implementation.
Strategies for Success
Consuming Feeds & Web Services
• Regularly importing data into Drupal can be resource intensive.
• Feeds, migrate, custom PHP etc… All share the same fundamental
problems:
• Fetching large datasets, which hog i/o, memory, and CPU
cycles.
• Lots of slow INSERT and UPDATE operations on the database.
• New data will not display immediately unless caches cleared.
• The solution? Move to the front end!
Strategies for Success
Consuming Feeds & Web Services
• PaRSS - drupal.org/project/parss
• Integrates simple jQuery RSS parser with link fields.
• AngularJS - angularjs.org
• Very powerful front-end MVC framework.
• Usual implementation may not be suitable for this problem.
• Angular Blocks - drupal.org/node/2445795
• Allows other modules to expose AngularJS apps as blocks!
• Used successfully on recent intranet project, some pages
having 6 angular apps on a single page.
Strategies for Success
Load Testing
• Make it part of your development process.
• Dont leave it to the last minute or post-launch.
• Tools
• Apache jMeter
• github.com/jacobSingh/Drupal-Performance-Testing-Suite
• Blazemeter - blazemeter.com
• Blitz - blitz.io
• Web Page Test - webpagetest.org
Strategies for Success
Queues
• Use queues when dealing with:
• Batch processing large datasets.
• Performing complex calculations.
• Sequential processing of tasks.
• Modules / Tools
• Advanced Queue - drupal.org/project/advancedqueue
• Advanced Queue Runner - github.com/nvahalik/advancedqueue-runner
• Drupal Core Queues - system.queue.inc
Strategies for Success
Queues
• Improves reliability.
• If not using queues
• There is no guarantee the process will be completed.
• If the process fails, there is no easy way to repeat it.
• If using queues
• Each item is executed at least once.
• If the process fails, the queue remains intact.
• System load is stabilised because processing of complex or
heavy operations is delayed.
Strategies for Success
Optimised Front-end
• Image Sprites
• Minimises the number of HTTP requests.
• CSS
• Think about what your sass / less becomes once compiled.
• How complex and specific do the selectors become?
• Consider architecting your CSS for conditional inclusion.
• Does the site have “sections”?
• CSS rendering is a blocking process.
Strategies for Success
Optimised Front-end
• Asynchronous Javascript - drupal.org/project/async_js
• Defers javascript execution.
• Can improve responsiveness of “sluggish” JS-heavy sites.
• Advanced Aggregation - drupal.org/project/advagg
• Use CDN version of jQuery.
• On-demand generation of aggregated assets.
Strategies for Success
Other Recommendations
• Elysia Cron - drupal.org/project/elysia_cron
• Configure scheduling and frequency of specific cron tasks.
• Run heavy cron tasks during low traffic periods.
• Entity Cache - drupal.org/project/entitycache
• Stores complete entity objects in your caching backend.
• Enable appropriate dependent modules such as
commerce_entitycache, bean_entitycache etc..
• Apache Solr for search
• drupal.org/project/search_api_solr
• drupal.org/project/apachesolr
Infrastructure
Infrastructure
Caching Backends
• Memcached - drupal.org/project/memcache
• Battle tested.
• Widely deployed.
• Volatile storage - not suitable for persistent data.
• Redis - drupal.org/project/redis
• Less “mature” than Memcached.
• 1:1 featureset with Memcached.
• Benchmarks slightly better than Memcached.
• Commits data to disk by default, can be used for persistent data
• Use PHP extension - github.com/phpredis/phpredis (not Predis class)
Infrastructure
Caching Backends
• I recommend Redis
• Store sessions in Redis rather than the database
Session Proxy - drupal.org/project/session_proxy
• Form cache can go straight into redis - no more need for this line:
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
Infrastructure
Simplest Approach
• Single server with all components
• PHP
• Web Server (Apache)
• Database (MySQL)
• Varnish (... sometimes)
Varnish
Apache
PHP
MySQL
Instance #1
Infrastructure
Scaling Vertically
• Increase instance size.
• Change instance types:
• CPU optimised
• Memory optimised
• I/O optimised
• Will hit an endpoint eventually.
“We’re going to need a bigger box”
Infrastructure
Splitting the box
Break up stack components onto separate
servers.
Instance #2
Varnish
Apache
PHP
MySQL
Instance #1
Infrastructure
Instance #2
Varnish
Apache
PHP
MySQL
Instance #1
Instance #3
Redis
You will still eventually hit an endpoint!
Infrastructure
Infrastructure
Horizontally Scalable Infrastructure
• Overcomes CPU ceiling issues.
• Considerations
• Load balanced web servers
• Database clustering
• Shared / clustered file
systems
• Autoscaling - the holy grail.
Load Balancer
Varnish
Apache
PHP
MySQLRedis
Apache
PHP
Apache
PHP
Apache
PHP
Debugging Performance and Scalability Issues
Debugging Performance and Scalability Issues
Tools
• New Relic APM, browser & server monitoring
• MySQL slow query log
• Add following lines to my.cnf and restart mysql
• log_slow_queries=/var/log/mysql/slow-query.log
• long_query_time=20
• XHProf - PHP profiler
• Great slides for getting set up here - http://msonnabaum.github.io/xhprof-
presentation/
• Browser Developer Tools
• Javascript profiler
• Network Monitor
Debugging Performance and Scalability Issues
General Tips
• Look beyond the symptoms to find the underlying cause.
• Change one thing at a time.
• Measure, change, measure.
• Sometimes you just have to throw more RAM at the problem.
Thanks!
slideshare.net/TechnocratAu

More Related Content

What's hot

SRV422 Deep Dive on AWS Database Migration Service
SRV422 Deep Dive on AWS Database Migration ServiceSRV422 Deep Dive on AWS Database Migration Service
SRV422 Deep Dive on AWS Database Migration ServiceAmazon Web Services
 
ENT309 scaling up to your first 10 million users
ENT309 scaling up to your first 10 million usersENT309 scaling up to your first 10 million users
ENT309 scaling up to your first 10 million usersAmazon Web Services
 
AWS re:Invent 2016: Turner's cloud native media supply chain for TNT, TBS, Ad...
AWS re:Invent 2016: Turner's cloud native media supply chain for TNT, TBS, Ad...AWS re:Invent 2016: Turner's cloud native media supply chain for TNT, TBS, Ad...
AWS re:Invent 2016: Turner's cloud native media supply chain for TNT, TBS, Ad...Amazon Web Services
 
Running Microsoft Workloads on AWS
Running Microsoft Workloads on AWSRunning Microsoft Workloads on AWS
Running Microsoft Workloads on AWSAmazon Web Services
 
Getting Started with AWS Lambda and the Serverless Cloud by Jim Tran, Princip...
Getting Started with AWS Lambda and the Serverless Cloud by Jim Tran, Princip...Getting Started with AWS Lambda and the Serverless Cloud by Jim Tran, Princip...
Getting Started with AWS Lambda and the Serverless Cloud by Jim Tran, Princip...Amazon Web Services
 
AWS re:Invent 2016: Cloud Monitoring - Understanding, Preparing, and Troubles...
AWS re:Invent 2016: Cloud Monitoring - Understanding, Preparing, and Troubles...AWS re:Invent 2016: Cloud Monitoring - Understanding, Preparing, and Troubles...
AWS re:Invent 2016: Cloud Monitoring - Understanding, Preparing, and Troubles...Amazon Web Services
 
SRV409 Deep Dive on Microservices and Docker
SRV409 Deep Dive on Microservices and DockerSRV409 Deep Dive on Microservices and Docker
SRV409 Deep Dive on Microservices and DockerAmazon Web Services
 
AWS re:Invent 2016: From Dial-Up to DevOps - AOL’s Migration to the Cloud (DE...
AWS re:Invent 2016: From Dial-Up to DevOps - AOL’s Migration to the Cloud (DE...AWS re:Invent 2016: From Dial-Up to DevOps - AOL’s Migration to the Cloud (DE...
AWS re:Invent 2016: From Dial-Up to DevOps - AOL’s Migration to the Cloud (DE...Amazon Web Services
 
Azure vs AWS Best Practices: What You Need to Know
Azure vs AWS Best Practices: What You Need to KnowAzure vs AWS Best Practices: What You Need to Know
Azure vs AWS Best Practices: What You Need to KnowRightScale
 
AWS Sydney Summit 2013 - Keynote
AWS Sydney Summit 2013 - KeynoteAWS Sydney Summit 2013 - Keynote
AWS Sydney Summit 2013 - KeynoteAmazon Web Services
 
AWS re:Invent 2016: Industry Opportunities for AWS Partners: Healthcare, Fina...
AWS re:Invent 2016: Industry Opportunities for AWS Partners: Healthcare, Fina...AWS re:Invent 2016: Industry Opportunities for AWS Partners: Healthcare, Fina...
AWS re:Invent 2016: Industry Opportunities for AWS Partners: Healthcare, Fina...Amazon Web Services
 
AWS re:Invent 2016: Migrating Enterprise Messaging to the Cloud (ENT217)
AWS re:Invent 2016: Migrating Enterprise Messaging to the Cloud (ENT217)AWS re:Invent 2016: Migrating Enterprise Messaging to the Cloud (ENT217)
AWS re:Invent 2016: Migrating Enterprise Messaging to the Cloud (ENT217)Amazon Web Services
 
Moving your Desktops to the Cloud with Amazon WorkSpaces
Moving your Desktops to the Cloud with Amazon WorkSpacesMoving your Desktops to the Cloud with Amazon WorkSpaces
Moving your Desktops to the Cloud with Amazon WorkSpacesAmazon Web Services
 
Hands On Lab: Introduction to Microsoft SQL Server in AWS - May 2017 AWS Onli...
Hands On Lab: Introduction to Microsoft SQL Server in AWS - May 2017 AWS Onli...Hands On Lab: Introduction to Microsoft SQL Server in AWS - May 2017 AWS Onli...
Hands On Lab: Introduction to Microsoft SQL Server in AWS - May 2017 AWS Onli...Amazon Web Services
 
Database Migration: Simple, Cross-Engine and Cross-Platform Migrations with M...
Database Migration: Simple, Cross-Engine and Cross-Platform Migrations with M...Database Migration: Simple, Cross-Engine and Cross-Platform Migrations with M...
Database Migration: Simple, Cross-Engine and Cross-Platform Migrations with M...Amazon Web Services
 
(ARC305) How J&J Manages AWS At Scale For Enterprise Workloads
(ARC305) How J&J Manages AWS At Scale For Enterprise Workloads(ARC305) How J&J Manages AWS At Scale For Enterprise Workloads
(ARC305) How J&J Manages AWS At Scale For Enterprise WorkloadsAmazon Web Services
 
Azure vs AWS
Azure vs AWSAzure vs AWS
Azure vs AWSJosh Lane
 
Scaling on AWS for the First 10 Million Users
Scaling on AWS for the First 10 Million UsersScaling on AWS for the First 10 Million Users
Scaling on AWS for the First 10 Million UsersAmazon Web Services
 
AWS re:Invent 2016: Best practices for running enterprise workloads on AWS (E...
AWS re:Invent 2016: Best practices for running enterprise workloads on AWS (E...AWS re:Invent 2016: Best practices for running enterprise workloads on AWS (E...
AWS re:Invent 2016: Best practices for running enterprise workloads on AWS (E...Amazon Web Services
 

What's hot (20)

SRV422 Deep Dive on AWS Database Migration Service
SRV422 Deep Dive on AWS Database Migration ServiceSRV422 Deep Dive on AWS Database Migration Service
SRV422 Deep Dive on AWS Database Migration Service
 
ENT309 scaling up to your first 10 million users
ENT309 scaling up to your first 10 million usersENT309 scaling up to your first 10 million users
ENT309 scaling up to your first 10 million users
 
AWS re:Invent 2016: Turner's cloud native media supply chain for TNT, TBS, Ad...
AWS re:Invent 2016: Turner's cloud native media supply chain for TNT, TBS, Ad...AWS re:Invent 2016: Turner's cloud native media supply chain for TNT, TBS, Ad...
AWS re:Invent 2016: Turner's cloud native media supply chain for TNT, TBS, Ad...
 
Running Microsoft Workloads on AWS
Running Microsoft Workloads on AWSRunning Microsoft Workloads on AWS
Running Microsoft Workloads on AWS
 
Getting Started with AWS Lambda and the Serverless Cloud by Jim Tran, Princip...
Getting Started with AWS Lambda and the Serverless Cloud by Jim Tran, Princip...Getting Started with AWS Lambda and the Serverless Cloud by Jim Tran, Princip...
Getting Started with AWS Lambda and the Serverless Cloud by Jim Tran, Princip...
 
AWS re:Invent 2016: Cloud Monitoring - Understanding, Preparing, and Troubles...
AWS re:Invent 2016: Cloud Monitoring - Understanding, Preparing, and Troubles...AWS re:Invent 2016: Cloud Monitoring - Understanding, Preparing, and Troubles...
AWS re:Invent 2016: Cloud Monitoring - Understanding, Preparing, and Troubles...
 
SRV409 Deep Dive on Microservices and Docker
SRV409 Deep Dive on Microservices and DockerSRV409 Deep Dive on Microservices and Docker
SRV409 Deep Dive on Microservices and Docker
 
AWS re:Invent 2016: From Dial-Up to DevOps - AOL’s Migration to the Cloud (DE...
AWS re:Invent 2016: From Dial-Up to DevOps - AOL’s Migration to the Cloud (DE...AWS re:Invent 2016: From Dial-Up to DevOps - AOL’s Migration to the Cloud (DE...
AWS re:Invent 2016: From Dial-Up to DevOps - AOL’s Migration to the Cloud (DE...
 
Azure vs AWS Best Practices: What You Need to Know
Azure vs AWS Best Practices: What You Need to KnowAzure vs AWS Best Practices: What You Need to Know
Azure vs AWS Best Practices: What You Need to Know
 
AWS Sydney Summit 2013 - Keynote
AWS Sydney Summit 2013 - KeynoteAWS Sydney Summit 2013 - Keynote
AWS Sydney Summit 2013 - Keynote
 
AWS re:Invent 2016: Industry Opportunities for AWS Partners: Healthcare, Fina...
AWS re:Invent 2016: Industry Opportunities for AWS Partners: Healthcare, Fina...AWS re:Invent 2016: Industry Opportunities for AWS Partners: Healthcare, Fina...
AWS re:Invent 2016: Industry Opportunities for AWS Partners: Healthcare, Fina...
 
AWS re:Invent 2016: Migrating Enterprise Messaging to the Cloud (ENT217)
AWS re:Invent 2016: Migrating Enterprise Messaging to the Cloud (ENT217)AWS re:Invent 2016: Migrating Enterprise Messaging to the Cloud (ENT217)
AWS re:Invent 2016: Migrating Enterprise Messaging to the Cloud (ENT217)
 
Moving your Desktops to the Cloud with Amazon WorkSpaces
Moving your Desktops to the Cloud with Amazon WorkSpacesMoving your Desktops to the Cloud with Amazon WorkSpaces
Moving your Desktops to the Cloud with Amazon WorkSpaces
 
Hands On Lab: Introduction to Microsoft SQL Server in AWS - May 2017 AWS Onli...
Hands On Lab: Introduction to Microsoft SQL Server in AWS - May 2017 AWS Onli...Hands On Lab: Introduction to Microsoft SQL Server in AWS - May 2017 AWS Onli...
Hands On Lab: Introduction to Microsoft SQL Server in AWS - May 2017 AWS Onli...
 
Database Migration: Simple, Cross-Engine and Cross-Platform Migrations with M...
Database Migration: Simple, Cross-Engine and Cross-Platform Migrations with M...Database Migration: Simple, Cross-Engine and Cross-Platform Migrations with M...
Database Migration: Simple, Cross-Engine and Cross-Platform Migrations with M...
 
(ARC305) How J&J Manages AWS At Scale For Enterprise Workloads
(ARC305) How J&J Manages AWS At Scale For Enterprise Workloads(ARC305) How J&J Manages AWS At Scale For Enterprise Workloads
(ARC305) How J&J Manages AWS At Scale For Enterprise Workloads
 
Azure vs AWS
Azure vs AWSAzure vs AWS
Azure vs AWS
 
Scaling on AWS for the First 10 Million Users
Scaling on AWS for the First 10 Million UsersScaling on AWS for the First 10 Million Users
Scaling on AWS for the First 10 Million Users
 
AWS re:Invent 2016: Best practices for running enterprise workloads on AWS (E...
AWS re:Invent 2016: Best practices for running enterprise workloads on AWS (E...AWS re:Invent 2016: Best practices for running enterprise workloads on AWS (E...
AWS re:Invent 2016: Best practices for running enterprise workloads on AWS (E...
 
Enterprise Workloads on AWS
Enterprise Workloads on AWSEnterprise Workloads on AWS
Enterprise Workloads on AWS
 

Viewers also liked

An Evolving Security Landscape – Security Patterns in the Cloud
An Evolving Security Landscape – Security Patterns in the CloudAn Evolving Security Landscape – Security Patterns in the Cloud
An Evolving Security Landscape – Security Patterns in the CloudAmazon Web Services
 
Deep Dive on Delivering Amazon EC2 Instance Performance
Deep Dive on Delivering Amazon EC2 Instance PerformanceDeep Dive on Delivering Amazon EC2 Instance Performance
Deep Dive on Delivering Amazon EC2 Instance PerformanceAmazon Web Services
 
The Ad Contrarian Book - A Common Sense Perspective on Marketing and Advertis...
The Ad Contrarian Book - A Common Sense Perspective on Marketing and Advertis...The Ad Contrarian Book - A Common Sense Perspective on Marketing and Advertis...
The Ad Contrarian Book - A Common Sense Perspective on Marketing and Advertis...Hoffman | Lewis
 
Optimizing AWS S3 storage costs and usage
Optimizing AWS S3 storage costs and usageOptimizing AWS S3 storage costs and usage
Optimizing AWS S3 storage costs and usageCloudability
 
Taking Gliffy to the Cloud – Moving to Atlassian Connect - Mike Cialowicz
Taking Gliffy to the Cloud – Moving to Atlassian Connect - Mike CialowiczTaking Gliffy to the Cloud – Moving to Atlassian Connect - Mike Cialowicz
Taking Gliffy to the Cloud – Moving to Atlassian Connect - Mike CialowiczAtlassian
 

Viewers also liked (6)

An Evolving Security Landscape – Security Patterns in the Cloud
An Evolving Security Landscape – Security Patterns in the CloudAn Evolving Security Landscape – Security Patterns in the Cloud
An Evolving Security Landscape – Security Patterns in the Cloud
 
Deep Dive on Delivering Amazon EC2 Instance Performance
Deep Dive on Delivering Amazon EC2 Instance PerformanceDeep Dive on Delivering Amazon EC2 Instance Performance
Deep Dive on Delivering Amazon EC2 Instance Performance
 
Building Enterprise Cloud Apps
Building Enterprise Cloud AppsBuilding Enterprise Cloud Apps
Building Enterprise Cloud Apps
 
The Ad Contrarian Book - A Common Sense Perspective on Marketing and Advertis...
The Ad Contrarian Book - A Common Sense Perspective on Marketing and Advertis...The Ad Contrarian Book - A Common Sense Perspective on Marketing and Advertis...
The Ad Contrarian Book - A Common Sense Perspective on Marketing and Advertis...
 
Optimizing AWS S3 storage costs and usage
Optimizing AWS S3 storage costs and usageOptimizing AWS S3 storage costs and usage
Optimizing AWS S3 storage costs and usage
 
Taking Gliffy to the Cloud – Moving to Atlassian Connect - Mike Cialowicz
Taking Gliffy to the Cloud – Moving to Atlassian Connect - Mike CialowiczTaking Gliffy to the Cloud – Moving to Atlassian Connect - Mike Cialowicz
Taking Gliffy to the Cloud – Moving to Atlassian Connect - Mike Cialowicz
 

Similar to DrupalSouth 2015 - Performance: Not an Afterthought

ASP.NET Scalability - VBUG London
ASP.NET Scalability - VBUG LondonASP.NET Scalability - VBUG London
ASP.NET Scalability - VBUG LondonPhil Pursglove
 
ASP.NET Scalability - DDD7
ASP.NET Scalability - DDD7ASP.NET Scalability - DDD7
ASP.NET Scalability - DDD7Phil Pursglove
 
ASP.NET Scalability - WebDD
ASP.NET Scalability - WebDDASP.NET Scalability - WebDD
ASP.NET Scalability - WebDDPhil Pursglove
 
5 Common Mistakes You are Making on your Website
 5 Common Mistakes You are Making on your Website 5 Common Mistakes You are Making on your Website
5 Common Mistakes You are Making on your WebsiteAcquia
 
Auditing Drupal Sites for Performance, Content and Optimal Configuration - SA...
Auditing Drupal Sites for Performance, Content and Optimal Configuration - SA...Auditing Drupal Sites for Performance, Content and Optimal Configuration - SA...
Auditing Drupal Sites for Performance, Content and Optimal Configuration - SA...Jon Peck
 
From Pilot to Product - Morning@Lohika
From Pilot to Product - Morning@LohikaFrom Pilot to Product - Morning@Lohika
From Pilot to Product - Morning@LohikaIvan Verhun
 
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
 
Website optimization with request reduce
Website optimization with request reduceWebsite optimization with request reduce
Website optimization with request reduceMatt Wrock
 
Large Scale Drupal - Behind the Scenes
Large Scale Drupal - Behind the ScenesLarge Scale Drupal - Behind the Scenes
Large Scale Drupal - Behind the ScenesBoyan Borisov
 
Drupal performance
Drupal performanceDrupal performance
Drupal performanceGabi Lee
 
Drupal Site Audit - SFDUG
Drupal Site Audit - SFDUGDrupal Site Audit - SFDUG
Drupal Site Audit - SFDUGJon Peck
 
ASP.NET Scalability - NxtGen Oxford
ASP.NET Scalability - NxtGen OxfordASP.NET Scalability - NxtGen Oxford
ASP.NET Scalability - NxtGen OxfordPhil Pursglove
 
The Great Consolidation - Entertainment Weekly Migration Case Study - SANDcam...
The Great Consolidation - Entertainment Weekly Migration Case Study - SANDcam...The Great Consolidation - Entertainment Weekly Migration Case Study - SANDcam...
The Great Consolidation - Entertainment Weekly Migration Case Study - SANDcam...Jon Peck
 
Enterprise WordPress - Performance, Scalability and Redundancy
Enterprise WordPress - Performance, Scalability and RedundancyEnterprise WordPress - Performance, Scalability and Redundancy
Enterprise WordPress - Performance, Scalability and RedundancyJohn Giaconia
 
MIGRATION - PAIN OR GAIN?
MIGRATION - PAIN OR GAIN?MIGRATION - PAIN OR GAIN?
MIGRATION - PAIN OR GAIN?DrupalCamp Kyiv
 
More Cache for Less Cash (DevLink 2014)
More Cache for Less Cash (DevLink 2014)More Cache for Less Cash (DevLink 2014)
More Cache for Less Cash (DevLink 2014)Michael Collier
 
Webpack and Web Performance Optimization
Webpack and Web Performance OptimizationWebpack and Web Performance Optimization
Webpack and Web Performance OptimizationChen-Tien Tsai
 
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo Shift Conference
 

Similar to DrupalSouth 2015 - Performance: Not an Afterthought (20)

ASP.NET Scalability - VBUG London
ASP.NET Scalability - VBUG LondonASP.NET Scalability - VBUG London
ASP.NET Scalability - VBUG London
 
Drupal performance
Drupal performanceDrupal performance
Drupal performance
 
ASP.NET Scalability - DDD7
ASP.NET Scalability - DDD7ASP.NET Scalability - DDD7
ASP.NET Scalability - DDD7
 
ASP.NET Scalability - WebDD
ASP.NET Scalability - WebDDASP.NET Scalability - WebDD
ASP.NET Scalability - WebDD
 
5 Common Mistakes You are Making on your Website
 5 Common Mistakes You are Making on your Website 5 Common Mistakes You are Making on your Website
5 Common Mistakes You are Making on your Website
 
Auditing Drupal Sites for Performance, Content and Optimal Configuration - SA...
Auditing Drupal Sites for Performance, Content and Optimal Configuration - SA...Auditing Drupal Sites for Performance, Content and Optimal Configuration - SA...
Auditing Drupal Sites for Performance, Content and Optimal Configuration - SA...
 
From Pilot to Product - Morning@Lohika
From Pilot to Product - Morning@LohikaFrom Pilot to Product - Morning@Lohika
From Pilot to Product - Morning@Lohika
 
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
 
DrupalCon 2011 Highlight
DrupalCon 2011 HighlightDrupalCon 2011 Highlight
DrupalCon 2011 Highlight
 
Website optimization with request reduce
Website optimization with request reduceWebsite optimization with request reduce
Website optimization with request reduce
 
Large Scale Drupal - Behind the Scenes
Large Scale Drupal - Behind the ScenesLarge Scale Drupal - Behind the Scenes
Large Scale Drupal - Behind the Scenes
 
Drupal performance
Drupal performanceDrupal performance
Drupal performance
 
Drupal Site Audit - SFDUG
Drupal Site Audit - SFDUGDrupal Site Audit - SFDUG
Drupal Site Audit - SFDUG
 
ASP.NET Scalability - NxtGen Oxford
ASP.NET Scalability - NxtGen OxfordASP.NET Scalability - NxtGen Oxford
ASP.NET Scalability - NxtGen Oxford
 
The Great Consolidation - Entertainment Weekly Migration Case Study - SANDcam...
The Great Consolidation - Entertainment Weekly Migration Case Study - SANDcam...The Great Consolidation - Entertainment Weekly Migration Case Study - SANDcam...
The Great Consolidation - Entertainment Weekly Migration Case Study - SANDcam...
 
Enterprise WordPress - Performance, Scalability and Redundancy
Enterprise WordPress - Performance, Scalability and RedundancyEnterprise WordPress - Performance, Scalability and Redundancy
Enterprise WordPress - Performance, Scalability and Redundancy
 
MIGRATION - PAIN OR GAIN?
MIGRATION - PAIN OR GAIN?MIGRATION - PAIN OR GAIN?
MIGRATION - PAIN OR GAIN?
 
More Cache for Less Cash (DevLink 2014)
More Cache for Less Cash (DevLink 2014)More Cache for Less Cash (DevLink 2014)
More Cache for Less Cash (DevLink 2014)
 
Webpack and Web Performance Optimization
Webpack and Web Performance OptimizationWebpack and Web Performance Optimization
Webpack and Web Performance Optimization
 
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo
 

Recently uploaded

Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Product School
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesThousandEyes
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...CzechDreamin
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoTAnalytics
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Product School
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Product School
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2DianaGray10
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaCzechDreamin
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekCzechDreamin
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesBhaskar Mitra
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...Product School
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...Sri Ambati
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka DoktorováCzechDreamin
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomCzechDreamin
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...Product School
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIES VE
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsPaul Groth
 

Recently uploaded (20)

Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 

DrupalSouth 2015 - Performance: Not an Afterthought

  • 1. Performance: Not an Afterthought DrupalSouth 2015
  • 2. Nick Santamaria • Senior Developer at Technocrat • Acquia Certified Backend Developer • drupal.org http://drupal.org/user/87915 • twitter @nicksanta • Github nicksantamaria
  • 3. Presentation Outline • Introduction to performance & scalability • Common problems • Strategies for success • Infrastructure design and considerations • Debugging performance and scalability issues • QA and discussion
  • 5. Performance & Scalability Performance The speed with which a single request can be executed. Scalability The ability of a request to maintain its performance under increasing load.
  • 6. What is Performance? Back-end Performance Components • PHP • Amount of code being executed (ie, number of modules) • Efficiency of code • Database • Schema design • Query execution time
  • 7. What is Performance? Back-end Performance Components • API Requests • PHP will wait until the request returns a result or times out • Caching • Drupal database • Memcached / Redis / MongoDB • Varnish
  • 8. What is Performance? Front-end Performance Components • Network Overhead • Local vs offshore datacenters • Number of requests • Payload Size • Image optimisation • CSS / JS Minification • Markup size & compression
  • 9. What is Performance? Front-end Performance Components • Javascript • Number of scripts being included • Synchronous vs asynchronous execution • Code efficiency
  • 10. What is Scalability? “Why is scalability so hard? Because scalability cannot be an after-thought.” - Werner Vogels, Amazon CTO
  • 11. What is Scalability? A system is said to be scalable if adding resources results in proportionally increased performance. 9 women can not make a baby in 1 month. Will doubling your site’s server resources double the traffic it can handle?
  • 12. What is Scalability? Scalability Components • Caching • Block cache • Page cache • Reverse proxy cache • Opcode caching • Infrastructure • Web server load balancing • Database clustering • Caching backends - redis, memcached etc..
  • 14. Common Problems Too many modules - AKA “Open Buffet Syndrome” Real life example • 365 enabled modules • 24 core modules • 51 custom modules • 72 exported features • 750 files loaded on every request. • 10 - 20% of PHP execution time was loading files, even with APC. • CPU cycles wasted - 25,000+ calls to module_implements() per request.
  • 15. • Pages with product/* paths are NEVER cached. • Anonymous users who visit this page bypass page cache on all subsequent pages. • … AND those visitors write to the database on every subsequent page view. Common Problems Anonymous users with sessions Seems innocent, but this one line has consequences.
  • 16. Common Problems Complicated entity & field architecture ● Slows down form submission, rendering, views, and more.
  • 17. Strategies for Success Complicated entity & field architecture • How many INSERT queries per save? • node • node_revision • field_collection_item • field_collection_item_revision • field_data_field_collection_b • field_revision_field_collection_b • field_data_field_taxonomy_ref • field_revision_field_taxonomy_ref • field_data_field_collection_c • field_revision_field_collection_c • field_data_field_text • field_revision_field_text • file_managed • field_data_field_media • field_revision_field_media Real world field collection implementations are FAR more complicated than this example!
  • 18. Common Problems Others • Never use views_php module - create custom views handlers and plugins. • Complex faceted search using Drupal database - use Solr. • dblog module enabled on production - use syslog. • Carefully consider use of modules with node access functionality - they disable block caching.
  • 19. Common Problems Others • Never use views_php module - create custom views handlers and plugins. • Complex faceted search using Drupal database - use Solr. • dblog module enabled on production - use syslog. • Carefully consider use of modules with node access functionality - they disable block caching.
  • 21. On-Demand Cache Purging • Planning • Divide the site into page “types”. • For each type, build a list of events which would require a page to be cleared from cache. • Considerations • No relative dates, ie “time ago”. • Some page types may be more suited to periodic caching. • Create a spidering script to warm the caches! • Extend to other caches using CacheTags - drupal.org/project/cachetags Strategies for Success
  • 22. Strategies for Success Authcache (2.x branch) • Replaces Drupal’s default page caching allowing you to cache authenticated pages. • Huge scalability improvements for sites with a large proportion of authenticated visitors. • But also much, much more. • Personalisation - authcache_p13n • Form token magic - authcache_form • Store page cache in Varnish - authcache_varnish • Integrates with Cache Expiration
  • 23. Strategies for Success Authcache • Planning • Define which page types are cacheable. • Design how you will segment your visitors (from a cache perspective). • Identify all personalised information which must be displayed. • Considerations • Forms can be tricky - ensure you test thoroughly. • Ensure your analytics / marketing / tracking services are compatible. • See Commerce Kickstart for great out-of-the-box implementation.
  • 24. Strategies for Success Consuming Feeds & Web Services • Regularly importing data into Drupal can be resource intensive. • Feeds, migrate, custom PHP etc… All share the same fundamental problems: • Fetching large datasets, which hog i/o, memory, and CPU cycles. • Lots of slow INSERT and UPDATE operations on the database. • New data will not display immediately unless caches cleared. • The solution? Move to the front end!
  • 25. Strategies for Success Consuming Feeds & Web Services • PaRSS - drupal.org/project/parss • Integrates simple jQuery RSS parser with link fields. • AngularJS - angularjs.org • Very powerful front-end MVC framework. • Usual implementation may not be suitable for this problem. • Angular Blocks - drupal.org/node/2445795 • Allows other modules to expose AngularJS apps as blocks! • Used successfully on recent intranet project, some pages having 6 angular apps on a single page.
  • 26. Strategies for Success Load Testing • Make it part of your development process. • Dont leave it to the last minute or post-launch. • Tools • Apache jMeter • github.com/jacobSingh/Drupal-Performance-Testing-Suite • Blazemeter - blazemeter.com • Blitz - blitz.io • Web Page Test - webpagetest.org
  • 27. Strategies for Success Queues • Use queues when dealing with: • Batch processing large datasets. • Performing complex calculations. • Sequential processing of tasks. • Modules / Tools • Advanced Queue - drupal.org/project/advancedqueue • Advanced Queue Runner - github.com/nvahalik/advancedqueue-runner • Drupal Core Queues - system.queue.inc
  • 28. Strategies for Success Queues • Improves reliability. • If not using queues • There is no guarantee the process will be completed. • If the process fails, there is no easy way to repeat it. • If using queues • Each item is executed at least once. • If the process fails, the queue remains intact. • System load is stabilised because processing of complex or heavy operations is delayed.
  • 29. Strategies for Success Optimised Front-end • Image Sprites • Minimises the number of HTTP requests. • CSS • Think about what your sass / less becomes once compiled. • How complex and specific do the selectors become? • Consider architecting your CSS for conditional inclusion. • Does the site have “sections”? • CSS rendering is a blocking process.
  • 30. Strategies for Success Optimised Front-end • Asynchronous Javascript - drupal.org/project/async_js • Defers javascript execution. • Can improve responsiveness of “sluggish” JS-heavy sites. • Advanced Aggregation - drupal.org/project/advagg • Use CDN version of jQuery. • On-demand generation of aggregated assets.
  • 31. Strategies for Success Other Recommendations • Elysia Cron - drupal.org/project/elysia_cron • Configure scheduling and frequency of specific cron tasks. • Run heavy cron tasks during low traffic periods. • Entity Cache - drupal.org/project/entitycache • Stores complete entity objects in your caching backend. • Enable appropriate dependent modules such as commerce_entitycache, bean_entitycache etc.. • Apache Solr for search • drupal.org/project/search_api_solr • drupal.org/project/apachesolr
  • 33. Infrastructure Caching Backends • Memcached - drupal.org/project/memcache • Battle tested. • Widely deployed. • Volatile storage - not suitable for persistent data. • Redis - drupal.org/project/redis • Less “mature” than Memcached. • 1:1 featureset with Memcached. • Benchmarks slightly better than Memcached. • Commits data to disk by default, can be used for persistent data • Use PHP extension - github.com/phpredis/phpredis (not Predis class)
  • 34. Infrastructure Caching Backends • I recommend Redis • Store sessions in Redis rather than the database Session Proxy - drupal.org/project/session_proxy • Form cache can go straight into redis - no more need for this line: $conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
  • 35. Infrastructure Simplest Approach • Single server with all components • PHP • Web Server (Apache) • Database (MySQL) • Varnish (... sometimes) Varnish Apache PHP MySQL Instance #1
  • 36. Infrastructure Scaling Vertically • Increase instance size. • Change instance types: • CPU optimised • Memory optimised • I/O optimised • Will hit an endpoint eventually. “We’re going to need a bigger box”
  • 37. Infrastructure Splitting the box Break up stack components onto separate servers. Instance #2 Varnish Apache PHP MySQL Instance #1
  • 39. You will still eventually hit an endpoint! Infrastructure
  • 40. Infrastructure Horizontally Scalable Infrastructure • Overcomes CPU ceiling issues. • Considerations • Load balanced web servers • Database clustering • Shared / clustered file systems • Autoscaling - the holy grail. Load Balancer Varnish Apache PHP MySQLRedis Apache PHP Apache PHP Apache PHP
  • 41. Debugging Performance and Scalability Issues
  • 42. Debugging Performance and Scalability Issues Tools • New Relic APM, browser & server monitoring • MySQL slow query log • Add following lines to my.cnf and restart mysql • log_slow_queries=/var/log/mysql/slow-query.log • long_query_time=20 • XHProf - PHP profiler • Great slides for getting set up here - http://msonnabaum.github.io/xhprof- presentation/ • Browser Developer Tools • Javascript profiler • Network Monitor
  • 43. Debugging Performance and Scalability Issues General Tips • Look beyond the symptoms to find the underlying cause. • Change one thing at a time. • Measure, change, measure. • Sometimes you just have to throw more RAM at the problem.