The maximum number of concurrent browser requests with the same domain name



2. Optimize

1.cookie free

Cookie free: When a small static image or file is downloaded, the browser attaches the cookie information to the header of the request as a normal request. In fact, 99.99% of small static images, small static files need to know any cookie information. When you attach 1kB cookies to each of your headers, that’s an additional 50kB transfer for a complex web page with 50 small files. To prevent the browser from sending these useless cookies, static resources and hosts are usually placed under different domains.

2.domain hash

Using multiple domain names increases concurrency (because browsers are domain-based concurrency control, not page concurrency), but too much spread can lead to an additional cost in DNS resolution, so the limit is usually between 2 and 4. A common performance pitfall here is that there is no mechanism to ensure URL hash consistency (i.e. the same static resource should be hashed into the same domain name), resulting in multiple downloads of the resource.

3.css sprites

Due to the rich and multi-talented webpage, often a page will be loaded in a lot of pictures, in order to solve the problem of concurrent image request, use Sprite or iconfont to solve this problem

4.js/css combine

Browsers that parse incoherently can cause multiple re-renderings, and to solve this problem often compress content with extra whitespace, empty lines, and comments

5. Max expires time:

Set the client cache duration properly.

6.loading images on demand

Images are loaded on demand.