I've been scaling out a service very rapidly, and have found a problem in the way I've been balancing the load. My servers do not need a perfectly even distribution, so I was simply using a round robin DNS setup to direct clients to the servers.
However, it is very important that a client not be bounced between servers, and I've found that many of the clients running their software on Ubuntu do NOT cache the DNS result they receive, so they are constantly changing which server they communicate with.
Is there any way to force a DNS record to stick to them, or will I have to begin looking at a software or hardware load balancer? My concern is the latency of a load balancer. If the LB is in the US and the client is directed to the UK, my understanding is the client will always have to connect to the US load balancer before being redirected to the UK.
Best Answer
Unfortunately, there is no way to force a DNS record to stick to a particular user. A load balancer could track a user's session and always send them to the same server. However, it seems that you're running into issues with geographically separated application instances.
In this case, your best bet would to have the following setup:
Using this architecture, an initial HTTP request for a user in the US would look something like this:
This setup will require a total of at least 3 servers. One handling US requests, one handling UK requests, and one that handles redirecting users to the US/UK sites.