On 2020-03-18 19:42, Stuart Henderson wrote: > On 2020-03-17, Flipchan <[email protected]> wrote: >> Yeah the point with a cdn is to lower the latency of it so therefor you what >> is needed is just not only a fast http server but a traffic redirector >> depending on the end users origin > > Doing this via redirects does not lower latency, it increases it. > > It may reduce overall time to fetch objects if they are large enough > that faster transfers speed things up enough to offset the higher > latency from connecting to one server, requesting, being redirected, > connecting to the second server, requesting, receiving content.
This is equally true if there are many objects to fetch, especially if they aren't all fetched at once - they don't need to be large for the magic to help. > To reduce latency you need another way to direct users to a nearby > server without doing redirects. Usually either geolocation-aware DNS > that hands out an IP address close to the user's DNS resolver (this > can have problems if the user uses a non-local resolver as is the case > with some DNS privacy services, but is not usually too bad - look at > thd geoip flavour of the isc-bind port, or gdnsd)), or BGP anycast with > connections to other networks around the world (as well as BGP skills, > you need an AS number, at least a /24 of address space that you can use > for this purpose, and hosting providers that will allow you to make BGP > announcements). I've never used this, but it definitely attempts to solve these issues: https://trafficcontrol.apache.org/ IIRC it was developed at Comcast for VOD (ie many large objects), and is built around Apache Traffic Server (ex Yahoo) It uses DNS to get as close as it can, then 302s the first HTTP request based on source IP > Alternatively the pages pulling in the content can do a dynamic > lookup and use a local-to-the-user hostname when referencing > the objects (<script src="//www-eu.example.org/resource.js"> etc.. What kind of in-browser dynamic lookup do you mean here? Something based on language, or maybe localtime? This might also be of interest to the OP: https://developers.google.com/speed/pagespeed/module/ On-the-wire t > Or of course you can outsource it (limelight, vdms, fastly, > cloudflare, cachefly, edgecast, cloudfront, akamai and others). >

