在前段优化中关于DNS的有两点:
减少DNS的请求次数
进行DNS预先获取。
早上看到一篇文章里面的一句话,如下:
The main reason for rel=dns-prefetch to exist is to speed up the way web pages load when they are using different domains for page resources.
It can achieve pagespeed gains by effectively controlling the manner in which DNS lookup times take place.
This process is often called "DNS prefetching".
所以这个DNS预解析,在一般所以资源都在同一个域名下的情况下是不需要的意思?
其实最关心的是,用这个标签,会不会有什么负面的影响???有木有很懂的人,求指教O(∩_∩)O~~
参考文档:
[DNS Prefetching的两三事] http://www.jianshu.com/p/c3a1...
[rel=dns-prefetch] https://varvy.com/rel/dns-pre...
PHP中文网2017-04-17 15:06:26
Regarding the first question, because the browser caches DNS, so if the page has only one domain name, all parsing will be read from the cache. At this moment, there is really no need to do pre-parsing.
Regarding the second question, repeated DNS pre-resolution on multiple pages will increase the number of repeated DNS queries, that is, the same domain name has a pre-resolution tag added.