Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 2
Improve Site Speed Performance (Alpha Release)
 
aquiss
Member
 
Total Posts:  54
Joined:  2008-05-03
United Kingdom
 

Like many, i’m looking for ways to make my site run faster as load times can be a little poor at times, which shamefully lets a great product down. Therefore I am trying to get a collective thread together (rather than dozens of posts) to see if we can all work on ways to help each other. As ideas come forward, and prove useable, I will add them here for quick reference for all.

The following ideas I have deployed, which seem to have helped me a great deal.

1) Magento Caching.

Goto Magento Admin -> System -> Cache Management
- Tick the following items:
-- Configuration
-- Layouts
-- Block HTML output
-- Translations

-Untick the following items: (if ticked they seem to have a negative impact atm)
-- Collections Data
-- EAV types and attributes
-- Web Services Configuration

2) Remove Home Page Elements

Goto Magento Admin -> CMS -> Manage Pages -> Home -> Custom Design
- The “Layout Update XML” box is pre-populated with functions and calls, all of which can be removed without any apparent problems, according to a number of forums comments.

3) MySQL Cache Size

Configure or ask your hosting company to switch on or tweak to ensure you have enough mysql cache. I have found the following to be a good reasonable size:
- query_cache_size=64M

 
Magento Community Magento Community
Magento Community
Magento Community
 
Discovery
Enthusiast
 
Total Posts:  767
Joined:  2007-12-29
 

Some tips:

Front Page

Have no products that require the database to kick into action. A secondary ‘front page’ can be built with the required featured products and the generated html copied into the served homepage. In that way the homepage loads quickly with javascripts and whatnot. This idea goes back to the splash screen of 1997.

Category Pages

Remove the show all products button on the toolbar. This spares the worst, most slow pages.
Remove the ‘from as low as’ prices. This requires hacking the code.

Cache

There is a standard set of instructions for using apc and people have reported good results with that. Can you explain why/where the EAV cache and collections cache, what makes them slower? Some numbers help, do you use YSlow?

Product Pages

It is possible to run a script on the image directory and scale down all the images to a manageable size. Doing so makes sure that any hires digicam pics get made manageable.

 
Magento Community Magento Community
Magento Community
Magento Community
 
webdoe
Jr. Member
 
Total Posts:  23
Joined:  2008-07-18
Portugal
 

hi, first i think that is a great idea to after several months of discussion of how to improve Magento performance, that we can all share our experiences, and reune several ideas in one single thread.

So i will also share information that can improve Magento speed:

1 - Follow the Magento advices regarding performance:

- Performance is Key! - Notes on Magento’s Performance
http://www.magentocommerce.com/blog/comments/performance-is-key-notes-on-magentos-performance/

- Optimising Your Web Stack Performance for Magento
http://www.magentocommerce.com/wiki/groups/168/optimising_your_web_stack_performance_for_magento

Any ideas or tweaks to optimize MySQL config, in vps or servers with more that 1Gb ram (i already have query cache turn to 64)??

 
Magento Community Magento Community
Magento Community
Magento Community
 
aquiss
Member
 
Total Posts:  54
Joined:  2008-05-03
United Kingdom
 

4) Enabling Gzipping (Part 1)

Find the .htaccess file located in the root of your store to enable HTML compressing.

Find

# php_flag zlib.output_compression on

Change to

php_flag zlib.output_compression on

5) Enabling Gzipping (Part 2)

Introduce a new Apache AddHandler to compress CSS files on the fly. I came across this technique eleswhere on the Internet, but my site pages are now flying as a result.

- Create a file called “gzip-css.php” and add/save the following into it:

<?php
ob_start 
("ob_gzhandler");
header("Content-type: text/css; charset: UTF-8");
header("Cache-Control: must-revalidate");
$offset 60 60 ;
$ExpStr "Expires: " .
gmdate("D, d M Y H:i:s",
time() + $offset) . " GMT";
header($ExpStr);
?>

- Create a file called “.htaccess” and add/save the following into it:

AddHandler application/x-httpd-php .css
php_value auto_prepend_file gzip
-css.php

- Locate your template CSS directory and upload both files that you created to it.

cd skin/frontend/default/YOUR_TEMPLATE/css/
 
Magento Community Magento Community
Magento Community
Magento Community
 
lotusseedsD
Mentor
 
Avatar
Total Posts:  1144
Joined:  2007-08-31
 

