SlideShare ist ein Scribd-Unternehmen logo
1 von 26
Drupal Performance Optimization
Best Practices
July 4, 2014
Ratnesh Kumar
2
Overview
• Drupal Performance
• Know the tools for performance Analysis
• Best Practices for Performance Optimization
– Application Level
– Server Configuration
– Database Configuration
• Common mistakes which causes Performance
bottlenecks
Drupal Performance
• Performance bottlenecks is a major issue with Drupal based
application
• Common understanding among people, product stakeholders
and web developers is:
 Drupal is not a right choice for large application with lot
of users and content.
 It consumes lot of memory and resources.
3
4
Drupal Performance
Why Drupal is Slow?
• Because it’s not configured/deployed correctly…
• Contents are dynamic not static.
• Bootstrap process is complex where series of events occurs
behind the scene:
 Establishing a database connection
 Loading all settings and modules
 Initializing a user session
 Mapping the URL to page callback
 Render the Page (theme initialization)
On every single page request all the above events occurs in backend.
5
Drupal Performance
When do you think about performance?
(Before/After Development)
 Discuss and freeze the performance related NFRs carefully
under requirement document, before starting the development.
 Set a goal for performance which needs to be achieved.
 Finalize Caching strategies.
Tools for performance Analysis
6
Tools for performance Analysis
 www.webpagetest.org
Google pageSpeed (Chrome add ons)
 Yslow (Firefox add ons)
 Apache Benchmarking
 www.whichloadfaster.com (compare with other sites)
 Drupal module – Devel
 top/htop ……. and lots more
Best Practices - Application Level
7
Best Practices - Application Level
 Disable and Delete unused and non-essential modules
 Disable the Update Manager module on Production.
 Database logging (dblog) is enabled by default in Drupal 7, and errors can
fill up your database quickly.
 A better solution is to fix all PHP notices and warnings to reduce logging
overhead.
8
Best Practices - Application Level
 Put JS at the bottom of the page.
 Custom JS/CSS should be added in the application only using
drupal_add_js() and drupal_add_css() function respectively.
 Aggregate and minify JS/CSS file through Drupal Admin.
 Use the Fast 404 module to serve static 404s for image, icon,
CSS, or other static files, rather than bootstrapping Drupal.
Best Practices – Server Configuration
9
Best Practices – Server Configuration
 Cache PHP with APC(Alternative PHP cache)
 Cache everything to reduce the page load time for
anonymous user (Boost, Memcache/Varnish).
10
Best Practices – Server Configuration
 Configure CRON to be executed at a certain timestamp in a day, instead of
executing this on every request. Drupal executes cron hook on every page request.
 CDN Integration – to store all static files e.g. css, js and images.
 Leverage browser caching
 Optimize images to reduce the total page size.
11
Best Practices – Server Configuration
 Boost + Memcache – Works best in most of the case as it
solves performance issue for anonymous and authenticated user
both
Boost provides static page caching for Drupal enabling a very significant performance and
scalability boost for sites that receive mostly anonymous traffic
 Precache everything through warmup script
 Use cache-expire module to update cache on node insert/update/detele.
12
Best Practices – Server Configuration
13
Best Practices – Server Configuration
• Memcache
You can use the Memcache module to move some common cache queries out of the database
and into memory. Information held in memory will always be retrieved more quickly than
information retrieved from a database query.
• APC (Alternative PHP Cache)
 PHP is an interpreted language, which means the files have to be reduced down into
opcodes in order to actually be executed by the server.
 Once APC is installed on the server and configured, it will store the intermediate code of
PHP files in memory so that every request does not result in fetching all those PHP files off disk
and interpreting the files every time.
14
Best Practices – Server Configuration
• Integrate CDN to store all static files(JS/Images/CSS)
A content delivery network (CDN) is a collection of web servers distributed across multiple
locations to deliver content more efficiently to users. The server selected for delivering content to
a specific user is typically based on a measure of network proximity.
15
Best Practices – Server Configuration
• Leverage Brower Caching
 What browser caching does:
 “Remember" the resources that the browser has already loaded. When a visitor goes to
another page on your website your logo or CSS file does not need to be loaded again,
because the browser has them "remembered". The end result is that your pages load
much faster.
 Browser caching can be enabled with few configuration added in the .htaccess file on the
