GEO IP Locations in: France IP Location United Kingdom IP Location Germany IP Location Italy IP Location Netherlands IP Location Spain IP Location United States of America IP Location Canada IP Location
Home » CMSs » Optimizing Magento hosting and Boosting performance

Optimizing Magento hosting and Boosting performance

magento logo

Optimizing Magento: The Best Gets Better

E-Commerce is the new wave and many technologies are adapting to this ever-growing segment of the economy. One of these is the Magento script, a powerful open-source platform that uses MySQL databases and Zend PHP. It has a modular architecture that lends it flexibility and scalability, thus turning it into a favorite among users who wish to have a greater level of control.

Despite its power, Magento is very intuitive — product catalogs can be created and managed easily. Multiple images, reviews, and wishlists are also possible along with filters, advanced customer service, promo tool, Google Analytics integration, almost 2,000 extensions, and a lot more. Despite all these, Magento still has room for improvement by way of optimization.

Boosting Magento Performance

Before working on the backend configuration, always remember to check the existing performance of your Magento site. This can be done through online tools. This guide will be using the following server infrastructure:

  • Webserver — EC2 (c3.large): 1 Nos
  • Server — RDS DB (c1.medium)
  • 1 Amazon S3 bucket
  • Cloudfront
  • SMPT — SES

The following techniques can boost your Magento performance:

1. Using cloudfront CDN to distribute images under the cache folder.

This step will require you to form all the cloudfront services associated with a newly-created S3 bucket. You will also have to create a new CNAME in order to allow accessing of the CDN URL, such as mymedia.website.com. A cronjob will also have to be set up under the directory “media/catalog/product/cache” as well as within “/home/youspred/public_html/medi/avatar/”. Only the cache folder will need to be moved to CDN, since all the files that will be displayed come from that folder.

Type the S3 command that is set for mirroring the cache folder every 10 minutes interval. This is also to be done for the folder “avatar”, using the script:

/usr/bin/s3cmd sync –recursive setalc –acl-public –recursive –add-header=”Expires:`date -u+ ”%a, %d %b %Y %H:%M:%S GMT” –date “+4 years”`” –add-header=’Cache-Control:max-age=31536000, public’’’/home/domain/public_html/media/catalog/product/cache/ s3://yourdomain.com/catalog/product/cache

2. Install the Varnish cache, then configure it.

This will be a major brake point of the site optimization. Simply install Varnish using the Terminal.

Take note of the following configuration files for Varnish:
/etc/varnish/default.vcl (cache control)
/etc/sysconfig/varnish (server config)

First, configure Varnish for the environment by switching Apache to listen to port 8000. Make sure that the site will display correctly while on port 8000, and check that this does not allow access by the public.

3. Update the Varnish configuration settings.

The configuration file (/etc/sysconfig/varnish) will have to be updated and the following settings changed:

VARNISH_LISTEN_ADDRESS=0.0.0.0
VARNISH_LISTEN_PORT=80

4. Restart both Varnish and Apache/Nginx.

5. Install Turpentine Magento.

Turpentine Magento is a plugin that designs the ACL list of Varnish — the list that calls which URLs are to be cached or not. Once this plugin is installed on Magento, “Turpentine” will be a menu available under the system’s main menu.

There will be two options under this: Varnish options and Cache options. The first one provides info on the server, admin port, and the secret key (which can be found in the directory /etc/varnish/secret). The second one will provide information on the back end as well as adjusting the ACL and timed out values.

Whenever Varnish options are changed, a file called “default.vcl” will be created under the var folder. All you need to do is to create a symbolic link from the original config location to this file so it can allow Varnish to use the latest Turpentine settings.

6. Install OnePica ImageCDN.

This plugin from Magento connect will allow you to speed up store loading. All cached images are automatically uploaded to Amazon S3, and then shared through the CDN URL. Make sure to enable the Image CD plugin through settings — you will have to provide the bucket name, as well as the access and secret keys. The Current Adapter should be set to Amazon S3/CDN.

7. Install APC cache.

This is easily installed through the Terminal. The config file can be found under “/etc/php.d/apc.ini”. The PHP file apc.php (from the source code) can be edited and used to monitor the caching stats through a browser.

8. Optimize Apache.

Check the httpd.comf file and update (or add) the following:

  • KeepAlive On
  • KeepAliveTimeout 2
  • ServerTokens Prod
  • ServerSignature Off
  • TraceEnable off
  • Timeout 60
  • Php_admin_value open_basedir none

Set the best MPM and Worker properties for the Apache main configuration file. The formula is:

MaxClients: (TotalMem-CriticalServicesMem)/Size per process

You can adapt a script that will calculate the size of each Apache process.

After these, check how fast the responses are being received. Check as well the load status, through the top command. You should also be able to check the rate of worker process creation.

For additional privacy, you will also need to secure the public writable folders to prevent them from being hacked. Magento designates the media and var files as those writable by the Web server. A script can be made so that any PHP files in these folders are not executed, as these folders are common insertion points of a hacker’s malicious code.

After trying these out, check the site status again to see the results of optimization. You would now have a snappier and more responsive Magento setup!

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*