Speed up Magento with simple config tweaks

Web hosting, SEO, etc... related
Post Reply
User avatar
Nipuna
Moderator
Moderator
Posts: 2729
Joined: Mon Jan 04, 2010 8:02 pm
Location: Deraniyagala,SRI LANKA

Speed up Magento with simple config tweaks

Post by Nipuna » Fri Nov 11, 2011 6:12 pm

Optimising PHP

The bottleneck here is the memory limit for PHP scripts. Older PHP versions came with a fairly low memory limit of 8 or 16 Megabyte. Edit your php.ini file and look for the following line:

Code: Select all

memory_limit = 8M
Try setting this to 128M if it is not already set. If you don’t have access to the php.ini (which is likely on shared hosting) you can also try setting the parameter from within a PHP file:

Code: Select all

ini_set('memory_limit', '128M');
A third option is to change it from the .htaccess file in your Magento directory. Add the following line:

Code: Select all

php_value memory_limit 128M

Optimising MySQL

Very big potential for speed gains offers MySQL. Since database applications like Magento often use the same SQL queries over and over again, MySQL offers a query cache that is set with the have_query_cache and query_cache_size parameters. The cache is disabled by default, but enabling can result in massive speed improvements. There is already an excellent article at Crucial Web Hosting about the importance of query caching and how to enable it, so I’ll skip the details here and recommend you check it out.

Optimising Apache

Magento offers an option to enable ZIP (Deflate) compression for Apache. You can imagine that a big part of a typical Magento page (as the user can see it) actually consists of text: HTML, CSS and Javascript. Text files offer excellent compression ratios, so it only makes sense to run Apache with compression enabled to reduce the amount of data that needs to be transferred to the user. You can enable it from Magento’s .htaccess file. Look for the following section:

Code: Select all

<IfModule mod_deflate.c>

############################################
## enable apache served files compression
## http://developer.yahoo.com/performance/rules.html#gzip

    # Insert filter on all content
    ###SetOutputFilter DEFLATE
    # Insert filter on selected content types only
    #AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript

    # Netscape 4.x has some problems...
    #BrowserMatch ^Mozilla/4 gzip-only-text/html

    # Netscape 4.06-4.08 have some more problems
    #BrowserMatch ^Mozilla/4\.0[678] no-gzip

    # MSIE masquerades as Netscape, but it is fine
    #BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    # Don't compress images
    #SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

    # Make sure proxies don't deliver the wrong content
    #Header append Vary User-Agent env=!dont-vary

</IfModule>
Uncomment the important lines so it looks like this:

Code: Select all

<IfModule mod_deflate.c>

############################################
## enable apache served files compression
## http://developer.yahoo.com/performance/rules.html#gzip

    # Insert filter on all content
    SetOutputFilter DEFLATE
    # Insert filter on selected content types only
    #AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript

    # Netscape 4.x has some problems...
    BrowserMatch ^Mozilla/4 gzip-only-text/html

    # Netscape 4.06-4.08 have some more problems
    BrowserMatch ^Mozilla/4\.0[678] no-gzip

    # MSIE masquerades as Netscape, but it is fine
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    # Don't compress images
    SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

    # Make sure proxies don't deliver the wrong content
    Header append Vary User-Agent env=!dont-vary

</IfModule>

Optimising Magento

Last but not least there is potential to improve Magento itself, by enabling the built-in caches. Under System > Cache Management you should make sure that all caches are enabled. Usually caches should be disabled completely during development, but on a production server it is essential to enable all of them. Server load would otherwise increase significantly.
User avatar
herlmysa
Posts: 1
Joined: Tue Mar 20, 2012 1:18 pm

Re: Speed up Magento with simple config tweaks

Post by herlmysa » Wed Mar 21, 2012 3:52 pm

Is Netscape browser still a viable option with all the new browsers out there? Lots of people talk about Chrome and Safari and Firefox. What happened to Netscape? They used to be at or near the top of the list of good browsers, and it just seems like they've dropped off the face of the earth.
____________________________
yahoo keyword tool ~ overture ~ traffic estimator ~ adwords traffic estimator
Post Reply

Return to “Web Related”