server.
• Set expiry time of static contents
<IfModule mod_expires.c>
# Enable expirations.
ExpiresActive On
ExpiresByType image/jpg "access 1 month"
16
Best Practices – Server Configuration
• Leverage Brower Caching
• Set max-age header
<FilesMatch "(.js.gz|.css.gz)$">
Header set Cache-Control "max-age=2678400, public"
ExpiresActive On
ExpiresDefault "access plus 1 month“
 Requirements:
• mod_expire and mod_header modules needs to be installed and enabled on the
server(Apache).
17
Best Practices – Server Configuration
• CRON Configuration
Misconfiguration of CRON settings results into major performance issue as Drupal executes all
the cron hooks on every single page request by default.
 Configure CRON to be executed at a certain timestamp in a day
 Elysia cron module works perfectly for configuring cron.
 It extends Drupal standard cron, allowing a fine grain control over each task and several
ways to add custom cron jobs to your site.
18
Best Practices – Server Configuration
• CRON Configuration
 Configuration on Server side:
Connect to server through ssh
Login as root user (sudo su)
Command to view/edit crontab file
 crontab –l (to view the list of cron script configured on the server)
 crontab –e (opens the crontab configuration)
Add the below line to excute the cron at 2:10 AM daily
10 2 * * * /usr/bin/wget -O - -q -t 1
http://www.createdbespoke.com/sites/all/modules/community/elysia_cron/cron.php?cr
on_key=sfaslsfklsfjlksfjlfsaf
Save the file and quit – wq
Best Practices – Database
19
Best Practices – Database
 Do not use InnoDB for the semaphore table, use Memory
ALTER TABLE semaphore ENGINE=MEMORY;
 innodb_buffer_pool_size 70-80% of memory is a safe bet. I set it to 12G on 16GB box.
 innodb_log_file_size – This depends on your recovery speed needs but 256M seems to be a
good balance between reasonable recovery time and good performance
 innodb_log_buffer_size=4M is good for most cases unless you’re piping large blobs to Innodb
in this case increase it a bit.
20
Best Practices – Database
 Enable MySQL query cache (i.e. query_cache_size)
 Find Slow query through slow query log file.
 Create indexes to optimize the query
20
Questions?
Questions?
20
Thanks… 

Weitere ähnliche Inhalte

Was ist angesagt?

Wordpress optimization
Wordpress optimizationWordpress optimization
Wordpress optimizationAlmog Baku
 
WordPress Hosting Best Practices - Do's and Don't s | WordPress Trivandrum
WordPress Hosting Best Practices - Do's and Don't s  | WordPress TrivandrumWordPress Hosting Best Practices - Do's and Don't s  | WordPress Trivandrum
WordPress Hosting Best Practices - Do's and Don't s | WordPress TrivandrumWordPress Trivandrum
 
Understanding Web Cache
Understanding Web CacheUnderstanding Web Cache
Understanding Web CacheProdigyView
 
wordpress-performance-presentation
wordpress-performance-presentationwordpress-performance-presentation
wordpress-performance-presentationArun Janarthanan
 
World Wide Web Caching
World Wide Web CachingWorld Wide Web Caching
World Wide Web Cachingersanbilik
 
Skalowalna architektura na przykładzie soccerway.com
Skalowalna architektura na przykładzie soccerway.comSkalowalna architektura na przykładzie soccerway.com
Skalowalna architektura na przykładzie soccerway.comSpodek 2.0
 
Client-side Website Optimization
Client-side Website OptimizationClient-side Website Optimization
Client-side Website OptimizationRadu Pintilie
 
Website performance optimization QA
Website performance optimization QAWebsite performance optimization QA
Website performance optimization QADenis Dudaev
 
Web Optimization Level: Paranoid
Web Optimization Level: ParanoidWeb Optimization Level: Paranoid
Web Optimization Level: Paranoidrobin_sy
 
Building low latency java applications with ehcache
Building low latency java applications with ehcacheBuilding low latency java applications with ehcache
Building low latency java applications with ehcacheChris Westin
 
Drupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesDrupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance Sitesdrupalcampest
 

Was ist angesagt? (17)

Caching Strategies
Caching StrategiesCaching Strategies
Caching Strategies
 
Wordpress optimization
Wordpress optimizationWordpress optimization
Wordpress optimization
 
WordPress Hosting Best Practices - Do's and Don't s | WordPress Trivandrum
WordPress Hosting Best Practices - Do's and Don't s  | WordPress TrivandrumWordPress Hosting Best Practices - Do's and Don't s  | WordPress Trivandrum
WordPress Hosting Best Practices - Do's and Don't s | WordPress Trivandrum
 
