A standalone domain name refers to a first-level domain name rather than a second- or third-level domain name
Static resources for large websites are placed under separate domain names.
- Many mechanisms of the browser have a great impact on the speed of website access (such as the browser's caching mechanism for static resources), and the browser supports concurrent access to resources in order to improve the efficiency of page display. The browser's limit on the number of concurrent requests is for domain names, that is, the limit on the number of concurrent requests supported for the same domain name (including second-level domain names) at the same time. If the number of requests exceeds the limit, it blocks. Therefore, the use of different first-level domain names for some static resources in the website can increase the number of parallel requests by the browser and accelerate the acquisition speed of interface resources
-
Cookies are transmitted when requested by the network
When a static resource is under the same domain name as the main service (according to business needs, the main service needs to pass cookie information when requesting), each request for a static resource will send a cookie under the same domain name. For static resources, the server doesn't need to do anything with cookies, they're just pointlessly consuming bandwidth.
Assuming that the website cookie information has 1 KB and the home page of the website has a total of 150 resources, the user needs to send 150 KB of cookie information during the request process, and under the common upstream bandwidth of 512 Kbps, it takes up to 3 seconds to send it all. In many cases, the path of cookies is available under the entire first-level domain name, and if you set the static resource to a second-level domain name, then it will not avoid cookies. For example, if a cookie is set for http://126.com, it will infect all subdomains, request http://www.126.com/logo.gif or http://image.126.com/logo.gif with nasty cookies.
So for static resources use a separate domain name and set to no cookies to reduce the request size and improve web page performance. Enable the new first-level domain name so that the browser does not carry cookies with each request. This is a large cookie content, and the traffic of the website will save a lot of broadband costs
-
Easy to offload or cache
Dynamic and static separation. Static resources are separated from dynamic content, which is conducive to deployment in CDNs. Static resources are deployed independently for global product services. Easy to reuse, files placed on one server can be used by products on other servers. For example taobao.com and tmll.com use static resources on tbcdn.cn that do not have to be subordinate to a product.
This also helps maximize the use of client-side caching. For example, when accessing taobao.com, a js file on the tbcdn.cn is cached, and then when the tmll.com is accessed, the js file is also used, and it is not necessary to download it from the tbcdn.cn, and directly use the client cache.