On this page
- Basic settings
- Theme optimization
- Coding standard and proper use of already existing core API
- Secure codes
- DB Query optimization in codes
- DB table optimization
- Disable unnecessary modules
- Remove unnecessary contents and others
- Cache modules
- Make changes according to Google Pagespeed and yahoo YSlow suggestions
- MySQL Settings
- Apache settings
- Also, we can check these options :
- 1) Turn Page Caching On
- 2) Turn Views caching on
Optimizing Drupal to load faster (Server, MySQL, caching, theming, HTML)
Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites
This documentation needs review. See "Help improve this page" in the sidebar.
Basic settings
- Configure cron job (for Drupal 6 http://drupal.org/project/poormanscron)
- Make sure all cache tables are clearing properly especially cache_form
- Enable cache options on the performance page
- (For Drupal 6, http://drupal.org/project/advagg )
Theme optimization
- Manually Remove blankspaces and comments from .tpl
- No indentation in .tpl
- Turn on CSS and JS aggregation in the performance page
- Manually reduce css file size by removing duplicate and combine similar together
- Move codes to functions that should be in a custom common module. Use functions for similar problems instead of coding separately. Refer core API
Coding standard and proper use of already existing core API
- http://drupal.org/coding-standards
- https://drupalize.me/videos/understanding-drupal-coding-standards?p=2012
Secure codes
DB Query optimization in codes
- Join db queries whenever possible
- For Db update and insert, use core API
- Use drupal standard http://drupal.org/coding-standards
DB table optimization
Disable unnecessary modules
- Devel
- Statistics
- Update status
- Use syslog instead of Database logging
Remove unnecessary contents and others
Cache modules
- Make use of object caches to reduce database overhead, e.g. Memcache, Redis or APC
- https://drupal.org/project/authcache
- Some module may help improve
http://drupal.org/project/ajaxblocks (not available with Drupal 8 & 9 )
Make changes according to Google Pagespeed and yahoo YSlow suggestions
MySQL Settings
- Cache Size say 32MB in MySQL
- Use https://github.com/initlabopen/mysqlconfigurer for fully automated MySQL performance tuning
Apache settings
- DNS lookup : OFF
- Set FollowSymLinks everywhere and never set SymLinksIfOwnerMatch
- Avoid content negotiation. Or use type-map files rather than Options MultiViews directive
- KeepAlive on, and KeepAliveTimeout very low (1 or 2 sec)
- Disable or comment access.log settings
- Enable mod_deflate or mod_gzip
- Install APC server with higher memory limit apc.shm_size = 64
Also, we can check these options :
1) Turn Page Caching On
What page caching does is that instead of using a bunch of database queries to get the data used in making a typical web page, the rendered contents of the web page are stored in a separate database cache table so that it can be recalled quicker. If you have 10 people visiting the site from different computers, Drupal first looks into the database cache table to see if the page is there, if it is, it just gives them the page. Think of saving the output of 50 separate queries so that is accessible with a single query. You obviously are reducing the SQL queries required by a lot. What the page cache table actually stores is HTML content.
Page Caching is that it only works to optimize the page load time for Anonymous users. This is because when you are logged in, you might have blocks that show up on the page that are customized for you, if it served everybody on the same page, they would see your customized information (think of a My Recent Posts block), so Drupal does not use the Page Cache for Authenticated users automatically. This allows you to turn Page Caching on and still get the benefit of Anonymous user page load times but does not break the site for Authenticated users. There are other caching options that will help with Authenticated user page performance, we will talk about those later.
To enable Page Caching, you go to Configuration | Development and select the checkbox next to "Cache pages for anonymous users".
2) Turn Views caching on
As mentioned when talking about Page Caching only working for anonymous users above, there are other caching options for helping with Authenticated user page performance. One of those options is to turn on caching for blocks and pages that you create using the Views module. This allows you to cache the output of the query used to generate the view, or the end HTML output of your View, and you can tune the cache for them separately. And realize too that this means you can cache portions of a page if you are using one or several Views blocks in the page, it will just cache that block in the page, not the whole page.
See more (Drupal7) @ https://www.lullabot.com/articles/a-beginners-guide-to-caching-data-in-d...
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion