A slow server response time can cause visitors to bounce off your site.
To prevent visitor bounce, and grow your business, you will need to reduce server response time.
In Magento, there are several ways to “reduce server response times”, such as compression enabling, image optimization, and much more.
At Bobcares, we often get requests from our customers to reduce server response times in Magento as part of our Server Management Services.
What is server response time?
The server response time is the time taken by a web server to send the first byte to the visitor.
The response time of a server is measured with “Time to First Byte”. It determines how faster the website is.
Here we have the reasons why the response time of a server is slow, there are a few factors that may come into play. These include:
- Poor server optimization
- Increased traffic.
- Poor website optimization
We can improve server response time with different methods.
Now, we’ll see how our Support Engineers help our customers to reduce server response time in Magento.
How to reduce server response time in Magento
Magento is one of the most popular eCommerce platforms for website management. For better user experience, the speed of a Magento website is very important. In fact, it is a user-friendly application to reduce the server response time.
Optimization of the Magento server is a difficult process requiring special knowledge and skills. Let’s see various methods to reduce server response time in Magento.
Server optimization
From our experience in managing servers, our Support Engineers always suggest our customers to select the appropriate hosting with enough CPU and RAM. So we recommend VPS or Magento-optimized hosting that comes with sufficient CPU and RAM which helps to reduce the server response time.
1. PHP Configuration
We install and configure caching service for PHP acceleration (XCache, EAccelerator, etc). It is highly recommended to enable and tune PHP opcache to maximize performance. So we edit opcache.ini file to include the following:
opcache.enable_cli=1
opcache.memory_consumption=512
opcache.max_accelerated_files=100000
opcache.validate_timestamps=0
opcache.consistency_checks=0
2. Magento MySQL Optimization
MySQL tuning is responsible for increasing the speed on the server. In addition, MySQL tuning allows you to check MySQL settings and make adjustments to improve the performance and stability of the Magento database. Therefore, it helps to reduce the server response time in Magento.
3. Reduce server response time
Magento has built-in cache functionality and helps to achieve server response time with approximately 0.5s. In the advanced version, Magento supports Full Page Cache via Varnish that reduces the server response time.
Let’s see how our Support Engineers set up Varnish cache in Magento.
1. Login into Magento Admin Backend, go to Stores> Configuration > Advanced > System > Full Page Cache,
2. Then, change Caching Application to Varnish Cache.
3. Open Varnish Configuration section and fill the following fields too.
- Access list
- Backend host
- Backend port
- Export configuration
That’s it. We have enabled Varnish cache in Magento.
Website Optimization
Moreover, site slowness is usually caused by un-optimized website too. So, let’s see the top 5 tweaks we perform on the Magento website to reduce server response time.
1. Enable flat categories and products
One factor that determines the response time of the server is the ability to load the database faster. Also, the delays on the platform when reading catalog data from the database increases the server response time. However, enable “Flat Catalog” will speed up the read time and make the database faster with MySQL query execution.
Here, we’ll see how our Support Engineers enable flat categories and products.
2.1. Login to Magento Admin backend and click on stores and select configuration.
2.2. Then, we click on catalog > catalog > storefront.
2.3. We choose “Yes” in Use Flat Catalog Category field.
2. GZIP compression to shrink Page Size
Gzip compression allows web pages to shrink before sending it to the web browser. Therefore, the browser has fewer data to download.
So, our Support Engineers took the following steps to enable Gzip compression in Magento.
In Apache, we enable Gzip compression by doing the steps below.
1. We enable gzip by adding following code in .htaccess file.
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/javascript
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/x-javascript
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/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
</IfModule>
That’s how we enabled Gzip compression in Magento.
3. Merge CSS and JS Files
Another reason for slow server response time is Javascript and CSS. In fact, merging and minifying of CSS and Javascript files makes the Magento website compatible and faster.
This is how our Support Engineers merge and minify CSS and Javascript.
For JavaScript,
1. Log in to Magento Admin backend, go to Stores -> Configuration > Advanced > Developer > JavaScript Settings.
2. Change Merge JavaScript Files to Yes.
3. Set Minify JavaScript Files to Yes.
For CSS File,
1. Login to Magento Admin backend then select Stores -> Configuration > Advanced > Developer > CSS Settings.
2. Set Merge CSS Files to Yes.
3. Set Minify CSS Files to Yes.
4. Optimize images
The image is a necessary factor to enhance the performance of your Magento website. But, the image files can be several MBs in size and loading them to the website takes too long. Therefore, it slows down website performance.
However, image optimization allows image compression before submitting to the website.
Don’t worry, our Support Engineers will help our customers for image optimization.
5. Turn caching on
Disabling “caching on” doesn’t allow the system to retrieve items easily. Caching is a key step in providing content faster to users.
Therefore, our Support Engineers took the following steps to enable “caching on” in the Magento Admin backend.
1. Log into Magento admin backend, go to System > Tools > Cache Management.
2. We click the box on which cache type wants to enable/disable.
3. Then we click the drop down box, on the top left corner and change this to enable.
4. Finally, we click on the submit button.
That’s it. Now, we have enabled “caching on” in Magento.
[Having trouble while reducing server response time in Magento? We can fix it for you.]
Conclusion
In short, the server response time is the time taken by a web server to send the first byte to the visitor. Today we saw how our Support Engineers use different methods to reduce server response time in Magento.
0 Comments