by Ngoc
January 1, 2022

The Best Ways To Reduce Initial Server Response Time WordPress

If you’ve ever ran a PageSpeed Insights test, you’ve probably seen the recommendation: “reduce initial server response time.” As a result, it will have an impact on your PageSpeed score. Reduce the time it takes for your site to respond to the first byte by reducing the initial server response time (TTFB).

The time it takes a browser to build a connection with a server and begin downloading the contents of a web page is referred to as TTFB. As a result, the higher your TTFB, the better your performance will be. Let’s look at what TTFB is and what causes it to be slow. You’ll learn how to reduce initial server response time wordpress. So let’s explore.

Before coming to explore how to reduce initial server response time WordPress, we will learn the definition of Time to First Byte (TTFB).

BEST WORDPRESS THEME

ArrowTheme offers you the Best WordPress Themes for Multi purposes. Check it out!

What is Time to First Byte (TTFB)?

“Time spent waiting for the initial response, also known as the Time To First Byte,” Google defines Time to First Byte as a period of “waiting.” This time includes the time spent waiting for the server to respond as well as the latency of a round trip to the server.”

Another way, TTFB is the time it takes for a web page to render from the time you browse to it. That is, the point at which you will begin to see some content on your screen.

TTFB is made up of three different parts:

  •  The time it takes to send the HTTP request: The HTTP request is the first step of TTFB. The time it takes a server to receive a request is determined by the time for doing a DNS lookup, the speed of the user’s network, the distance between the user and the server, and any connection interruptions.
  • The time it takes to complete the request: The server must process the request and generate a response after it has received it. Starting processes, making database calls, running scripts, and connecting with other network systems are all part of this process.
  • The time it takes the server to deliver the browser the first byte of the response: Finally, the server must offer the user the response. This stage is influenced by the server’s and user’s network speeds. The TTFB will be affected if the user has a slow wifi connection.

In general, the longer for sending a request to the server, processing it, and returning it to the user’s browser, the longer for displaying your page to them.

What is a good TTFB?

A TTFB of less than 200ms is recommended by Google.

For some WordPress sites, this is feasible. However, you’ll require a fast infrastructure (hosting, theme, plugins). In case TTFB exceeds 600ms. So it is considered slow and the audit will fail.

0-200msGoogle Recommended
200-600msPasses Lighthouse
600-1000msFails Lighthouse
1000ms+Very Slow

Why is TTFB important?

Why is TTFB important?
Why is TTFB important?

Because TTFB affects your overall page speed, it’s a crucial measure to monitor and adjust if you want to enhance your Core Web Vitals scores.

It’s also worth noting that TTFB is not to be confused with page speed. It’s basically a measure that indicates how responsive your site is.

TTFB is a measure that you can change to speed up your site. So why not cut it in half to speed up your site and improve your PageSpeed score?

Furthermore, lowering TTFB improves:

  • User experience by spending less time waiting for your site to load. Moreover, LCP is linked to the Page Experience Update. This is the most recent SEO ranking criterion.
  • While waiting for content to display on the page, users are less likely to bounce. Therefore, you can increase engagement and retention.
Related:  The simple guide to export Woocommerce products

What causes a slow TTFB?

Time to First Byte can be affected by a number of factors when it comes to WordPress sites:

  • Latency in the network
  • Web traffic is high.
  • Configuration and functioning of the server
  • Dynamic content
  • DNS response time

You won’t be able to do anything about high online traffic or network problems. But, as we’ll see below, there are solutions to manage server configuration, dynamic content, and DNS response delays.

How to test your TTFB?

GTmetrix

GTMetrix, which refers to this parameter as “waiting” time, makes measuring TTFB simple.

Scanning your site and opening the waterfall will give your results. You may check your loading metrics, including wait time in the first result in the list (aka TTFB).

WebPageTest

WebPageTest can also be used to determine your TTFB. You’ll obtain your TTFB in seconds after scanning your site.

Pingdom

TTFB is also measured by Pingdom. You just need to  Simply scan your site and scroll down to the “File Request”. As a result, you can see the wait times for your site and individual requests.

KeyCDN

KeyCDN (which is also my preferred tool) measures TTFB in 14 different locations. When testing sites close to your origin server, TTFBs can be quick. However, when testing distant distances, they can be slow.

So now let’s come to see how to reduce initial server response time WordPress

How to reduce initial server response time WordPress?

How to reduce initial server response time WordPress?
How to reduce initial server response time WordPress?

Lower CPU usage

One of the most effective techniques to improve server response times is to lower CPU (found in your hosting account). The majority of this article will be devoted to lowering CPU usage and, as a result, lowering server load. To keep your server calm, don’t use more than 75% of its CPU.