thanks for the tips. It disables my style sheets though :(

I wonder what steps I should do in the cpanel?

 
Magento Community Magento Community
Magento Community
Magento Community
 
aquiss
Member
 
Total Posts:  54
Joined:  2008-05-03
United Kingdom
 
chinesedream - 01 December 2008 01:27 AM

thanks for the tips. It disables my style sheets though :(

Which tip/step?

 
Magento Community Magento Community
Magento Community
Magento Community
 
lotusseedsD
Mentor
 
Avatar
Total Posts:  1144
Joined:  2007-08-31
 

I follow every steps in your message but as soon as I uploaded the two files in my CSS folder, all style sheets are gone.

The site is currently located at Hostgator server, in the control panel admin, it has an ‘add Apache Handlers’ , I tired adding this when I see the two files crippled my style sheets.

Handler
application/x-httpd-php5 .css

 
Magento Community Magento Community
Magento Community
Magento Community
 
lotusseedsD
Mentor
 
Avatar
Total Posts:  1144
Joined:  2007-08-31
 

I followed every step in your message but as soon as I uploaded the two files in my CSS folder, all style sheets are gone.

The site is currently located at Hostgator server, in the control panel admin, it has an ‘add Apache Handlers’ , I tired adding this when I see the two files crippled my style sheets.

Handler extensions
application/x-httpd-php5 .css

still no use.

 
Magento Community Magento Community
Magento Community
Magento Community
 
aquiss
Member
 
Total Posts:  54
Joined:  2008-05-03
United Kingdom
 

Interesting chinesedream.

I wonder, are you using any other method that maybe conflicting....ie: I have seen people mention minify or something, does this also compress CSS files?...ie: me thinking compressed files being compressed again, maybe causing you issue.

I personally deployed this method as it’s a simple drop method which would be useful for many.

 
Magento Community Magento Community
Magento Community
Magento Community
 
aquiss
Member
 
Total Posts:  54
Joined:  2008-05-03
United Kingdom
 

The other thing you maybe having issues with is a conflcit between “zlib compression (Step 4) “ and “ob_gzhandler (Step 5)”.

Try commenting out Step 4 again, and see what happens.

 
Magento Community Magento Community
Magento Community
Magento Community
 
lotusseedsD
Mentor
 
Avatar
Total Posts:  1144
Joined:  2007-08-31
 

No, I have not implementing other method as this is a temp server therefor I don’t want to mess around, but yours is very easy so I thought I am giving it a try. 

Last time I tried to add handler for .shtml, was also encountered something similar, I think this has something to do with how hostgator server using the handler. Anyhow, I sent a ticket to hostgator support, hopefully they can help me figure out.

cheers!

 
Magento Community Magento Community
Magento Community
Magento Community
 
aquiss
Member
 
Total Posts:  54
Joined:  2008-05-03
United Kingdom
 

Just a daft question. I can see you slightly altered the code

From

AddHandler application/x-httpd-php .css

To

AddHandler application/x-httpd-php5 .css

Even though i am using PHP5, the first method (which searching on the net, most go for) worked for me. I presume you tried both methods?

 
Magento Community Magento Community
Magento Community
Magento Community
 
aquiss
Member
 
Total Posts:  54
Joined:  2008-05-03
United Kingdom
 

Chinesedream,

Your issue maybe related to cpanel, and the way it handles it. Take a look at http://forums.digitalpoint.com/showthread.php?t=7584 where people report same issus at both Hostgator and GoDaddy. Someone has offered a fix, which may kick your problem into life.

 
Magento Community Magento Community
Magento Community
Magento Community
 
lotusseedsD
Mentor
 
Avatar
Total Posts:  1144
Joined:  2007-08-31
 

quiss,
Thanks for the link, I will check it out. Yes, I tried both.

I did some googling and found this:
http://www.zen-cart.com/forum/showthread.php?s=084b763ed4020febe3cdab39de8aa8c9&t;=105264&page;=2

#14 has some good tips.

quote:
a. Create a .htaccess file with “AddType x-mapp-php5 .js .css”. This tells the host to process any php it see’s in the CSS and JS files.

Will wait for hostgator support first before I waste my time on either method smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
aquiss
Member
 
Total Posts:  54
Joined:  2008-05-03
United Kingdom
 

Hi chinesedream,

I won’t rub it in, but i would say our pages are loading 3-4 times quicker now, so would be nice to see if you find a solution. In Opera and Chrome...almost instant!

Interesting link, i wonder if we can get the JS files compressed in a similar way without problems, though some browsers might have issues.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Discovery
Enthusiast
 
Total Posts:  767
Joined:  2007-12-29
 

@quiss

Didn’t work for me either! I am on a virtual host so no cpanel to get in the way.

I chmod 777’d the files but things were weirdly broken, as if only one of the stylesheets was broken.

Is it possible to serve up a pre-gzipped css file? What happens if one just gzips the file and loads a styles.css.gz - is that doable?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 2