Causes and solutions that cause the website to open slowly?

Source: Internet
Author: User
Tags server website browser cache

 
Recent Customer Response Server website open slow, check server network and hardware are no problem, hereby find this article to learn! Research shows that: open the Web page, the user most satisfied with the time is 2-5 seconds, if the user waits more than 10 seconds, 99% of users will close this page. So, what causes the website to open slowly? What is the solution? In general, too many HTTP requests, Web pages too large, poor server performance, and so on can cause the site to open slowly. Here we share some reference solutions from a technical level:
1. Reduce the number of HTTP requests
When you open a webpage, the background program's response is not too much time, waiting for the time is mainly spent on downloading the elements of the page, that is, HTML, CSS, JavaScript, Flash, pictures and so on. According to statistics, each additional element, the page load time will be increased by 25-40 milliseconds (depending on the user's bandwidth situation).
Therefore, to improve the speed of Web pages, you can reduce the number of HTTP requests, here are the following 3 ways:
(1) For example, using CSS code instead of some pictures (such as rounded pictures), as much as possible to reduce the use of images.
(2) Merging files, for text files, you can merge content directly. If you combine multiple JavaScript files into one, combine multiple CSS files into one.
(3) Optimize the cache, for unchanged page elements (such as page header, footer, etc.), the user is not necessary to re-download, can be read directly from the browser cache.
2. The style sheet is placed in the head section of the Web page
After the actual test, the style sheet (CSS file) is moved to the head part of the Web page, which can increase the loading speed of the effective page and make the page element order display.
3. Using CDN (contentdeliverynetwork, Content distribution network)
A CDN consists of a series of Web servers dispersed across different geographic locations that specify a server to respond to a user's request based on how close to the user is to the network. When your website pictures a lot of things, just like to use a CDN, such as the current e-commerce website, almost all use CDN. Many CSS style frameworks and JS frameworks provide CDN services, such as Bootstrap and so on.
4. Compress page Elements
Obviously, the smaller the elements in the page, the less time it takes to download. Now more mature and the process of compressing the Web page by gzip compression, generally can reduce the text content of the Web page by more than 60%.
5, put the JS file at the bottom of the page
When the Web page opens, all elements are displayed in order. However, because JS has a special, relative to other elements, will be loaded slower, before the JS file download is complete, the sequence of other elements behind the display will be blocked, so the JS file as far as possible on the bottom, meaning that the content can be quickly displayed.
6. Put style sheets and JS scripts in external files
While we can write stylesheets and JS scripts directly into the Web page HTML, we can reduce the number of external file calls, but doing so will increase the file size of the page. Putting stylesheets and JS scripts in an external file may be a bit slow for the first time, but subsequent visits to the site can be done by the user directly through the browser cache, thus reducing the number of HTTP requests for optimal practice.

In addition, when choosing server space, pay attention to the performance of server space, sometimes, slow, not the problem of the website program, it is possible that server space is too bad, not enough to bear high concurrency. For details, please contact Xiao Mei, qq:2881064157!

Causes and solutions that cause the website to open slowly?

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.