This is the 28th day of my participation in Gwen Challenge

Continue to learn about Yahoo’s accelerated website cookies, CSS, etc.

Cookie

Reduce Cookie size

Cookies are related to authentication and personalization functions. Cookies are transmitted almost every HTTP request. Therefore, the size of cookies should be kept small to reduce network load and thus reduce the impact of cookies on response time.

Relevant strategies include:

  1. Eliminate unnecessary cookies
  2. Reduce Cookie size
  3. Set cookies at the appropriate domain level to avoid affecting subdomains (this is exemplified in the next section)
  4. Set an appropriate expiration time (it is better to let cookies expire as soon as possible)

Use cookieless domain names for static components

Cookies are useless for static images, for example, so they should not be used for these requests. It is recommended that cookie-free subdomains be set to link all static components.

For example, www.example.org is the main site, and static resources can be stored under the domain name static.example.org. If cookies are set on the top-level domain name example.org, cookies are also sent when static.example.org is requested, wasting resources. If that happens, you need to buy another domain name to point to static resources.

In addition, some proxies may refuse to cache request information with cookies.

Nuggets home page Cookie view

Let’s take a look at the nuggets for what Yahoo calls Cookie optimization:

Check the situation of Network through Chrome, F12, the domain name and Cookie of the homepage of digging gold are roughly as follows:

https://juejin.cn/ // master site, favicon image, Cookie B-gold-cdn.xitu.io // CSS, Cookie free sf3-SCmcDN2-tos.pstatp.com // SVG, PNG, JS, CDN, Cookie free SF3-TTCDN-tos.pstatp.com // image, CDN, cookie-free i.snssdk.com // Seems to be a third party service, some with Cookie, some without Cookie, Snssdk.com will skip to today's headlines abtestvm.bytedance.com // without cookies McS.snssdk.com // with cookies abtestvm.bytedance.com // without cookies Api.juejin. Cn // With cookies (Options request without cookies) www.google-analytics.com // Without cookies, N-tos.pstatp.com // js, CDN, Cookie free sf6-TTCDN-tos.pstatp.com // image, CDN, Cookie free p9-juejin.byteimg.com // image, CDN, Cookie free sf1-TTCDn-tos.pstatp.com // image, CDN, Cookie free p6-juejin.byteimg.com // image, CDN, cookieless p1-juejin.byteimg.com // Image, CDN, cookieless p3-juejin.byteimg.com // image, CDN, cookielessCopy the code

Refer to the previous content, server, nuggets home page configuration, especially for “splitting components into multiple domains”. The number of CDNS used by the Nuggets is well over four.

  1. Tips for speeding up your website
  2. Suggestions for speeding up your Web site server part 1
  3. Server part 2: Suggestions for speeding up your Website