JavaScript-Why did you just open the page when it was slow to load and opened in a few seconds?

Source: Internet
Author: User

Why did you just open this page and load it slowly, after a few seconds to open, I see the HTML file loading for more than 3 seconds, why this? Tested in the company's server?

Reply content:

Why did you just open this page and load it slowly, after a few seconds to open, I see the HTML file loading for more than 3 seconds, why this? Tested in the company's server?

From the top, your problem is mainly focused on HTML text return is very slow, green line is very long, green means waiting (TTFB)

about what is TTFB you can read this article Https://scaleyourcode.com/blo ...

Popular point, that is, your server to return your HTML data time, basic and this green time is almost, then your problem is to find out why this HTML return is very slow, the basic reason is to check the data slowly bai. Or the Internet big aunt.

brand.htmlThis is the brand page, from the size of the page 9k , you should be the page rendering work should be done by the server to return, there is a hidden network congestion.

How do you write the code I do not know, resulting in a slow response to the server, there are two reasons:

    • Your program database reads or synchronizes too much, there is a response waiting problem (program)

    • Your test server network or performance does not give force (hardware)

We recommend that you reduce the service-side synchronization operation, in the context of the requirements of the required SEO, as far as possible the page sub-module with the client rendering scheme (using JS asynchronous rendering)

or the server only renders the first screen data, the next data to use JS lazy loading and rendering

The test server might be slow.

Handsome you picture so much, recommended with CSS Sprite

Look at that HTML.

This issue is also related to the TCP/IP protocol. The first visit to the site will be three handshake operations, which is time-consuming. But after the connection is established, it is soon. Because there is no need to shake hands. So the first visit will be a little slower.

I've had the same problem that the server system was fast before reloading and slowed down after reloading.
This eliminates the problem of bandwidth. The pages visited are the same, and the gzip transfers are all open. The transmitted data size is the same.
However, less than 10K of files can be transferred for several seconds, it is not going to make sense.

Later I found that the Hosts file was blank, and then I took

127.0.0.1 localhost

After joining the hosts, the speed is back to normal.

TTFB time is too long, is the server side of the problem, try to optimize from the server side.

The first thing to make sure is that the network is stable

  • Related Article

    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.