Javascript-why loading a webpage is slow when it is opened, and it will only start a few seconds later

Source: Internet
Author: User
Why does it take more than three seconds to load html files when the webpage is opened? Tested on a company server?

Why does it take more than three seconds to load html files when the webpage is opened? Tested on a company server?

Reply content:

Why does it take more than three seconds to load html files when the webpage is opened? Tested on a company server?

From the above, your problem is mainly due to the slow response of html text, the long green line, and the long green line indicating Waiting (TTFB)

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

In layman's terms, that is, the time when your service end returns html data to you, which is basically the same as the green time. your problem is to check why the html response is slow, the basic reason is that data query is slow. Or the Internet aunt

brand.htmlThis is the brand page, from the page size9kWe can see that your page rendering work should be returned by the server end, which poses a risk of network congestion.

I don't know how you write the code. There are two causes of slow server response:

  • There are too many read or synchronization operations in your program database, and there is a problem of waiting for response (program)

  • Your testing server network or performance is not powerful (hardware)

We recommend that you reduce the number of synchronization operations on the server. to meet the SEO requirements, try to use the client rendering scheme for page modules (using JS asynchronous rendering)

Or the server only renders the data on the first screen, and the subsequent data is loaded and rendered in JavaScript lazy mode.

The test server may be slow.

Handsome guy, you have so many images. CSS sprite is recommended.

Let's see what's in that html?

This issue is also related to the TCP/IP protocol. The first visit to the website will carry out three handshakes, which is very time-consuming. However, after the connection is established, it will soon become possible. Because there is no need to shake hands. Therefore, the first access will be slower.

I have encountered the same problem. The speed of server system reinstallation is fast, and the speed is slow after reinstallation.
This eliminates the bandwidth issue. The accessed pages are the same, and gzip transfer is enabled. the transmitted data size is the same.
However, it takes several seconds to transmit a file of less than 10 kB.

Later, I found that the hosts file is blank, and then I

127.0.0.1 localhost

After being added to the hosts, the speed returns to normal

TTFB is too long. it is a problem on the server side. try to optimize it on the server side.

First, make sure that the network is stable.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.