This document provides best practices for enhancing backend Drupal development and performance. It discusses the importance of website speed and performance for a good user experience. Common causes of slow performance are outlined, such as Drupal architecture, site planning, custom code, lack of caching, and server configuration. Best practices are then presented for each stage of development including requirements, architecture, implementation, testing, and production deployment. The goal is to understand user needs, select optimal modules, implement caching and other optimizations, conduct thorough testing, and optimize server configuration for high performance.
3. Recap: Importance of Speed & Performance
END USER EXPERIENCE
Expect fast page loads / reloads
Faster interactions
Channels no longer restricted to websites
Decoupled and mobile applications
Integration with 3rd party for richer and
personalized journey
4. Impacts
END USER EXPERIENCE
More wait time - customers move on
Lesser or irrelevant information - seek another
source
Website only - leads only via SEO/ADs
SEO - affected
Multi-channel experience affected -
mobile/tablet based audience left behind
6. 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
7. 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
8. Common Causes
Biggest/Obvious causes
- Drupal Architecture
- Site planning
- Business logic via customizations
- Caching missing
- Drupal configuration
- Server Architecture
9. 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)
10. 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
11. Oh… I will just solve it
using decoupled
Node.js Server side
rendering is faster you
know
12. 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
14. 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 Samples
For 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?
15. - 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
16. - 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
17. 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 & Tuning
Pre-Production: Before Go Live
Test on Production-like setup
- Resource utilization
- Cache hit ratio
- Database performance
- Load Tests
- Acquia Insight
18. GO LIVE !! Server deployment
Drupal Optimized Server setup
Caching
Logs
Production Optimized Drupal
Configuration
19. - 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