I have a domain set up on my hosting account, which is a shared host.

It has been doing fine, but as the site becomes more popular the response times are getting slower and slower, and sometimes gives 503 error (it's an API, so people are hitting it and need a speedy response time).

It's got to the point now where the shared host is buckling. So I have purchased a VPS which should be able to handle the load.

My question is, instead of directing all traffic to this VPS, is there a way of distributing it between the two?

If I can have 2 A records, how does the browser determine which one it visits first?

  • 1
  • yes, but as others have said, it will randomly send traffic to both, and can totally break sessions and other thing that rely on state being maintained on the server. as for which one it visits. bind will return the A records in random order and in most cases the browser just takes the top one. But also if one goes down, is slow. X% (50 in a perfect world) of the requests will go to the down/overloaded server
    – Doon
    Aug 5 '13 at 14:09

Yes you can.

It is called round-robin DNS, and the browser just chooses one of them randomly.

It is a well used method of getting cheap load balancing, but if one host goes down, users will still try to access it.

  • +1 Thought the browser doesn't (usually) do the choosing, the result is essentially random.
    – Chris S
    Aug 5 '13 at 14:14
  • ok that makes a lot of sense, thanks a lot for your help. I may need to re-think how I handle this then :) Aug 5 '13 at 14:31

To be more precise, you can't add "2 different A-records", but you can always add multiple IP addresses to point to the same domain name under a single record set.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.