That’s why selecting a plan with sufficient server capacity is critical. Host companies give you recommendations based on monthly visitors. However, they don’t consider how many plugins you have, if they use a lot of resources, or whether you use a CDN.

Avoid shared hosting

Because shared hosting has limited server resources, TTFB is often slow.

Your website is starving if your neighbors (other sites on the server) are hogging resources. Not to mention the fact that the majority of shared hosts have low CPU restrictions. That’s why 500 errors are common on shared hosting.

Make the switch to a faster hosting service

The majority of hosting recommendations are rubbish. So you should join the WP Speed Matters Facebook Group. It isn’t controlled by affiliates or SiteGround’s community manager, who “moderates” unfavorable postings about their brand in other groups.

Avoid slow plugins + page builders

TTFB, some plugins can cause your website to slow down and use more CPU.

  • Find the slowest plugins: Tools like Query Monitor and New Relic can help you find your slowest plugins. Install Query Monitor, browse to Queries Queries By Component on the Query Monitor tab, and visit a page on your site. For different inquiries, you can check several pages/posts.
  • Avoid heavy page builders: Elementor and Divi were crushed in core web vitals. These websites generally rely on additional third-party plugins and addons besides the CSS, JavaScript, and many div wrappers. This causes even greater bloating. We  switched from Elementor to Gutenberg and saw a significant difference. Even hard coding your menu, header, footer, and sidebar in CSS can help you get rid of a lot of page builder clutter. You can also utilize Asset CleanUp and Perfmatters (together with Elementor’s Experimental features) to unload unwanted CSS and JS. However, I would avoid them.
Related:  3 Methods to downgrade WordPress to a previous version

Clean your database

TTFB can be improved by cleaning up your database.

Many of you are utilizing WP Rocket to clean up your database automatically. However, this does not allow you to browse through your database tables and delete tables left behind by previous plugins. We recommend the WP-Optimize for you. Look for plugins that are “Not Installed” in the “Tables” tab. You can uninstall a plugin (or disable a plugin module) in case you don’t use it anymore.

Increase cache lifespan

The cache lifespan may usually be set in most cache plugins. By increasing this, you can save server resources.  If you don’t publish information frequently (like a news website), this is an excellent option. Otherwise, you should probably leave it as is.

Disable WordPress heartbeat

By displaying real-time plugin notifications, when other users are modifying a post, WordPress Heartbeat uses resources. It usually causes more harm for most website owners. Furthermore, there are numerous plugins to disable this (WP Rocket, Perfmatters, most cache plugins).

Go to Appearance > Theme Editor, then change your theme’s functions.php file. Therefore, you can disable the WordPress Heartbeat API without using a plugin. After that, paste the following code after the <?php tag:

add_action( 'init', 'stop_heartbeat', 1 );

function stop_heartbeat() {

wp_deregister_script('heartbeat');

}

Don’t combine CSS + JavaScript

CSS/JS should combine on smaller pages, but not on larger sites. According to WP Johnny, websites with a CSS/JS size of less than 10KB should merge, while those with a CSS/JS size of more than 10KB should not.

Increase memory limit

Both Elementor and WooCommerce require a 256MB memory limit. However, you should bump it up to 256MB regardless, especially if you’re getting fatal memory limit issues on your site.

Before “Happy Blogging,” add the following to your wp-config.php file.

define('WP_MEMORY_LIMIT', '256M');

In certain hosts’ dashboards, you can also choose to increase it.

Use server-level caching

Many servers provide server-level caching, which lowers time to first page and speeds up your site.  In Cloudways, I use memcached, NGINX, and Redis (with Varnish disabled). Because it comes from your server, which is faster than file-based caching. So server-level caching is faster than cache plugins.

Offload resources to CDNs

CDNs offload resources to their data centers and reduce the burden on your server.

If you’re using LiteSpeed Cache, I recommend Cloudflare, BunnyCDN, QUIC.cloud, or Cloudfront. Also, StackPath, which is utilized by several CDNs such as RocketCDN and CloudwaysCDN, should be avoided.

The other three CDNs are generally faster than Cloudflare, although they are all expensive.

Cloudflare has more capabilities. Because it can reduce TTFB (such as Brotli, HTTP/3, bot prevention, page rules, and their APO)

Step 1: Create a free Cloudflare account, add your website, and execute the Cloudflare-prompted scan. After a while, you’ll reach a screen where Cloudflare will assign you two nameservers.

Step 2: Configure NameCheap to use Cloudflare nameservers. Go to Domain List > Manage Nameservers > Custom DNS on the Dashboard. Cloudflare has given you two nameservers.

