Skip to main content

Optimize Drupal 7


Hi, There can be a number of approaches u can think of. I am listing some of those based on my recent experinces

1. Try to have minimum no of tpl files in your theme folder. We should avoide writing separate tpl for each type of content or node 

2. Try to include internal css & js files on at the apprpriate location under speific hooks or so, sothat those don't get loaded unnecessarily 

3. Try to make use of modules like cache_external_files to load external js files from ur local system and get it updated on cron run 

4. Write ur code under best possible drupal way, I mean say, if we can have some code be working under page preprocess, we shouldn't write it in hook_init. 

5. can take help of sites like http://gtmetrix.com/ , newrelic to check the site performance & follow the suggestions they provide 

6. Combine images using CSS sprites 

7. Leverage browser caching 

8. Enable gzip compression 

9. Use boost/mamcache, but be careful as boost has an issue with SSL like here http://drupal.org/node/1466480 

10. Try not to use a contributed module just because it is giving a unctionality, if you can take the required code and implement it from your custom module, it will have less load. 

11. Try to avoid slow queries 

12. Yes, if you can have CDN facility, it will be good as in that case the data will be fetched from the distributed system. If you can have distributed DB privilege, it will be better as in that case the DB & file requests will not be on the same server 

Hope it helps.

Comments

Popular posts from this blog

Set the default language in Notepad++

I am showing this for the PHP language. In Notepad++   Click on Settings -> Preferences   Click on the New Document tab   Change the Default Language to PHP See below inage   To add an extension to load PHP editor for different extensions.   Click on Settings -> Style Configurator   In Language scroll down to PHP and click it.   In below it will show default ext.     Add your extensions at user exit. (Don't need '.').       eg:  inc install module   Click on Save & Close See below image for reference.

Difference between session.gc_maxlifetime and session.cookie_lifetime in Drupal setting.php

ini_set('session.gc_maxlifetime', 200000); This value is for the server. It is a settings for Session Garbage Collection. If the users last visit happened before 200000s then this session is eligible for garbage collection. Since it is GC, the session value may be discarded and not compulsory. If a GC action happens after the session was made eligible for the GC, it will be deleted. ini_set ( 'session.cookie_lifetime' , 2000000 ); This value is for the browser. This is the absolute maximum time till which a browser can keep this cookie active. A 0 value here means immediate or when the browser is closed. Source: 

Difference between webform vs entityform in Drupal 7

Drupal has a lot of modules aimed at helping site builders and users add forms to their sites. What follows is a rough comparison of 2 of them. If there are any I've missed, please add them. Webform Webform is a module designed to allow you to add custom forms to the front-end of your site. Each form is stored against a node, so you add new forms to your site as if you were adding content. It's useful for things like Survey websites or just where you want a couple of forms that differ from the standard contact form. Pros Webform has been around for a long time, its very well established and has a large number of modules that  integrate with it . Webform can make a wide variety of forms with lots of different elements available out of the box. Because Webforms are nodes, they inherit all the functionality that nodes have (scheduled publishing, cloning, access control, etc.). Webforms are lighter-weight and more scalable than entity-based forms. Can handle multiple-p...