“47% of consumers expect a web page to load in less than 2 seconds.”
“21% mobile users said that they expect load time on their smartphones to be equal to that of desktop.”
If you own an online e-commerce store, page loading speeds are very important. And if you don’t own, it is time to build one eCommerce Website in Magento. It is one of ways to increase customer satisfaction.
Because a customer does not wait for more than 3 seconds, an online business owner has to be careful to serve product pages, landing pages and possibly all site pages within just this much of time.
For this reason, I have compiled this article to show you valuable tips and information that decrease page loading time, specifically for Magento stores.
I have tried to describe all tips in simplest manner possible, still if you aren’t
tech person, you may have to put little more efforts but it will save you from spending coins with DIY approach as opposed to hiring developers.
Let us not waste our time for less technical talks. We will take a fast-paced look on magento 2 performance optimization tips that avoid poor performance of webshop.
1. Host Magento store on dedicated server
Shared hosting is one where multiple websites are hosted on same machine. High traffic sites in this situation snatch away costly resources like CPU, memory etc. and causes other websites on same server to render slow webpages.
If your Google Analytics exhibit sufficient number of visits every hour, sayat least 100+ unbounce visitors average an hour, dedicated server is pursuable.
2. Hosting country
Beneficial is choosing a hosting company that owns servers in the country where your target customers are.
3. Software Versions
For any or all types of softwares including Magento framework, Apache or other web server in place, database product version etc., update them from time to time to get new features, better security and performance.
If your web host manages web server product, ask to upgrade sooner than later or change vendor.
Crop unnecessary white spaces from images.
Use GIF, PNG files instead of JPG.
Check total size of all images in a web page through browser extensions like Firebug.
5. Make no room for unused extensions
Don’t get lazy in clean up.
Disable and remove Magento extensions that you installed previously but now are sure of no use.
After disabling all scrub extensions if Magento store yet performs slow, try to ask any PHP/Magento programmer to comment or delete modules tthat are good for nothing. Rather doing it yourself.
6. Measure how many requests your website can take up
Using Google Speed Tracker, Pingdom etc. are good.
There is more discreet tool: Apache Benchmark ( ab )
Take for example, following command will test how fast yourwebsite.com can handle 100 requests.
Among these 100 requests, 10 are concurrent:
ab -n 100 -c 10 http://www.yourwebsite.com/
This is to be typed at command line of Apache Benchmark tool that you can install by entering command
sudo apt-get install apache2-utils on Ubuntu linux, for windows please download from Apache Benchmark’s site.
Please go through related text on web, this is just to show you a new way to measure performance.
7. Hardware considerations
Check website performance by increasing CPU or RAM or Disk(I/O) rate or all 3 together.
This is to say that set up development environment of your Magento site in Oracle Virtual Box and issue above ab command.
Then increase hardware inputs to guest OS and check results again, if significant differences are seen, bottleneck is not in the software. Adding more hardware resources in this case is beneficial.
8. Select certified web hosting company for expert Magento installation
Magento Inc. maintains country wise list of hosting companies that provide proficient Magento installation on their server for free, you can consult any of them as first time setup plays a major role in ongoing journey of a website.
To mention just the few, below are parameters to think of at Magento installation time:
- Amount of web space and I/O performances
- Virus scanner
- Data transfer (traffic/bandwidth)
- Root access FTP, PHP, Perl, SSI, .htaccess, SSH, MySQL, and crontabs
- SSL (secure server)
- E-mail, POP
- Control panel
- Multiple domain hosting and subdomains
- Web server and operating system
- Monthly/quarterly/annual payment plans
- Customer support 24 x 7
9. Use Content Delivery Network (CDN)
If your customer base is widely spread across multiple countries, and traffic to
site is high, CDN is a good solution in that situation.
CDN is a large distributed system of servers that is deployed globally and serves a copy of images, objects and files from closest to customer server thereby dramatically decreases response time.
10. Apply proper configurations on web server of Magento store
Out of major web servers supported by Magento platform, two are primarily utilized:
Nginx is not widely used and a bit harder to integrate, hence we will go through tweaks of Apache alone.
To realize advantages offered by web server tweaks mentioned herein, you can prop-up ab tool explained above while not changing the hardware settings.
For Apache, how to leverage magento speed optimization htaccess :
After installing or in pre-given available Apache web server, add below code snippets at end of .htaccess file you see at root level:
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0 no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html SetEnvIfNoCase
Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary Header append
Vary User-Agent env=!dont-vary
Also, add below more statements at end of same .htaccess file and restart Apache.
Relaunch ab tool and server stress will have been reduced in MBs.
Although Apache covers nearly 45% stake of all web servers deployed on websites globally, Nginx fewer times outperforms it – from experiences, we’ll unfortunately not look into it, please see related sources on web.
This is perhaps the most powerful way if your magento website loading very slow
11. Tuning MySQL database engine & Leverage Caching
MySQL tuning Primer script is the file that comes to your rescue to do so.
Sometimes when all other tricks do not provide performance remunerations collaboratively, final point to optimize website is to tune MySQL database engine.
To get recommendations for what should be adjusted in your setup, issue tuning primer script at operating system shell.
$ sudo chmod +x tuning-primer.sh
You may be asked root username and password before script can complete successfully.
Once execution is over, make necessary changes in my.cnf file which you get in results of above script.
You may even improvise by optimizing Magento database tables and by replicating MySQL database if your business is indeed saturated traffic E-commerce store.
To implement both of these, I recommend to hire Certified Magento developer who will do it for you as I believe technicality of these tasks should be unaffordable for a non IT business owner.
A cache is a system software that stores computed data to serve future requests
There are several brands of cache mechanisms available in the market that offer different types caching.
The most standard and safe way is to enable cache option from within Magento admin panel before installing any third party software, from System | Cache Management, as given in below screenshot.
Here, enable all including
- EAV types and attributes
- Collections Data
- Both the Web Services Configuration options
Amongst other caching systems, popularly used are Varnish, Alternative PHP cache and Memcached – subject to your wish and your production environment.
Apart from above techniques, there also comes kinds of magento speed optimization extension which you need to check thoroughly before installing one.
- amount of good reviews
- number of installations until date
- diversified client base
- version compatibility &
- launch date & price
are premier factors to assess before buying any extension.
I hope reading above text has been fruitful for you and hasn’t been a waste of time.
Viha Digital Commerce Pvt. Ltd. (VDC) provides all types of support and full cycle setup services to create lucrative Magento stores for any business.
If you are tired by too much variable prices offered by different Magento service providers and seeking a standard, no-tweaky response, call us on +91 7096620202
or drop requirements file at email@example.com to get a free quote for your project.