23 Ways To Speed Up WordPress
23 Ways To Speed Up WordPress23 Ways To Speed Up WordPress
23 Ways To Speed Up WordPress
 
Understanding Web Cache
Understanding Web CacheUnderstanding Web Cache
Understanding Web Cache
 
wordpress-performance-presentation
wordpress-performance-presentationwordpress-performance-presentation
wordpress-performance-presentation
 
World Wide Web Caching
World Wide Web CachingWorld Wide Web Caching
World Wide Web Caching
 
Skalowalna architektura na przykładzie soccerway.com
Skalowalna architektura na przykładzie soccerway.comSkalowalna architektura na przykładzie soccerway.com
Skalowalna architektura na przykładzie soccerway.com
 
Client-side Website Optimization
Client-side Website OptimizationClient-side Website Optimization
Client-side Website Optimization
 
Web performance Talk
Web performance TalkWeb performance Talk
Web performance Talk
 
Website performance optimization QA
Website performance optimization QAWebsite performance optimization QA
Website performance optimization QA
 
Caching
CachingCaching
Caching
 
WordCamp RVA
WordCamp RVAWordCamp RVA
WordCamp RVA
 
Web Optimization Level: Paranoid
Web Optimization Level: ParanoidWeb Optimization Level: Paranoid
Web Optimization Level: Paranoid
 
Building low latency java applications with ehcache
Building low latency java applications with ehcacheBuilding low latency java applications with ehcache
Building low latency java applications with ehcache
 
Drupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesDrupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance Sites
 
Fluent 2012 v2
Fluent 2012   v2Fluent 2012   v2
Fluent 2012 v2
 

Ähnlich wie Drupal performance optimization Best Practices

Make Drupal Run Fast - increase page load speed
Make Drupal Run Fast - increase page load speedMake Drupal Run Fast - increase page load speed
Make Drupal Run Fast - increase page load speedAndy Kucharski
 
Cloud computing 3702
Cloud computing 3702Cloud computing 3702
Cloud computing 3702Jess Coburn
 
DrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizingDrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizingAshok Modi
 
WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019Anam Ahmed
 
Improving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve InternetImproving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve InternetAchieve Internet
 
Improving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve InternetImproving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve InternetAchieve Internet
 
Site Speed = Success – Optimising WordPress from the Server Up - Presented by...
Site Speed = Success – Optimising WordPress from the Server Up - Presented by...Site Speed = Success – Optimising WordPress from the Server Up - Presented by...
Site Speed = Success – Optimising WordPress from the Server Up - Presented by...WordCamp Harare
 
WordCamp Harare 2016 - Site Speed = Success
WordCamp Harare 2016 - Site Speed = SuccessWordCamp Harare 2016 - Site Speed = Success
WordCamp Harare 2016 - Site Speed = SuccessAnthony Somerset
 
Introduction to Drupal - Installation, Anatomy, Terminologies
Introduction to Drupal - Installation, Anatomy, TerminologiesIntroduction to Drupal - Installation, Anatomy, Terminologies
Introduction to Drupal - Installation, Anatomy, TerminologiesGerald Villorente
 
PAC 2019 virtual Mark Tomlinson
PAC 2019 virtual Mark TomlinsonPAC 2019 virtual Mark Tomlinson
PAC 2019 virtual Mark TomlinsonNeotys
 
Orlando DNN Usergroup Pres 12/06/11
Orlando DNN Usergroup Pres 12/06/11Orlando DNN Usergroup Pres 12/06/11
Orlando DNN Usergroup Pres 12/06/11Jess Coburn
 
Make Drupal Run Fast - increase page load speed
Make Drupal Run Fast - increase page load speedMake Drupal Run Fast - increase page load speed
Make Drupal Run Fast - increase page load speedPromet Source
 
Drupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesDrupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesExove
 
Speeding Up The Snail
Speeding Up The SnailSpeeding Up The Snail
Speeding Up The SnailMarcus Deglos
 
Optimizing Drupal Performance. Tips and Tricks
Optimizing Drupal Performance. Tips and TricksOptimizing Drupal Performance. Tips and Tricks
Optimizing Drupal Performance. Tips and TricksTimur Kamanin
 
Drupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp NorthDrupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp NorthPhilip Norton
 
Drupal caching
Drupal cachingDrupal caching
Drupal cachingExove
 

Ähnlich wie Drupal performance optimization Best Practices (20)

Make Drupal Run Fast - increase page load speed
Make Drupal Run Fast - increase page load speedMake Drupal Run Fast - increase page load speed
Make Drupal Run Fast - increase page load speed
 
