How to Optimize Your Drupal 7 Website Performance
Devel Module to the Rescue:
Slow Query Monitoring:
- Slow query is the type of SQL query that takes more time to execute. These types of queries can be optimized to increase the performance of the site.
- To do this, enable the devel module and goto the admin/config/devel and enable the slow query option.
- This option will display all the SQL queries made for every page request and the most time consuming queries will be highlighted.
- We can then identify them in all the pages of the site and optimize them.
- Another option available in the devel module settings page is the xhprof profiling.
- This profiling will give a detailed report on the whole performance of the site. Xhprof profiling is a high level profiling and is recommended only for advanced users as the wrong usage may affect the site behavior.
- This option in not available at the go itself, you have to make some server side installations. For further queries, Please look into this link http://www.pixelite.co.nz/article/profiling-drupal-7-performance-xhprof-and-devel/
Other features include:
- Display page execution time in the query log box.
- Display memory usage
- Display redirection page
- Display page array Variable
*** All devel module settings must be used for development purpose only and must be disabled after usage.
- The type of image format we are using can also affect the performance of the site as they can take time to load, based on the format.
- Usage of modern formats like .png or .jpg are highly recommended.
- Another point to note is the size of the images. Size of images that don’t need to be of high quality can be reduced to bare minimum for faster loading.
- Video format can also be changed to modern formats if your site uses videos
- Caching is the method of saving requests in the server and serving from that saved data instead of hitting the DB for every request, which can reduce the performance of the site.
- Basic level of caching can be done in the admin/config/performance page where we can enable caching for the anonymous users who will usually be seeing the same pages of the site and not dynamic pages.
- The cache retention time can also be specified here, which can be used to delete the cache periodically without human intervention.
- Advanced level of caching can include using different services in the server level to cache the pages.
- Services like Varnish and Pound can be installed in the server level and used to improve the site performance.
- Caching systems can be a boon in cases of sites that have most of the content that don’t change over time.
- Minifying the CSS and JS using some module of your choice will also improve the speed of the site.
- Upgrading to the latest version of bootstrap and also using newer technologies for styling like SASS can also improve the performance of the site.
- Nowadays, all sites have inbuilt search in them. If your site uses search as an important feature, then we can use apache SOLR instead of the inbuilt default Drupal search.
- This will reduce the amount of load on the DB as user searches will not hit the DB directly. This will also improve the autocomplete of the searches.
- You can install the Apache SOLR module to leverage the SOLR abilities. This also needs some backend work like install tomcat and apache solr in the server and correctly configuring them.
- This will index the whole site and help make the search faster.
We can also implement Lazy loading in the site to make sure the skeleton comes first instead of loading it fully on one go. This method is being used by Facebook that makes the site load faster.