In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
Website loading Waiting TTFB for too long reason and what is the solution, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.
Friends who pay attention to the front-end performance of web pages will encounter the problem that the website loads Waiting (TTFB) for too long when optimizing the performance of web pages. For unoptimized WordPress sites, the TTFB time often exceeds the download time of the page content, bringing unnecessary waiting time for users. The main reason for this problem is that on the server side, friends who are not familiar with server operation and maintenance may not know where to start. Today, we will analyze the reasons and solutions for the website loading Waiting (TTFB) for too long from various aspects.
What is Waiting (TTFB) time
TTFB is the abbreviation of Time to First Byte, which refers to the time when the browser begins to receive the server response data (background processing time + redirection time). It is an important indicator of server response speed. Just like you ask a friend a question, and your friend thinks for a while before giving you an answer, your friend's thinking time is equivalent to TTFB. The shorter your friend's time to think, the smarter your friend is or the more familiar he is with your problem. For the server, the shorter the TTFB time, the faster the server responds.
How long is the TTFB time?
Because the hardware and network environment of each server is different, the TTFB time of each server is also different. If you want to know the extent to which your server can be optimized, you can upload some static HTML pages to the server, then open these static pages and look at the TTFB time of these pages. Most servers have TTFB time below 50 ms, which is the time we can pursue when optimizing. The TTFB time in the following two figures is the static and dynamic web page TTFB waiting time of the server where this site is located.
Static page Waiting (TTFB) time dynamic web page Waiting (TTFB) time
According to our tests, if the TTFB time exceeds 500 ms, users will feel obvious waiting when they open the web page. We can think of more than 500 ms as TTFB time is too long. It can be seen that the server of the WordPress think tank is not bad.
The reason why TTFB is too long
We know that for dynamic web pages, when the server receives a request from a user to open a page, it first reads the data needed for the page from the database, then transfers the data to the template, and then returns it to the user after the template rendering. Because it takes some time to query the data and render the template, the browser is in a state of waiting for the server to respond before this process is completed. The performance of some services is relatively low, or the optimization is not done well, this time will be longer.
Of course, if the network between the server and the user is not good (for example, the server is in Europe, the user is in China, and the request needs to cross thousands of mountains and rivers to reach the server when the user opens the web page), the server takes too long to receive user requests, which is also the reason for the long TTFB time.
Sometimes, the page saves too much Cookie in the user's browser, and every time a request is made, the Cookie is sent to the server, and the server processes the Cookie, which is one of the reasons why the TTFB takes too long.
The solution of Waiting (TTFB) too long time
Knowing the reason, the solution is obvious, that is to shorten the server response time, the most simple, direct and effective way is to use caching to minimize the execution time of PHP and MySQL. Some cache plug-ins can cache SQL query results and convert dozens of query results into several times. Some cache plug-ins can make the page requested by the user static directly. When the user opens the web page, it is equivalent to downloading the static page directly from the server.
If it is for network reasons, switching to another server is a more direct solution. If you can't change the server for some reason, you can use a CDN to synchronize the page to the CDN node closer to the user, which is also a good solution.
If it is the reason for Cookie, you can modify the application, delete some unnecessary Cookie, or simplify the Cookie content, shorten the period of validity of Cookie, and so on.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.