Cloud computing 3702
Cloud computing 3702Cloud computing 3702
Cloud computing 3702
 
Scaling PHP apps
Scaling PHP appsScaling PHP apps
Scaling PHP apps
 
DrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizingDrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizing
 
WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019
 
Caching 101
Caching 101Caching 101
Caching 101
 
Improving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve InternetImproving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve Internet
 
Improving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve InternetImproving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve Internet
 
Site Speed = Success – Optimising WordPress from the Server Up - Presented by...
Site Speed = Success – Optimising WordPress from the Server Up - Presented by...Site Speed = Success – Optimising WordPress from the Server Up - Presented by...
Site Speed = Success – Optimising WordPress from the Server Up - Presented by...
 
WordCamp Harare 2016 - Site Speed = Success
WordCamp Harare 2016 - Site Speed = SuccessWordCamp Harare 2016 - Site Speed = Success
WordCamp Harare 2016 - Site Speed = Success
 
Introduction to Drupal - Installation, Anatomy, Terminologies
Introduction to Drupal - Installation, Anatomy, TerminologiesIntroduction to Drupal - Installation, Anatomy, Terminologies
Introduction to Drupal - Installation, Anatomy, Terminologies
 
PAC 2019 virtual Mark Tomlinson
PAC 2019 virtual Mark TomlinsonPAC 2019 virtual Mark Tomlinson
PAC 2019 virtual Mark Tomlinson
 
Orlando DNN Usergroup Pres 12/06/11
Orlando DNN Usergroup Pres 12/06/11Orlando DNN Usergroup Pres 12/06/11
Orlando DNN Usergroup Pres 12/06/11
 
Make Drupal Run Fast - increase page load speed
Make Drupal Run Fast - increase page load speedMake Drupal Run Fast - increase page load speed
Make Drupal Run Fast - increase page load speed
 
Drupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesDrupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance Sites
 
Speeding Up The Snail
Speeding Up The SnailSpeeding Up The Snail
Speeding Up The Snail
 
Optimizing Drupal Performance. Tips and Tricks
Optimizing Drupal Performance. Tips and TricksOptimizing Drupal Performance. Tips and Tricks
Optimizing Drupal Performance. Tips and Tricks
 
Drupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp NorthDrupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp North
 
Performance engineering
Performance engineeringPerformance engineering
Performance engineering
 
Drupal caching
Drupal cachingDrupal caching
Drupal caching
 

Kürzlich hochgeladen

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 

Kürzlich hochgeladen (20)

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

