Magento Forum - UK Magento Forum (Unofficial)

An unofficial but dedicated Magento Forum for Magento Users, Designers and Developers

9 tips for speeding up your Magento store

A forum for Magento users to discuss tips, issues etc with regards to actually using the Magento front and back end systems.

9 tips for speeding up your Magento store

Postby aheadWorks » Thu Jul 26, 2012 12:49 pm

The research has been conducted by aheadWorks, leading provider of Magento extensions and themes.

According to the recent research, 64% of dissatisfied online shoppers said they were less likely to visit a slow retailer again, 62% were less likely to purchase from the site again and 48% would purchase from a competitor.

Such statistics always makes developers puzzle – from one hand, the website owner wants the application to be multifunctional and universal, from the other – it shouldn’t be slow. And the problem is always to make a solid extension work as fast as possible.

Performance optimization is a good way out in such situation. Optimizing a website, you should consider providing two factors:

1. acceptable pages loading speed;
2. acceptable pages loading speed when N people use the same application simultaneously.[/list]

The basic advice regarding response times that has been about the same for forty years:

0.1 second is about the limit for having the user feel that the system is reacting instantaneously, meaning that no special feedback is necessary except to display the result.

1.0 second is about the limit for the user's flow of thought to stay uninterrupted, even though the user will notice the delay. Normally, no special feedback is necessary during delays of more than 0.1 but less than 1.0 second, but the user does lose the feeling of operating directly on the data.

10 seconds is about the limit for keeping the user's attention focused on the dialogue. For longer delays, users will want to perform other tasks while waiting for the computer to finish, so they should be given feedback indicating when the computer expects to be done. Feedback during the delay is especially important if the response time is likely to be highly variable, since users will then not know what to expect.”

Considering all this information, let’s try to provide the pages loading speed within 0.1 – 1 second with the load of 20 competitive requests by optimizing Magento performance.

What we have

Server:

CPU: Intel® Xeon® CPU X3320 @ 2.50GHz
Memory: 4GB
HDD: 1HDD, non-RAID

Magento CE 1.7.0.0

What we should do

1. Select a tool to measure Magento website performance


http_load
http_load runs multiple http fetches in parallel, to test the throughput of a web server. It runs in a single process, so it doesn’t bog down the machine. It can be configured to do https fetches as well.

Apache HTTP server benchmarking tool
It is a tool for benchmarking your Apache Hypertext Transfer Protocol (HTTP) server. It is designed to give you an impression of how your current Apache installation performs. This especially shows you how many requests per second your Apache installation is capable of serving.

Siege
Siege is an http load testing and benchmarking utility. It was designed to let web developers measure their code under duress, to see how it will stand up to load on the internet. Siege supports basic authentication, cookies, HTTP and HTTPS protocols. It lets its user hit a web server with a configurable number of simulated web browsers.

Apache JMeter
Apache JMeter is open source software, a 100% pure Java desktop application designed to load test functional behavior and measure performance. It may be used to test performance both on static and dynamic resources. Apache JMeter can be used to simulate a heavy load on a server, network or object to test its strength or to analyze overall performance under different load types. You can use it to make a graphical analysis of performance or to test your server/script/object behavior under heavy concurrent load.

2. Select OS for server

Here you can select whatever you like or what your hosting provider offers:

BSD: FreeBSD, OpenSD, etc.
Debian: Debian, Ubuntu
Gentoo, Slackware
RHEL

3. Select webserver with php

Apache + mod_php
It is the most popular application environment
Nginx + Apache + mod_php
Nginx as a proxy before Apache doesn’t influence the pages generation speed but gives the increase of loading speed and economy of system resources
Nginx + php-fpm
This variant is less popular as none of the web hosting control panels like cPanel work flawless with Nginx. But my tests showed that exactly this environment was 30% faster than Apache

Image
Webserver with php comparison

To avoid many serious mistakes in correct webserver configuration, be careful with Nginx settings and don’t forget to:

1. Forbid access to Magento catalogs
location/app/{deny all;}
location ~ ?.ht {deny all;}
location /.svn/ {deny all;}

2.Disable logging where it is not necessary
location/media/catalog/{
access_log off;
}
location /js/ {
access_log off;
}

3.Turn on compression for js and css
location/media/js/{
gzip on;
gzip_min_length 1000;
gzip_disable “MSIE[1-6]\.”;
expires 5d;
access_log off;
}

4. Enlarge the FastCGI response time
fastcgi_read_timeout

4. Select php 5.3.* or php 5.4.*

There are 2 obvious advantages of moving to php 5.4.*:

1. it is faster;
2. later you can use new language constructions.

But don’t forget about the disadvantage you can face:

problems when migrating to new version

The tests showed the following results:

Image
PHP 5.3 and 5.4 Comparison



5. Select opcode cacher

Open Source

APC
Xcache
eAccelerator

Propletary

IonCube
Zend Server

As you can see below, the opcode cacher usage gives the speed increase of about 70%:

Image


6. Change the number of child-processes in PHP-FPM depending on your hardware

7. Move users sessions to memcached

8. Move cache to APC or memcached

9. Set the higher values in the settings of php - realpath_cache_size and realpath_cache_ttl

Let’s sum up what we’ve got after all these steps on optimization:


Image
Before and After Comparison

As you can see, server environment optimization resulted in reducing rendering speed in 3.5 times as well as decreasing the price of the required hardware.
Image

Questions and answers platform for Magento merchants

100+ Free & paid Magento extensions & Themes
User avatar
aheadWorks
 
Posts: 17
Joined: Thu Jun 30, 2011 10:37 am


Re: 9 tips for speeding up your Magento store

Postby Romanovich » Sun Oct 14, 2012 9:57 am

Hey Great advice. Think im gonna try some of them out :)
Romanovich
 
Posts: 4
Joined: Fri Mar 16, 2012 10:54 am
Location: Denmark

Re: 9 tips for speeding up your Magento store

Postby aheadWorks » Thu Feb 21, 2013 10:10 am

Michael Zhalevich, our Lead Developer, set a goal to provide the pages loading speed within 0.1 – 1 second with the load of 20 competitive requests. He managed to do this by optimizing Magento performance and, moreover, explained how.

Basing on the information provided, we created a Magento optimization PDF guide which is in <b>free access</b> for all our blog readers.

Image

From this document, you can:

• learn how to optimize Magento performance without any code modifications
• find the comparison of webservers
• discover the reasons of moving to PHP 5.4*
Image

Questions and answers platform for Magento merchants

100+ Free & paid Magento extensions & Themes
User avatar
aheadWorks
 
Posts: 17
Joined: Thu Jun 30, 2011 10:37 am

Re: 9 tips for speeding up your Magento store

Postby goivvy » Thu Oct 12, 2017 5:57 pm

Thanks AW for this article. Some optimization tips still hold today.

I have 3 things to add to your list, they hold for Magento 1 and Magento 2:

1. Do 3rd party extension audit. In most cases a custom plugin is what slows Magento down. Disable them one by one and benchmark site speed.

2. Profile Magento. Enable default profiler and study the trace. See what function calls or .phtml files take most time and optimize them.

3. Throw more CPU and RAM. This might not resolve the root cause but will give you performance boost immediately. And don't forget about Full Page Cache.


I have some more tips if you are interested..
User avatar
goivvy
 
Posts: 1
Joined: Thu Oct 12, 2017 5:19 pm


Return to Magento Users

cron