javascript - Why does this web page load very slowly when I first open it, and it takes a few seconds to open?

WBOY
Release: 2016-08-18 09:16:17
Original
1739 people have browsed it

Why does this webpage load very slowly when I first open it? It takes a few seconds to open. I see that the html file takes more than 3 seconds to load. Why is this? Was it tested on the company's server?

javascript - Why does this web page load very slowly when I first open it, and it takes a few seconds to open?

Reply content:

Why does this webpage load very slowly when I first open it? It takes a few seconds to open. I see that the html file takes more than 3 seconds to load. Why is this? Was it tested on the company's server?

javascript - Why does this web page load very slowly when I first open it, and it takes a few seconds to open?

From the screenshot, your problem is mainly focused on the slow return of html text, the green line is very long, and green means Waiting (TTFB)

About what TTFB is, you can read this article https://scaleyourcode.com/blo...

To put it simply, the time it takes for your server to return html data to you is basically the same as the green time. Then your question is to find out why the html return is very slow. The basic reason is that it is slow to check the data. Or it’s the internet aunt

brand.htmlThis is the brand page. Judging from the size of the page 9k, your page rendering work should be completed by the server and returned, which poses the risk of network congestion.

I don’t know how you wrote the code. There are only two reasons for the slow response of the server:

  • Your program has too many database reads or synchronization operations, and there is a problem of response waiting (program)

  • Your test server network or performance is poor (hardware)

It is recommended that you reduce server-side synchronization operations, and try to divide the page into modules and use a client-side rendering solution (using JS asynchronous rendering) on ​​the premise of meeting the prescribed SEO requirements

Or the server only renders the first screen data, and the subsequent data is lazy loaded and rendered using JS

The test server may be slow

Handsome guy, you have so many pictures, I recommend using CSS sprite

Look at what’s in that html?

This problem is also related to the tcp/ip protocol. The first time you visit a website, a three-way handshake will be performed, which is very time-consuming. But once the connection is established, it goes very quickly. Because there is no need to shake hands. So the first visit will be a little slower.

I have encountered the same problem. The server system was very fast before reinstallation, but slowed down after reinstallation.
This eliminates the bandwidth problem. The pages visited are the same, and gzip transmission is enabled. .The transferred data size is the same.
But it takes several seconds to transfer a file less than 10K, I can’t figure it out.

Later I found that the hosts file was blank, and then I put

<code>127.0.0.1 localhost</code>
Copy after login

After joining the hosts, the speed returned to normal

The TTFB time is too long. It is a problem on the server side. Try optimizing it from the server side.

First make sure the network is stable

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template