{"id":2803,"date":"2024-12-31T20:26:43","date_gmt":"2024-12-31T20:26:43","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/learn-to-reduce-initial-server-response-time-in-magento-2\/"},"modified":"2025-08-25T17:10:40","modified_gmt":"2025-08-25T11:40:40","slug":"reduce-initial-server-response-time-in-magento-2","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/reduce-initial-server-response-time-in-magento-2\/","title":{"rendered":"Learn to Reduce Initial Server Response Time in Magento 2"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Thinking about minimizing server response time in Magento? Use the techniques provided in this micro-post and reduce initial server response time in Magento 2!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Users expect a quick experience. Disappointing them with a slow-loading Magento store is never gonna succeed you. Take a second more, and they\u2019ll jump back to your competitors\u2019 sites for happy purchases. You may never want this to happen. Even Google considers user experience metrics as its core ranking factors.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A quick way to test your website for user experience is by using the&nbsp;<a href=\"https:\/\/pagespeed.web.dev\/\" target=\"_blank\" rel=\"noreferrer noopener\">PageSpeed Insights tool<\/a>. Often, Magento 2 stores suffer from high server response time, which leads to a low-grade experience. The tool may recommend you \u2014 \u2018reduce initial server response time.\u2019<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But, how would you do that? What are the techniques to&nbsp;<strong><em>reduce initial server response time in Magento 2<\/em><\/strong>&nbsp;\u2753\u2753<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s find it out!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-is-time-to-first-byte\">What is Time to First Byte (TTFB)?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Time to First Byte (TTFB) is a metric used to measure the responsiveness of the website server. It is the time (in milliseconds) taken by the web server to respond to the first connection request. The connection between the client and server is established through multiple points, and each of them affects the TTFB.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The following events occur during the first connection, in a chronological manner:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The client sends a request<\/li>\n\n\n\n<li>The server processes the request<\/li>\n\n\n\n<li>The server replies back to the client<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">In the above process, a variety of factors affect the time to the first byte, including the internet connection speed, distance from the content delivery network, server processing speed, DNS lookup, caching, etc.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Time to first byte is noted literally at the moment the client receives the first byte of the response from the server.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What is a Good Time to First Byte (TTFB)?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">First of all, the TTFB is not a core web vitals metric, as it can vary from site to site. For example, a website that requires client-side rendering may have less TTFB as compared to a site with server-side rendering.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2023\/05\/what-is-a-good-time-to-first-byte-score.png\" alt=\"What is a good time to first byte score for magento 2 - reduce server response time\" class=\"wp-image-32237\"\/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">It is recommended to serve the pages faster so that 75th% of the users experience FCP with a good threshold. Generally, a TTFB of 0.8 seconds or less is considered a good TTFB score.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In case your site is falling in the yellow or (in the worst case) red score, you need to reduce the initial server response time in Magento 2. Consider that it would be good to buy RDP for creating secure server connections at first.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s explore the techniques for Magento TTFB optimization.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"5-ways\">5 Ways to Reduce Initial Server Response Time in Magento 2 (TTFB Optimization)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The poor server response time in Magento 2 can affect the TTFB and the overall user experience. Here are the different ways for Magento server optimization:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"1-choose-a-fast-hosting\">1. Choose a Fast Hosting<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Server performance and quality of infrastructure certainly affect the initial server response time. Generally, cheap hosting plans are shared amongst websites, which directly affects the performance and initial server response time.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can check out the\u00a0<a href=\"https:\/\/meetanshi.com\/blog\/magento-hosting-providers\/\" target=\"_blank\" rel=\"noreferrer noopener\">best Magento 2 hosting providers<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"2-enable-varnish-cache\">2. Enable Varnish Cache<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Caching is an effective way to reduce the server load by limiting the number of repeated requests. The responses are stored in a cache, which is then used to serve similar requests. Thankful, Magento 2 offers an in-built varnish cache for faster performance.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can enable the Varnish cache from&nbsp;<strong>Admin &gt; Stores &gt; Configuration &gt; Advanced &gt; System &gt; Full Page Cache<\/strong>.&nbsp;Select&nbsp;<strong>Varnish Cache&nbsp;<\/strong>as the Caching Application, and configure it by adding the following details:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Access list<\/li>\n\n\n\n<li>Backend host<\/li>\n\n\n\n<li>Backend port<\/li>\n\n\n\n<li>Grace period<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2023\/05\/enable-varnish-cache-in-magento-2.png\" alt=\"Enable varnish cache in Magento 2 to reduce server response time and TTFB\" class=\"wp-image-32239\"\/><\/figure>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"3-leverage-cdn\">3. Leverage CDN<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Content delivery network or CDN is a great to reduce the strain on the web server. The content delivery network consists of proxy servers in different locations, which store cached versions of the web elements, which helps in Magento server optimization.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The cached content is served to the client from its nearest proxy server, even if the original web server is far away. Thus, it drastically reduces the initial server response time.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.cloudflare.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Cloudflare&nbsp;<\/a>is a good choice of CDN for the Magento users. It offers fastest response time with its servers spread across the globe.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"4-optimize-mysql-db\">4. Optimize MySQL DB<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Slow information retrieval from the database is the main bottleneck of the request processing. You can drastically reduce initial server response time in Magento 2 by optimizing your MySQL database.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One way to reduce the database load is to enable the flat catalog in Magento 2. In the admin panel, go&nbsp;<strong>to Stores &gt; Configuration &gt; Catalog &gt; Catalog&nbsp;<\/strong>and expand the&nbsp;<strong>Storefront&nbsp;<\/strong>section. Now, enable flat catalog for products and categories as shown in the screenshot below.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2023\/05\/enable-flat-category-magento-2.png\" alt=\"Enable flat catalog in magento 2 for faster server response time\" class=\"wp-image-32238\"\/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Furthermore, you can optimize MySQL for better performance by using caching. You can check if it is enabled or not by using the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql&gt; show variables like 'query_cache_%' ;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">f the value of query_cache_type is OFF, then query cache is disabled. Follow these steps to enable query caching in MySQL:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open MySQL configuration file, usually it is present at \/etc\/my.cnf or \/etc\/mysql\/my.cnf directory.<\/li>\n\n\n\n<li>Add the following code after the [mysqlid] section:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>query_cache_type=1\nquery_cache_size = 10M\nquery_cache_limit=256K<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In the above code, you can modify the size and limit of the query cache.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"5-other-techniques\">5. Other Techniques<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Besides the above mentioned techniques, here are the other ways that can significantly improve the server response time:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Upgrade Magento to latest version<\/li>\n\n\n\n<li>Clear database logs<\/li>\n\n\n\n<li>Inspect source code and optimize SQL queries<\/li>\n\n\n\n<li>Minify JS\/CSS Files<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">You can also refer to our another guide to&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/magento-2-speed-optimization-steps\/\">optimizing Magento 2 performance&nbsp;<\/a>for actionable tips.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"improve-your-magento-site-loading-speed\">Improve Your Magento Site Loading Speed<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In this micro-post, we showed you the actionable tips to reduce initial server response time in Magento 2. Now, it\u2019s your turn to make it happen! Use the techniques to improve the server response time and TTFB metric for your online store.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Feeling stuck with slow Magento speed? Consult our&nbsp;<a href=\"https:\/\/meetanshi.com\/magento-speed-optimization-service.html\">Magento professionals<\/a>&nbsp;to get your online store back on track.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Thinking about minimizing server response time in Magento? Use the techniques provided in this micro-post and reduce initial server response time in Magento 2! Users&#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-2803","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2803","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=2803"}],"version-history":[{"count":4,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2803\/revisions"}],"predecessor-version":[{"id":20748,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2803\/revisions\/20748"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=2803"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=2803"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=2803"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}