TTFB is too high. What can be done to improve it?

Created:

2016-11-16 13:09:46 UTC

Modified:

2017-08-16 17:04:28 UTC

1

Was this article helpful?


Have more questions?

Submit a request

TTFB is too high. What can be done to improve it?

Applicable to:

  • Plesk for Windows
  • Plesk for Linux
  1. Publishing of a website created in Web Presence Builder takes too much time.
  2. Time To First Byte on Plesk's host is too high.

What can be done to improve it?

Answer

Time To First Byte (TTFB) is a metric that depends on many variables. It can equally be intertwined either with destination server side of things or any other node of the connection route.

The following can be done:

1. Enable keep-alive requests

2. Set the application pool Start Mode to "Always Running" at IIS Manager > Server > Application pools > example.com pool > Advanced Settings

3. set the site Preload Enabled to "True" at IIS Manager > Server > Sites > example.com > Advanced Settings

To minimize influence of this metric on a publishing performance enable keep-alive requests on the destination host.

Keep-alive requests general info

  • Keep-alive is enabled using the "Connection: Keep-Alive" HTTP header
  • If keep-alive is not enabled it is likely your HTTP headers are stating "connection: close"
  • Change that to "connection: keep-alive" to enable keep-alive.
  • Enabling keep-alive depends on what server you are using and what you have access to.

Enable keep-alive using .htaccess

If there is no access to webserver configuration file enable keep-alive parameter through an .htaccess file:

<ifModule mod_headers.c> Header set Connection keep-alive </ifModule>

It will add keep-alive headers to requests. Note that .htaccess will override most webserver or host limitations.

Enable keep-alive in Apache

Keep-alive requests can be enabled through Apache configuration files if this is allowed to manage. The applicable sections are shown below:

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 100

Enable keep-alive in NGINX

Keep alive issues can be tackled using the HttpCoreModule . There is a specific directive to look - keepalive_disable . Note, if there is one make sure that is safe to remove.

How to determine if keep-alive is enabled on my pages?

The pagespeed tool reports on keep-alive status as well as several other factors.

Have more questions? Submit a request
Please sign in to leave a comment.