Drupal performance optimization Best Practices

  • 1. Drupal Performance Optimization Best Practices July 4, 2014 Ratnesh Kumar
  • 2. 2 Overview • Drupal Performance • Know the tools for performance Analysis • Best Practices for Performance Optimization – Application Level – Server Configuration – Database Configuration • Common mistakes which causes Performance bottlenecks
  • 3. Drupal Performance • Performance bottlenecks is a major issue with Drupal based application • Common understanding among people, product stakeholders and web developers is:  Drupal is not a right choice for large application with lot of users and content.  It consumes lot of memory and resources. 3
  • 4. 4 Drupal Performance Why Drupal is Slow? • Because it’s not configured/deployed correctly… • Contents are dynamic not static. • Bootstrap process is complex where series of events occurs behind the scene:  Establishing a database connection  Loading all settings and modules  Initializing a user session  Mapping the URL to page callback  Render the Page (theme initialization) On every single page request all the above events occurs in backend.
  • 5. 5 Drupal Performance When do you think about performance? (Before/After Development)  Discuss and freeze the performance related NFRs carefully under requirement document, before starting the development.  Set a goal for performance which needs to be achieved.  Finalize Caching strategies.
  • 7. 6 Tools for performance Analysis  www.webpagetest.org Google pageSpeed (Chrome add ons)  Yslow (Firefox add ons)  Apache Benchmarking  www.whichloadfaster.com (compare with other sites)  Drupal module – Devel  top/htop ……. and lots more
  • 8. Best Practices - Application Level
  • 9. 7 Best Practices - Application Level  Disable and Delete unused and non-essential modules  Disable the Update Manager module on Production.  Database logging (dblog) is enabled by default in Drupal 7, and errors can fill up your database quickly.  A better solution is to fix all PHP notices and warnings to reduce logging overhead.
  • 10. 8 Best Practices - Application Level  Put JS at the bottom of the page.  Custom JS/CSS should be added in the application only using drupal_add_js() and drupal_add_css() function respectively.  Aggregate and minify JS/CSS file through Drupal Admin.  Use the Fast 404 module to serve static 404s for image, icon, CSS, or other static files, rather than bootstrapping Drupal.
  • 11. Best Practices – Server Configuration
  • 12. 9 Best Practices – Server Configuration  Cache PHP with APC(Alternative PHP cache)  Cache everything to reduce the page load time for anonymous user (Boost, Memcache/Varnish).
  • 13. 10 Best Practices – Server Configuration  Configure CRON to be executed at a certain timestamp in a day, instead of executing this on every request. Drupal executes cron hook on every page request.  CDN Integration – to store all static files e.g. css, js and images.  Leverage browser caching  Optimize images to reduce the total page size.
  • 14. 11 Best Practices – Server Configuration  Boost + Memcache – Works best in most of the case as it solves performance issue for anonymous and authenticated user both Boost provides static page caching for Drupal enabling a very significant performance and scalability boost for sites that receive mostly anonymous traffic  Precache everything through warmup script  Use cache-expire module to update cache on node insert/update/detele.
  • 15. 12 Best Practices – Server Configuration
  • 16. 13 Best Practices – Server Configuration • Memcache You can use the Memcache module to move some common cache queries out of the database and into memory. Information held in memory will always be retrieved more quickly than information retrieved from a database query. • APC (Alternative PHP Cache)  PHP is an interpreted language, which means the files have to be reduced down into opcodes in order to actually be executed by the server.  Once APC is installed on the server and configured, it will store the intermediate code of PHP files in memory so that every request does not result in fetching all those PHP files off disk and interpreting the files every time.
  • 17. 14 Best Practices – Server Configuration • Integrate CDN to store all static files(JS/Images/CSS) A content delivery network (CDN) is a collection of web servers distributed across multiple locations to deliver content more efficiently to users. The server selected for delivering content to a specific user is typically based on a measure of network proximity.
  • 18. 15 Best Practices – Server Configuration • Leverage Brower Caching  What browser caching does:  “Remember" the resources that the browser has already loaded. When a visitor goes to another page on your website your logo or CSS file does not need to be loaded again, because the browser has them "remembered". The end result is that your pages load much faster.  Browser caching can be enabled with few configuration added in the .htaccess file on the server. • Set expiry time of static contents <IfModule mod_expires.c> # Enable expirations. ExpiresActive On ExpiresByType image/jpg "access 1 month"
  • 19. 16 Best Practices – Server Configuration • Leverage Brower Caching • Set max-age header <FilesMatch "(.js.gz|.css.gz)$"> Header set Cache-Control "max-age=2678400, public" ExpiresActive On ExpiresDefault "access plus 1 month“  Requirements: • mod_expire and mod_header modules needs to be installed and enabled on the server(Apache).
  • 20. 17 Best Practices – Server Configuration • CRON Configuration Misconfiguration of CRON settings results into major performance issue as Drupal executes all the cron hooks on every single page request by default.  Configure CRON to be executed at a certain timestamp in a day  Elysia cron module works perfectly for configuring cron.  It extends Drupal standard cron, allowing a fine grain control over each task and several ways to add custom cron jobs to your site.
  • 21. 18 Best Practices – Server Configuration • CRON Configuration  Configuration on Server side: Connect to server through ssh Login as root user (sudo su) Command to view/edit crontab file  crontab –l (to view the list of cron script configured on the server)  crontab –e (opens the crontab configuration) Add the below line to excute the cron at 2:10 AM daily 10 2 * * * /usr/bin/wget -O - -q -t 1 http://www.createdbespoke.com/sites/all/modules/community/elysia_cron/cron.php?cr on_key=sfaslsfklsfjlksfjlfsaf Save the file and quit – wq
  • 22. Best Practices – Database
  • 23. 19 Best Practices – Database  Do not use InnoDB for the semaphore table, use Memory ALTER TABLE semaphore ENGINE=MEMORY;  innodb_buffer_pool_size 70-80% of memory is a safe bet. I set it to 12G on 16GB box.  innodb_log_file_size – This depends on your recovery speed needs but 256M seems to be a good balance between reasonable recovery time and good performance  innodb_log_buffer_size=4M is good for most cases unless you’re piping large blobs to Innodb in this case increase it a bit.
  • 24. 20 Best Practices – Database  Enable MySQL query cache (i.e. query_cache_size)  Find Slow query through slow query log file.  Create indexes to optimize the query