By rooba on
Why drupal sites are very slow. when i checked with YSLOW it shows a performance rate of 40%. Thats poor compared to other CMS. Is there any other way to increase drupal sites particularly for drupal 6. please say the need.
Why drupal sites are very slow. when i checked with YSLOW it shows a performance rate of 40%. Thats poor compared to other CMS. Is there any other way to increase drupal sites particularly for drupal 6. please say the need.
Comments
Plz
Check with following instruction
Applying this to your site
1) Make fewer HTTP requests
Drupal even has the ability to compress CSS files (through stripping comments and whitespace).
JS aggregation has been added in Drupal 6. To my knowledge, not a single CMS/CMF ships with the ability to generate CSS sprites.
Each object on your web page requires a new connection from a visiting web browser to your web server.
By reducing the number of objects on your web page, you can drastically improve the page load times for your website.
Solution
1.Installed "javascript_aggregator" module and enabled the js and css aggregation in 'performance settings'.
2.The easiest way to reduce this significantly is to enable Drupal's CSS and JS aggregation. You can find these settings at admin/settings/performance in your Drupal site.
3.Add this line in your .htaccess
“FileETag none “
2) Add an Expires header
By setting the Expires header for files, you tell the browser that it's ok to cache them.
Set a far future Expires header on all objects on your web pages. This will tell visiting web browsers that they don't need to validate their cached copies with each page load,with the potential to greatly improve page load times for repeat visitors. The header can expire in a few days, or even months or years in the future.
You need to change this cached object before the cache expires, you will need to change the name of the object or the path to the object, causing web browsers to treat it as a new object.
Solution
1.Changing the future date for the Expires headers is easy enough: simply edit your .htaccess file. Your Apache server must also have mod_expires installed, this is available by default on most servers.
2.Enable 'LoadModule expires_module modules/mod_expires.so' in your apache configutation file.
3.Add the below lines on your .htaccess file.
ExpiresActive On
ExpiresByType text/html A1
ExpiresByType application/x-javascript "access plus 2 years"
ExpiresByType application/javascript "access plus 2 years"
ExpiresByType text/javascript "access plus 2 years"
ExpiresByType text/css "access plus 2 years"
ExpiresByType image/gif "access plus 2 years"
ExpiresByType image/jpeg "access plus 2 years"
ExpiresByType image/jpg "access plus 2 years"
ExpiresByType image/png "access plus 2 years"
3)GZIP components
Many modern browsers support Gzip compression. Through .htaccess, you can tell your server to serve gzipped HTML pages, JavaScript and CSS files (or any other text file, since images like JPG and PNG are compressed natively).
Drupal does not yet allow you to gzip CSS and JS files. By setting the Expires header for files, you tell the browser that it's ok to cache them.
Solution
1.Enable 'LoadModule deflate_module modules/mod_deflate.so' in your apache configutation file.
2.There are several Apache modules the provide content compression.
3.mod_deflate (included with Apache 2.x)
4.mod_gzip
5.An example for Apache 2.x: add the following lines to your .htaccess or httpd.conf file:
6.“AddOutputFilterByType DEFLATE text/css application/x-javascript”
7.Add the following lines on your .htaccess file
AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-javascript application/json
4)Put JS at the bottom
Drupal has this abstraction as well: drupal_add_js().
JS should be at the bottom, because browsers wait until everything in the tag has loaded.
Solution
1.Unfortunately, the default value for the $scope parameter of drupal_add_js() is bad: 'header'. If we simply make 'footer' the default, we're good.
2.Open the page.tpl.php file in your favorite editor. Find this line at the top of the file:
print $scriptsCut it away from there, and put it just before this line at the bottom:
print $scriptsprint $closure3. Add the following line in your page.tpl.php
where in the page.tpl do we
where in the page.tpl do we put
After Enabling Module Use Code Before Scripts
After enabling the javascript aggregator module. put that piece of code in your page.tpl.php file just before
print $scripts;thanks for this
this is great info to help me augment my .htaccess file.
btw- I don't think you need to add the js_aggregator text anymore in d6
Chris
http://SocialNicheGuru.com
Delivering inSITE(TM), we empower you to deliver the right product and the right message to the right NICHE at the right time across all product, marketing, and sales channels.
subscribing
subscribing
Drupal Web Designers Surrey South East England www.lightflows.co.uk
subscribing.
subscribing.
-Blake
www.BlakeSenftner.com www.3D-Avatar-Store.com
subscribing.
subscribing.
subscribing.
subscribing.
A bit cleaner
Found some information for setting this code up a bit cleaner. Though I'm still learning about best practices on this stuff.
Following!
Following!