Anycast – Practical Guide to Load Balancing with Anycast

anycastbgpload balancingtcpip

I've read How can I send visitors to the closest server using DNS? post, but there's still some thing, on a practical level that I don't understand.

Say I have two servers. One in NY another in Paris. Both of them have different IP adresses 1.1.1.1, and 1.1.1.2 which were assigned to them by the ISP (or hosting companies)

Which steps do I need to follow so that people in Europe, when they type http://blabla.com:8080 will be translated to the IP of the nearest server with respect to the client?

My final goal is to increase the speed of a TCP-Socket application I've written, by directing users to the nearest server.

UPDATE:
Thank guys for the answers. I guess there's a lot more for me to learn :\ before I can actually achieve this.

Best Answer

Amazon AWS's Route53 is a reliable and well priced global load balancer which utilizes anycast. This is by far the simplest route.

If you want to set up anycast DNS yourself you would need to obtain an IP address and have multiple datacentre locations advertise this IP address in their BGP. Typically people purchase IP address ranges from their relevant authority however I have seen some datacentres that are willing to lease people IP addresses and allow them to advertise them from other datacentres.

The typical set up is that each server has both its own unique IP address and an anycast address. For example:

London has 1.1.1.1 and 3.3.3.3 NY has 1.1.1.2 and 3.3.3.3

A DNS server runs on each server listening on 3.3.3.3 and issues the unique IP for that server.

Remember that anycast is at the IP layer and thus below transport technologies such as TCP. As such, any transport that tracks state (e.g. TCP) is not suitable for anycast. DNS is (usually) UDP and is used as a method of distributing clients to their closest server to make a TCP connection.