Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We've got a Java webapp. It's a simple .war file. We allow customers to sign up for our service and they get their own URL: which points at a special instance of our app just for them.

We've got the system up and running on a single server, but now we need to figure out how to distribute it. When the customers sign up they're going to get assigned to a particular server. We can handle that. What I can't figure out is how to get to point to the right box.

Because we let people sign up on their own, we can't manually add CNAME records to a DNS server to map the subdomain to an IP. Plus, I don't know if a DNS server can handle the tens of thousands of customers we hope to have some day.

Is there some way to do this dynamically? I expect we'll be able to store a subdomain/ip mapping in a mysql database somewhere. Is there a DNS server that can use it? Or is there a better load-balancer front-end traffic distributor that we should be using?

share|improve this question
up vote 0 down vote accepted

Because you have control of the domain I think you have every reason to use DNS for this. Heres a couple options:

  • Run your own DNS Server and write the new A records to the zone file automatically when the user signs up. When the customer signs up via your web interface you call a Shell Script that runs via SSH on your DNS Server to write the entry to the file. Pass in variables for the customer's domain and which server you want them on.

  • Or you can use a DNS Service like and automate it via their API.

The script would would like something like:

cat > /etc/DNSSERVER/Zonefile <<-_EOF1_
IN  A   $serverip   $ 

Pass in the variables when you execute the script (which are collected via form on your site upon signup):

./ <customername>

DNS was specifically designed to handle any number of requests you can throw at it...

share|improve this answer
This looks like the right answer. I'll poke around and see if any of the cloud providers I might use have this sort of service. – Shef Nov 10 '10 at 20:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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