15

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?

  • 2
    http://en.wikipedia.org/wiki/Round-robin_DNS – ceejayoz Aug 05 '13 at 14:03
  • 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 05 '13 at 14:09

2 Answers2

24

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.

Frederik
  • 3,293
  • 3
  • 30
  • 46
3

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.