Perché le richieste di contenuto statico vengono inviate a un altro sito?

12

Ogni volta che accedo a stackoverflow o ad alcuni siti, vedo molte richieste per siti come http://cdn.sstatic.net/ . Perché questo è fatto piuttosto che servire direttamente dal sito reale? In che modo aiuta ad accelerare un sito web?

    
posta Santosh Linkha 18.01.2011 - 09:04
fonte

3 risposte

11

Furto senza vergogna:

Utilizza domini senza cookie per i componenti

When the browser makes a request for a static image and sends cookies together with the request, the server doesn't have any use for those cookies. So they only create network traffic for no good reason. You should make sure static components are requested with cookie-free requests. Create a subdomain and host all your static components there. If your domain is www.example.org you can host your static components on static.example.org. However, if you've already set cookies on the top-level domain example.org as opposed to www.example.org then all the requests to static.example.org will include those cookies. In this case, you can buy a whole new domain, host your static components there, and keep this domain cookie-free. Yahoo! uses yimg.com, YouTube uses ytimg.com, Amazon uses images-amazon.com and so on.

Another benefit of hosting static components on a cookie-free domain is that some proxies might refuse to cache the components that are requested with cookies. On a related note, if you wonder if you should use example.org or www.example.org for your home page, consider the cookie impact. Omitting www leaves you no choice but to write cookies to *.example.org, so for performance reasons it's best to use the www subdomain and write the cookies to that subdomain.

    
risposta data 18.01.2011 - 09:10
fonte
5

Quando è stato aggiunto a Stack Overflow nell'agosto del 2009, Jeff, come ci si aspetterebbe, ha scritto tutto sul blog SO . Se continui a leggere, ci sarà qualche discussione in più in seguito.

Essenzialmente, si tratta di ridurre il traffico di cookie.

    
risposta data 18.01.2011 - 11:35
fonte
4

I cookie vengono inviati con ogni richiesta ai domini con i cookie memorizzati. Impostando un dominio senza cookie, la dimensione delle richieste viene ridotta e la velocità delle richieste aumenta, questo è utile per il contenuto statico.

    
risposta data 18.01.2011 - 09:08
fonte

Leggi altre domande sui tag