On several large-scale websites, I've seen being redirected from http://www.example.com/ to http://www2.example.com/
One of such examples is Netflix.
My hypothesis is that this is used to:
Either distribute the load across data centers before even reaching the load balancers (clients from some IPs are redirected to
www2.
during a session, while others still usewww.
),Or, less probably, switch users to another data center during a maintenance operation. I say "less probably" since those switches are quite frequent—I hardly doubt maintenance operations on front load balancers are done that often.
In the first case, what are the benefits of this technique?
In the second case, wouldn't a change in DNS records be enough?
It's used to load balance.
You can use DNS to point www.example.com to one IP, www2.example.com to another IP, www3.example.com to yet another IP and so on and so on. And, in fact, this is how it's used. If you look at the DNS records for the domain, you should see an entry for
www
pointing to one IP,www2
pointing to another IP, and so on. It's a simple way to horizontally scale a website across multiple hosts, and as you note, it can also be use to horizontally scale across multiple datacenters or load balancers as well.As to why, primarily because it's extremely simple, much cheaper than transparent load balancing and very easy to scale. By comparison, dedicated load balancing appliances are very complicated, expensive and difficult to configure, support and scale out.
In the website world some people use ww2 to load balance and/or do A/B testing with "real user load" on a second cluster . Sometime its just a trick used to load with real user and do some benchmark on new stuff :)
WWW2 or WWW3 may also refer to:
typically used to identify a series of closely related websites within a domain, such as www.example.org, www2.example.org, and www3.example.org; the series may be continued with additional numbers: WWW4, WWW5, WWW6 etc. Traditionally, such websites are mirrors used for server load balancing. In some cases, the specific hostname may be obscured, creating the appearance that the user is viewing the "www" subdomain, even if they are actually viewing a mirror site.