Magento optimization technique for image, sql, cache – Step by step
As any other eCommerce platforms, Magento faces problems with speed and performance over time. Dealing with these issues and optimizing the system are the most important activities to SEO, sales and customers’ retention.
These below tips are some easy ways to keep your Magento website optimized:
1. Stay up-to-date
Magento always inform users if there is any new updates available so make sure you do not miss the update notification. New updates are usually released with performance improvements and bugs fixes.
Below are the steps you need to keep in mind when upgrading into a new Magento version:
- Install a brand new version of Magento file tree
- Upgrade outdated database
- Don’t forget to merge old themes and extensions to the new version
2. Managing Cache
There are many ways to manage cache, such as browser caching, gzip compression, expire headers, and page caching.
In Magento, navigate to System/Cache Management to manage your caches (make sure that you enable all cache types)
Browser caching is one of many cache form that can be optimized. The following Gzip compression and expire headers are one of many code snippets that you can use for your .htaccess file (or .htaccess.sample for Magento 2).
Web pages and stylesheets are sent to browser as a gzip compression at server level.
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
# Remove browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0 no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
Request a file from server or taking an available one from the cache browser are the function of expire headers.
## Add default Expires header
ExpiresDefault “access plus 1 year”
The most powerful way for Magento optimization could be considered as page caching. Loading pages by visited one from cache makes the web server much faster.
You can check out some of Page Caching extensions for Magento below:
3. Image Optimization
Over 50 percent of a website’s pages is taken by images. Thus, optimizing image weight would potentially speed up your pages. There are a couple of online tools and extensions for Magento that you can use to compress and decrease your image weight:
- Navigate to System/ Configuration/ Advanced/ Developers
- After files get merged, cache needs to be cleared and refreshed. (you can follow the mentioned cache process).
5. Clean Up Magento Database & Logs
As by Magento default, logs are kept for 180 days. Shorten this period can help you save some database space.
- Navigate System/ Configuration/ Advanced/ Advanced/ Log
- Change Save Log, Days to whatever you prefer
- Click on Save Config
6. Run Magento Compilation (for Magento 1)
Everytime a page loads, lots of filesystem reads are generated. Magento compiler helps to decline these reads up to 50 percent.
- Navigate to System/ Tools/ Compilation
- Click on Run Compilation Process
Remember to disable Compiler before any new extension installation or Magento upgrade.
7. Indexes Update
Usually, Magento indexes are automatically updated to speed up MySQL queries. However, some updates need to be handled manually and make sure that you do not forget it.
- Navigate to System/ Index Management
- Select the indexes that you would like to update. In the dropdown, choose Reindex Date (Magento 1)
or Update on Save (Magento 2)
- Click Submit.
A knowledge craver who always strive to be wiser everyday.