Enable Brotli

Brotli compression is more efficient than GZIP compression. Because both will make your HTML, CSS, and JavaScript files smaller. This improves TTFB by allowing certain resources to download faster. In Cloudflare’s speed options, you can enable Brotli; otherwise, your cache plugin will utilize Gzip.

Enable HTTP/3

According to the Cloudflare blog, with HTTP/3, the first byte appears after 176 ms on average. With HTTP/2, the response time is 201ms. Therefore, it shows that HTTP/3 is already 12.4 % faster.

HTTP/3 can be activated in your Cloudflare dashboard’s Network settings. Also, if you’re utilizing Quic.cloud or another CDN, make sure to check if they support HTTP/3.

Enable bot protection

Bad bots are really interested in your wp-login page.

Related:  How to fix error establishing a database connection in Wordpress easily

Even if bots are unsuccessful in logging onto your site, they may attempt to do so, consuming server resources.

Therefore, y ou can block them by redirecting your login page to a custom login URL (using Perfmatters or WPS Hide Login). And then you can enable bot protection in Cloudflare’s settings.

Step 1: Download and install Wordfence.

Step 2: Look at the live traffic report to see who is visiting your site in real time.

Step 3: Change the location of your wp-login page. This can be accomplished with Perfmatters or WPS Hide Login.

Step 4: Enable bot fight mode in Cloudflare Firewall Bots Bot Fight Mode (Cloudways also provides bot protection) or try Blackhole For Bad Bots to further block spam bots.

Create a cache everything page rule

Add a page rule to cache everything in case you’re using Cloudflare.

Go to Page Rules on your Cloudflare dashboard. Replace my domain with yours by copying/pasting the rule below. In case you’re having trouble applying the cache everything page rule because you have WooCommerce or a dynamic site. So you can use the WP Cloudflare Super Page Cache plugin.

Moreover, you can secure the wp-admin section by creating a page rule for it, bypassing the cache and preventing apps and performance features (such as Rocket Loader) from executing in the admin area.

Take a look at Cloudflare’s APO.

Cloudflare evaluated their APO on 500 sites. Besides that, they discovered that it reduced TTFB by 90ms on average. Cloudflare’s edge network will serve your complete site. It’s $5 a month.

However, in case you have a slow TTFB. So it’s worth a try. Because it isn’t included in WP Rocket. Therefore, you have to make sure it works with your cache plugin.

Use a faster cache plugin

The gold standards for caching plugins are WP Rocket and LiteSpeed Cache.

Most people, however, do not set these to their optimal settings.

Most other cache plugins require you to install about six more plugins to acquire these functions. However WP Rocket includes them all, minimizing the amount of plugins on your site. If you only want to use one plugin; otherwise, you’ll have to figure out the functions your cache plugin has and then install additional plugins if it doesn’t.

  • Database cleanup: WP-Optimize
  • CSS/JS optimization: Autoptimize
  • Delay JavaScript execution: Flying Scripts
  • Host Google Analytics locally: Flying Analytics
  • CDN URL integration: BunnyCDN / CDN Enabler
  • Heartbeat control: Heartbeat Control / manual code
  • Lazy load images/videos: Optimole / WP YouTube Lyte
  • Preload links / instant page: Perfmatters or Flying Pages
  • Host Facebook Pixel locally: no plugin does this that I know
  • Prefetch/preload: Pre* Party Resource Hints / manual code
  • Font-display:swap: Swap Google Fonts Display / manual code

In plugins, disable data sharing

If any plugins ever ask for your data, deactivating it will lower CPU consumption significantly. Because your server will not have to send the data to the plugin developers.

Limit post revisions and autosaves

Limit post revisions and autosaves to reduce initial server response time WordPress
Limit post revisions and autosaves to reduce initial server response time WordPress

WordPress does not limit post revisions by default. Furthermore, the autosave interval is short (1 minute). Therefore, increasing the autosave interval and decreasing post revisions will help to reduce CPU consumption and avoid a bloated database. You can do both with Perfmatters or by editing your wp-config.php file with the following code.

define('WP_POST_REVISIONS', 5);

define('AUTOSAVE_INTERVAL', 300); // seconds

Conclusion

You might use a variety of advanced strategies to optimize your TTFB on your site, including disk IO, TLS overhead, minimizing autoloaded data, and more.

However, the strategies about how to reduce initial server response time WordPress in this post are quite easy to implement. More importantly, it will provide your site the most performance increase.

Read More: Effective Ways To Optimize Shopify Logo Size

Related Posts