Technical points related to Magento Speed Optimization considered by us while optimizing Magento for Speed:
In our series of Magento Speed Optimization blog, we will discuss on configuration, template, server points that will helps speed up your Magento site.
Speeding up Magento sites takes a long list to perform. You can go through the following tips for optimization.
A) Magento Template Related:
- Use of image sprites to reduce number of request
- Optimize images for size
- Remove unwanted css code and minify or reduce your css code
- Remove unwanted js code and minify or reduce your js code
- Specify Image Dimensions
- Use some webtest tool to analyse number of requests and other html related data for download time
B) Magento Admin Configuration:
- Make sure enable Flat Catalog
- Make sure enable Compiler Mode
- Merge css and js (Used Fooman Speedster Module)
- Delete additional stores if not in use
- As per requirement, Log should be minimized according to number of days
- Disable Log Settings in magento
- Remove Admin notification module
- Improve magento database Log Cleaning via admin
C) Server Environment:
- Enable Gzip compression in .htaccess
- Use nginx
- Use of APC
- Use query cache
- Use Apache mod_expires
- Use a Content Delivery Network (CDN)
- Enable Apache KeepAlives
- Load cache on RAM if memory permits
- Reduce hard disc file reads and try reads from RAM as this is faster
- Upgrade PHP version to above 5.3
- Session to be on RAM
- Make sure cron is run so as to clean logs stored in data base
- Your cron file should be run in specific hours
- Disable the PHP open_basedir directive
- Eliminate directory structure scans for .htaccess files
D) Additional Tips:
- Use FPC.
- Remove all modules not in use by removing there .xml file
- If possible, use Ajax
- Don’t use CMS blocks
- Do not use many various external sources.
- Abbreviate number of searchable attributes as these result in columns in flat catalog table and will slow down your search.
- Use of Solr search. It already exists with EE version but it can be installed with CE.
- Minimize customer group as suggested in comment.
- Make sure your css code check through W3 validator because errors slow down the browser.
- Use of getChildHtml (‘childName’) is recommended as this will cache block against direct use of block code in .phtml file.
- Remove unwanted blocks. (Number of blocks are executed that are not used or displayed.)
- If using FPC make sure your containers are cached and repeat request for container is delivered via cache. Improper placeholder definition results in container cache not being used but each time new container content getting generated.
- Analyze page blocks and variables and if possible add those variables/blocks to cache.
- Remove directory structure scans for .htaccess files.
- Use Google page speed firefox extension like Yslow.
- If on EE make sure that most pages are loaded without application initialization. If one container needs application initialization its going to effect execution speed.
1] Don’t use CMS block
It takes more time than Magento block.
2] If possible, Use FPC
Q. What is a FPC (Full page cache)?
A. Full Page Cache is a very important technique which allows us copy content from web by storing the data to a temporary container to help reduce memory.
Q. Which pages are cached by Full Page Cache?
A. There are three types of pages which can be cached by Full Page Cache.
Category View pages
Product View Pages
“By using Full page cache, improve your Magento performance, optimization, and page speeds. “
3] Remove unwanted blocks. (Number of blocks are executed that are not used or displayed)
b) Unwanted code is executed and decrease the speed of magento website. Hence remove unwanted blocks from specific page.
Q. How to remove block from specific handle through xml file?
<remove name=” .compare.sidebar” /> <–product compare–>
4] Use of FPC
If using FPC make sure your containers are cached and repeat request for container is delivered via cache. Improper placeholder definition results in container cache not being used but each time new container content getting generated.
Magento Enterprise consists of number of useful numbers of features. In which, one is very important it may increase your store performance. It is a full page cache. It present in Magento Admin
System → Configuration → Cache Management
Full Page Cache is more useful mechanism that permits copy data by storing the page content to a temporary container to help reduce memory and database load.
Full page cahe is a way for Magento to load content for a user without having to fully initialize the application.
Make sure your containers are cached if we using Full Page Cache and check repeat request for container is delivered via cache. Containers create from placeholders. Hence, incorrect placeholder results in container cache not used but each time new container content getting generated then create unwanted data or cache and decrease the magento website speed.
How to check your container cached or not? (fully initialize application or not)
Each container consists of two important methods applyWithoutApp and applyInApp
5] Use of getChildHtml (‘childName’)
Use of getChildHtml (‘childName’) is recommended as this will cache block against direct use of block code in .phtml file:
getChildHtml function is used to get block code. We can not imagine that the block is defined in the layout file that it will be rendered.
Either the toHtml() needs to explicitly render the child blocks, or the phtml assigned to the block must render the child blocks via the getChildHtml() function.
You will want to be conscious of is the $useCache parameter.
If the $useCache parameter is true, Magento will check this internal property for an
existing generated output block before calling the toHtml method on the child block.
Class Name: Mage_Core_Block_Abstract
6] Check CSS code through W3 validator
Make sure your CSS code check through w3 validator because errors down the browser
Why you should validate your css code? CSS validation express that there are number of points why we should validate our CSS code.
1] It helps future consistency: You may be able to create a web page that takes to work on your favourite browser, your page may contain CSS errors that do not show up with that browser due to an existing errors.
2] Search Engine Visibility: When there are errors in a web page, browsers typically try to good in different ways. One way to improve your Web site’s Search Engine results is to validate your code.
Important URL for validate CSS code: http://www.css-validator.org/
7] Make your output W3C compliant
Make your website output compliant then validating code. One way to improve your website search engine results is to validate your code. W3C is an international consortium. W3C stands for World Wide Web Consortium (W3C).
W3C Validator Tool: http://www.w3.org/QA/Tools/#validators
Important URL: http://www.dummies.com/how-to/content/make-your-web-site-w3ccompliant-for-better-search-.html
8] Do not use many various external sources
Do not use many various external sources (for images (twitter/facebook)) because it takes extra time and you create an extra dependancy on third party server for your site to load properly. Hence it takes more time to load your pages and decrease the speed performance for Magento website.
9] Use of Solr search
It already exists with EE version but it can be installed with CE
10] Use Google page speed firefox plugin/addon like Yslow
Yslow is a firefox plugin. It is used to check page speed. YSlow explores web pages and suggests ways to improve their performance based on a set of rules for high performance web pages.
Yslow addon install from following URL: https://addons.mozilla.org/en-US/firefox/addon/yslow/
Yslow website URL: http://yslow.org/
11] Abbreviate number of searchable attributes as these result in columns in flat catalog table and will slow down your search.
Only those attributes frontend properties set to ‘YES’ that you are actually to use.
Set all other to ‘NO’. Also do not use in quick search, advanced search etc.
Go to Magento Admin Panel:
Catalog → Attributes → Manage Attributes → Frontend Properties
1] Enable Gzip Compression in .htaccess:
a) Shrinkage of our Html and css code with Gzip, it saves file size.
b) This means that, it takes less time to load your pages. This is important for optimization.
c) If Gzip enabled on your server then it receives the Gzip file which is very small file it takes less time.
d) How to set Gzip?
There are so many ways to set Gzip setting depends on our server.
There are so many ways of making Magneto run faster. The best one is to enable GZip
compression by changing in .htaccess file.
2] Use nginx:
nginx is a free server. When we used nginx server then you could speed up magento scripts. Therefore, we used nginx server and speed up our Magento site. It is used for memory.
3] Use Magento CDN:
CDN : Content Delivery Network
Que: What is a CDN?
Ans: CDN is a network of server which transfers content from site to the user.
Que: Why used CDN?
4] Use of APC:
APC: Alternative PHP cache
Que: What is a APC?
Ans: APC is an opcode cache for PHP. It is a structure for using cache and optimizing PHP code.
This is another thing for Magento Speed Optimization tip is use Query Cache. Improving magento speed is more important for Magento Developers.
There are two types of caching which you can use to optimize the magento site.
a) Disk Cache
b) Database Cache
Benefit of Query cache: The database is fast as compared to disk so it is useful and important for increasing the performance of Magento.
Important URL: http://www.crucialwebhost.com/kb/improving-magento-performance-with-mysql-query-cache/
6] Enable KeepAlive:
When browser needs to show a webpage it must first get the HTML file. After that, it will check and read the HTML file request more files related to css and images etc. When KeepAlive is not enabled this can add a lots of time to load a webpage.
Important URL: http://www.feedthebot.com/pagespeed/keep-alive.html
Magento Admin Configuration
1] Enable Flat Catalog
Enable Flat Catalog Category and Product:
There are following two options which you can enable or disable in the magento backend.
a) Flat Catalog Category
b) Flat Catalog Product
Why Enable Flat Catalog?
In Magento, all product and category connected data is stored in the database. The database consists of collection of tables. There are number of tables. When magento found number of tables for different data that’s scattered, it can becomes slow. Hence, Enable Flat Catalog Category and Product which reducing the response time.
2] Enable Compiler Mode
Go to Magento admin: System > Tools > Compilation
3] Merging css and js (Used Fooman Speedster Module)
1) How to reduce HTTP requests for your site?
site makes to the server and will have a nice effect on speed.
Go to Magento admin : System > Configuration > Developer > JS settings and select
“Yes” for “Merge JS Files”.
Enable CSS file merging:
Combining all CSS files into one will reduce load time and increase speed.
You can combine all CSS files into one via the Magento admin:
Go to Magento admin : System > Configuration > Developer > CSS settings and select
“Yes” for “Merge CSS Files”.
You can also using an extensions to do this like the Fooman Speedster Extension, which works
best for you.
URL : Fooman Speedster
4] Disable Log Settings in magento.
Q How to disable the logs settings?
Go to Magento Admin: The settings are under System > Configuration >
Developer > Log Settings.
5] Remove Admin notification module
Q How to remove admin-notification module?
There are two ways to remove admin-notification module.
A) Go to Magento Admin: System → Configuration → Advanced → Advanced → Disable
After that, Simply set Mage_AdminNotification to Disable. Please check following screenshot.
B) We can off the module from the modules XML file. Check following screenshot.
6] Remove all modules not in use by removing there .xml file
We can disable the module from there modules XML file. Check following screenshot.
7] Improve magento database Log Cleaning via admin
1] In Magento Admin Panel , Go to System → Configuration
2] In the left Menu Click Advanced → System
3] Log Cleaning, change “Enable Log Cleaning” to Yes and configure time.
4] Click Save Config.
In our series of Magento Speed Optimization blog, we will discuss on configuration,template,server points that will helps speed up your Magento site.speed is important for your site.
Speeding up Magento sites takes a long list to perform.You can go through the following tips for optimization.
A] Magento Template Related:
1] Use image sprites to reduce number of request and use of image sprites:
Q) What is a sprite?
A) A sprite consists of multiple images into a single image.
Q) Why use sprite image?
A) Using sprites should decrease a number of HTTP requests made to your site and improve the site speed.
2] Optimize images for size:
Decrease the load times of pages by loading appropriately sized images.
3] Remove unwanted code and minify or reduce your css code:
Clean-css and minify css is a fast and efficient.It helps speed up magento site.
Why specify image dimension : Specifying the height and width to your images can really help your webpages load faster and look better while they are loading. Hence, Specifying a width and height for all images and imporove the speed of magento website.
How to apply lazyloader for images: Important URL:http://jquery.eisbehr.de/lazy/
6] Use some webtest tool to analyse number of requests and other html related data for download time:
Test your site with some following tools:
You can test your site using following available tools
Blog Coming Soon!!!!
In our series of Magento Speed Optimization blog, we will discuss on configuration points that will helps speed up your Magento site.
1] Enable Flat Categories and Products:
There are following two options which you can enable or disable in the Magento backend.
a) Flat Catalog Category
b) Flat Catalog Product
It is recommended that you enable this feature and here is why.
All the category and product related information is saved in the database in Magento. The database consists of a collection of tables. There are numbers of tables.
So when Magento has to search multiple tables for information that’s spread out, it can become slow.
Therefore, enabling Use Flat Catalog Category and Use Flat Catalog Product will take the information that’s spread out and flatten it into one table usually reducing the response time.
2] Enable Magento Cache:
Magento consists of internal and external cache.
a) Internal Cache:
Go to Magento admin: System > Cache Management
Go to Magento admin: System > Configuration > ADVANCED > System
3] Combine CSS and JS in magento:
Go to magento admin : System > Configuration > ADVANCED > Developer
4] Magento Compilation :
Go to magento admin : System > Tools > Compilation
When your site get high traffic, this cause a big trouble.
In all cases, you should config your Magento Log cleaning.
6] Disable Magento logging:
Disable the Magento Log: System -> Configuration -> Advanced -> Developer -> Log Settings (default is disabled).
7] Test your site with some following tools:
You can test your site using following avaliable tools
1] Optimize all your (template) images and optimizes images for size:
a) Crop the white space using your image editor.
b) Use CSS image Sprites.
An image sprite is a collection of images that are put into a single image and called via specific CSS classes to that page in order to reduce the load time of the page,
as well as the amount of HTTP requests need to be sent to the server. This also has the benefit of reducing the size of your images and decreasing page load times.
2] Remove unwanted code and minify or reduce your css code:
3] Specify Image Dimensions:
Specifying a width and height for all images.
A website sells more if its speed is good. A slow website will loose customers as present customers do not have time or patience to wait for slow page loading.
With reference to a site built on Magento, speed related steps are bigger concern. Magento uses EAV concept which allows and gives Magento lots of flexibility but this also means in lots of DB tables. Imagine one product data going into more then 40 tables.
Magento team was aware of this shortcoming so they have added indexing and flat table concept. Also they have a good caching concept and for enterprise version. They have full page caching.
Magento development and implementation team should know how to use these concept with proper configuration, standard template, customization with FPC and cache usage in mind.
Also at HTML render make sure that time is less. This can be achieved by reducing number of request (Use of image sprite, merge .js files,merge .css files)
Also minimize 3rd party request (This needs DNS resolution) and if needed make sure these are called after document has been downloaded.
A well optimized site should on dedicated then 3 seconds for complete download (less than 0.8 second to load HTML)
Contact us and we will give tentative estimate that your site page should need to load.
Use Google page speed tool or yslow to check Magento Site Speed.
In our series of Magento speed optimization blogs. In this blog, we will discuss on hardware and server configuration.
-Nginx is recommended over apache. Though some experts debate they can make apache run faster than nginx. If traffic is less than certain defined values.This too cant be achieved without lots of apache tuning where as nginx by default is a good candidate.
-APC, memcache, Redis
-Cache to be loaded on RAM.
-Varnish installation is recommended
- Install and use Solr search. Highly recommended for enterprise version.
-gzip to be enabled.
-Keep Alive to be set to true.
-Set expire header value.
In Our servies of blogs related to Magento speed optimization. In this blog, we will discuss about MySQL queries and its role in site speed.
we have optimized many Magento websites. What we see is that if Magento templating and coding or extension selection is not done properly then site ends up executing 2000 plus queries per page. A well done Magento site page without FPC should not take more then 300 queries and with FPC
not more than 100 queries.
To achieve this developers should give thoughts to make sure blocks are cached. In case of FPC they should make sure there are very few containers and containers should be delivered most of time without initializing application.
MySQL queries are not a big issue if there is less traffic but as traffic increases these queries might result in lots of load on MySQL server which in turn might result in slower MySQL responses and higher page load time.
It has been observed that under such circumstances development companies request website owners to add additional server & do load balancing or they request website owners to upgrade hosting plans.
Contact us and we will do a free analysis on this point for your site. In 90% case that we have reviewed. We have found that there is a good scope for optimization.