Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the rules for high-performance website optimization

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "what are the rules of high-performance website optimization". The explanation in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian and go deep into it slowly to study and learn "what are the rules of high-performance website optimization" together!

Golden Rule of Performance:

Only 10 - 20% of end-user response time is spent downloading HTML documents. The remaining 80 - 90% of the time is spent on all the components in the download page.

Rule 1 Reduce HTTP requests

This can be done by using image maps, CSS Sprites (pros and cons), inline images (data: URL mode, IE does not support, cannot be cached), merge scripts and style sheets.

Rule 2 Use Content Distribution Networks

If the application web server is closer to the user, the response time for an HTTP request will be shorter;

If the component web server is closer to the user, the response time for multiple HTTP requests will decrease.

A content distribution network (CDN) is a group of web servers distributed across multiple geographic locations to distribute content more efficiently to users.

Rule 3 Add Expires header

The Expires header is used by the web server to tell the web client that it can use the current copy of a component until a specified time. Require strict synchronization of the server clock with the client clock and provide a new date in the server configuration after the time expires.

Max-Age and mod_expires compensate for Expires.

Rule 4 Compress Components

Starting with HTTp1.1,

Rule 5: Place style sheets at the top

Gradually present, avoid white screen

Rule 6 Put scripts at the bottom

The HTTP 1.1 specification recommends that browsers download two components from each hostname in parallel, which is effectively disabled when downloading scripts.

One reason is that scripts might use [xss_clean] to modify page content, so the browser waits to make sure the page is laid out properly;

The second reason is to ensure that scripts execute in the correct order. If multiple scripts are downloaded in parallel, there is no guarantee that the responses will arrive in a particular order.

Placing a script on top blocks rendering of the content behind it and blocks downloading of the components behind it.

Rule 7 Avoid CSS Expressions

The expression method is ignored by other browsers, but is a useful tool for IE. Ability to set properties in IE to create a consistent experience across browsers. For example, IE[IE6, IE7 (Quirk), IE8 (Quirk)] does not support the min-width attribute, which can be solved by using the expression:

The code is as follows:

width: _expression(document.body.clientwidth

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report