Upload
acquia
View
109
Download
1
Embed Size (px)
Citation preview
Pavithra Raman - Team Lead, Solution Architect
Enhancing Back End Drupal Development & Performance
Drupal 8 Lessons From the Field
Agenda
Recap: Importance of Speed & Performance
Common Causes & Effects
Best practices & Checkpoints
Recap: Importance of Speed & Performance
END USER EXPERIENCEExpect fast page loads / reloadsFaster interactionsChannels no longer restricted to websitesDecoupled and mobile applicationsIntegration with 3rd party for richer and personalized journey
Impacts
END USER EXPERIENCEMore wait time - customers move onLesser or irrelevant information - seek another sourceWebsite only - leads only via SEO/ADsSEO - affectedMulti-channel experience affected -mobile/tablet based audience left behind
But why is it happening ?
Fight the good fight, but compromise
Designer/Marketer Developer
?
● Customer experience
● Larger Media assets
● More features
● Goal: Visually attractive
and engaging experience
● Server side performance
● Content generation
● Reduce response time
● Goal: Cacheable and
scalable content/asset
creation & delivery
Drupal - very powerful Content Management / Digital
Experience System
Lot of features
Content
Taxonomy
Media
Templating engine
User management
API First
Panelizers
Workflow
e-commerce
and many many more ….
With great power comes great responsibility
Common Causes
Biggest/Obvious causes- Drupal Architecture- Site planning- Business logic via customizations- Caching missing- Drupal configuration- Server Architecture
Common Causes
Smaller/Hidden causes ( we might miss these )- MySQL slow queries- Information architecture- 3rd Party integrations- Content Display / Theme ( What ? )- Slow Complex code (CPU/RAM
spikes)
Effects
- Number requests dropped - Slow Drupal requests- PHP max timeout- Server CPU/RAM maxing out- MySQL server overload- Impacts on the front end delivery- Easy target for DDoS attacks- Unusable content editorial
Oh… I will just solve it using decoupled
Node.js Server side rendering is faster you know
Uhhh.. Well….❏ Yes, but not completely.
❏ Content creation is still happening via the Drupal UI for
many of these applications.
❏ Any custom logic or 3rd party integrations to connect
other sources might be invoked via the Drupal layer
❏ You still need fast performing APIs
13 ©2016 Acquia Inc. — Confidential and Proprietary
Best practices & Checkpoints
Understand end user experience
Business requirements Custom Logic
3rd party integration
Editorial add-ons
Ideal experience benchmarks
Information architecture
Module selection
Library selection
Function reuse
Content reuse
Drupal setup
Customizations as per Drupal Coding standards
Caching
Performance test / PHP profiling with development
Front End + Theming
Drupal Request profiling
MySQL slow query log
Load Testing
Acquia Insight
Requirements Architecture Implementation Testing / QA
Does the experience require any complex
front end components like display effects,
asynchronous content refresh, rich media
experience, etc.
Does the application need any complex data
processing, presentation logic, dynamic
components ?
Does the 3rd party integration provide you with
hi-speed APIs? Does this 3rd party add
more load to your code? Does your
application have to do more processing on
the Drupal layer?
Requirements Review SamplesFor the content editorial experience, do we
need any add-ons for image processing,
WYSIWYG editors, in-line editors, heavy
media/assets uploaded, complex and heavy
data structures for content?
From the perspective of various users, content
consumers, content editors, media
managers, decoupled applications
connecting to the Drupal backend what are
the response benchmarks?
- Maintain Drupal core and contributed modules at
latest stable version
- Custom modules as per Drupal Code-standards
- Drupal API + Hooks
- PHP, OOPS, Symphony
- JS
- CSS
- Select modules as per current and future requirements
Architecture Best Practices
- Client side caching
- Varnish cache
- Drupal Internal Dynamic Page cache
- Drupal Internal Page cache
- Page cache max time ( dependent on
content update frequency )
- Memcache
- APC - opcode cache
- Uninstall unused modules
Implementation Best Practices- Optimized Images/Media
- Responsive images/pages via different
images
- Aggregation and compression of JS/CSS
- Bigpipe
- Lazy Loading
- Clean twig templates
Tools: Unit testing - Dev
- XDebug + XHProf - PHP profiler
- Devel module
- Automated tests: Behat, Drupal
- Google Pagespeed Insights
- Acquia Insight
What to test for ( against ideal benchmarks )
- Resource utilization ( CPU, RAM, PHP
procs, cache)
- Cache hit ratio
- MySQL utilization / Slow queries
- OutOfMemory = OOM errors
- Response time
Testing & TuningPre-Production: Before Go Live
Test on Production-like setup
- Resource utilization
- Cache hit ratio
- Database performance
- Load Tests
- Acquia Insight
GO LIVE !! Server deployment
Drupal Optimized Server setup
Caching
Logs
Production Optimized Drupal
Configuration
- Front end asset / page cache using
- Varnish/CDN
- Load Balancing for easy scaling
- Web server optimized for Drupal
- PHP with
- APCu for PHP code cache
- memcache ext +
- Dedicated or co-hosted memcached
for Drupal cache tables
- MySQL optimized for Drupal
- Read/Write optimized storage
- Dedication Cron server if required
Production - Checklist- Disable Database Logging
- Enable syslog ( to send logs to server
logging system )
- Disable non-production required modules
- ex. modules enabled for testing
- Views UI, Config UI
- Page cache settings
- Page + Blocks + Views + Others
- API cache & security setup
- Aggregate & compress - JS + CSS
Questions
Thank You
200-500ms“Good” TTFB (Time To First Byte)
https://www.rackaid.com/blog/time-to-first-byte/
1s to 3s“Good” TTLB (Time To Last Byte)
https://yoast.com/page-speed-ranking-factor/
Page weight
http://www.httparchive.org/interesting.php (October 16th)
Page weight
http://www.httparchive.org/interesting.php (October 16th)
Average LTE
speed is 5-
12Mbps
This page would
take 2-5 seconds
to download!
Images
http://www.httparchive.org/interesting.php (October 16th)
54%