Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
litespeed_wiki:ttfb [2018/11/12 16:32]
Erwin Venekamp [High resource usage]
litespeed_wiki:ttfb [2018/11/12 16:43] (current)
Erwin Venekamp [Slow servers]
Line 13: Line 13:
  
 ===== Many queries ===== ===== Many queries =====
-Your TTFB may be high if your website makes very many database queries, or consists of very unoptimized application code (such as PHP). A common example of this is WordPress websites that use dozens of plugins. If possible, look into reducing the workload for your application. Caching may also help alleviate this: consider using [[litespeed_wiki:​cache:​|LiteSpeed Cache]] if you aren't already.+Your TTFB may be high if your website makes very many database queries, or consists of very unoptimized application code (such as PHP). A common example of this is WordPress websites that use dozens of plugins. If possible, look into reducing the workload for your application ​by disabling plugins or unnecessary features.
  
 +===== Insufficient caching =====
 +Caching is a good idea for almost all database-driven applications:​ serving a cached version of a dynamic page will lead to a vastly reduced workload, and improved TTFB. This is especially beneficial if your website has many database queries that can't be avoided or reduced.
 +
 +LiteSpeed offers one of the most effective caching plugins for many popular CMSes: [[litespeed_wiki:​cache:​|LiteSpeed Cache]].
 ===== Slow databases ===== ===== Slow databases =====
 For database-driven websites, a high TTFB can be caused by a slow database. There can be several reasons for this: most commonly, either very old versions of MySQL, or lack of configuration tuning. Occasionally,​ it also happens when the latency on remote database servers is too high. It's strongly recommended to use the newest version of MySQL available to you, as each release brings major performance improvements,​ and to consider optimizing your configuration using such tools as http://​mysqltuner.pl For database-driven websites, a high TTFB can be caused by a slow database. There can be several reasons for this: most commonly, either very old versions of MySQL, or lack of configuration tuning. Occasionally,​ it also happens when the latency on remote database servers is too high. It's strongly recommended to use the newest version of MySQL available to you, as each release brings major performance improvements,​ and to consider optimizing your configuration using such tools as http://​mysqltuner.pl
  
 ===== ModSecurity ===== ===== ModSecurity =====
-Sometimes, having a large number of ModSecurity rules, or very complex ones, can lead to a significant rise in TTFB. This is particularly true with the ''​SecRequestBodyAccess On''​ directive. When diagnosing high TTFB issues, you may want to temporarily disable ModSecurity,​ to rule this possibility out.+Sometimes, having a large number of ModSecurity rules, or very complex ones, can lead to a significant rise in TTFB. This is particularly true with the ''​SecRequestBodyAccess On''​ directive, and rulesets that use RBL DNS lookups for requests. When diagnosing high TTFB issues, you may want to temporarily disable ModSecurity,​ to rule this possibility out.
 ===== Slow DNS ===== ===== Slow DNS =====
 Rarely, a slow DNS server may be responsible for a high TTFB, especially in artificial benchmarks, where DNS is not cached. Several websites are available to test the speed of your site's DNS response, such as https://​www.dnsperf.com/​dns-speed-benchmark Rarely, a slow DNS server may be responsible for a high TTFB, especially in artificial benchmarks, where DNS is not cached. Several websites are available to test the speed of your site's DNS response, such as https://​www.dnsperf.com/​dns-speed-benchmark
Line 25: Line 29:
  
 ===== Slow servers ===== ===== Slow servers =====
-This is especially common in VPSes, where some providers severely oversell, or use old setups. You may also encounter this if your server uses very old, very slow hardware, such as underpowered processors, or processors that do not support hardware AES acceleration. ​You may need to migrate ​to another provider.+This is especially common in VPSes, where some providers severely oversell, or use old setups. You may also encounter this if your server uses very old, very slow hardware, such as underpowered processors, or processors that do not support hardware AES acceleration. ​If this is the case, you will likely benefit from migrating ​to another provider.
  
  
  • Admin
  • Last modified: 2018/11/12 16:32
  • by Erwin Venekamp