Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm setting up a name server hosting DNS for a large number of domains, 50,000 - 100,000 domains.

I will be using Bind9 and the service will need to be restarted several times a day.

I have made some tests and it seems that restart of the Bind9 service scales very poorly with the number of domains.

 #domains | restart time
 -----------------------
   10,000 |    3.1 sec
   25,000 |    8.9 sec
   50,000 |     50 sec
  100,000 |   7:50 min

Is there some way to speedup the restart of the service? I have noticed that restart only utilizes one core, is there some way for it to use more cores?

The Bind9 version is 9.7.1-P2 with default configuration.

The server running Bind9 is a Intel Core 2 Due 2.93 GHz with 4 GB memory and Ubuntu Server 10.10.

Any help will be appreciated.

share|improve this question
6  
Can I ask why it needs to be restarted several times a day? (is rndc reload not enough or does that take just as long?) –  SmallClanger Jan 6 '11 at 9:40
3  
Why do you need to restart bind several times a day? –  Khaled Jan 6 '11 at 9:40
    
Reloads takes about 10 sec. but it seems reload isn't always enough when adding new domains. –  Jakob Jan 6 '11 at 12:24
1  
Jakob: I'm running bind servers on shared hosting systems with domains being added and removed every minute. The uptime for the named process is currently at over 3 months. If you're having to restart to add domains, there is something wrong with how you're adding them! –  Niall Donegan Jan 6 '11 at 12:39
1  
I don't run a system as large as that but it seems to me that the many thousands of other providers that do run such systems don't appear to be having the same issues. That just has to be a clue. –  John Gardeniers Jan 6 '11 at 21:28

2 Answers 2

up vote 0 down vote accepted

That's a lot of domains :)

Okay - there's an inherent problem with BIND and its flat file configuration method which you've encountered; it doesn't scale. I think you're actually doing well to start it in 7 mins, I've heard of the same amount of domains take over 30 mins.

The recommended solution is to move to a database backed solution for the domain configuration. In overall performance, it will be a bit slower (like maybe 15%) in terms of max queries per second but it should greatly improve startup performance.

It's been a while since I did this with BIND, but there were patches available to make it use DNS. Maybe there's full blown packages available, I don't know. I remember a problem with it was that it made a new MySQL connection for every domain which is Bad(tm).

What I'd actually suggest is to try an alternative DNS server, optimised for this sort of thing. I went for PowerDNS as a previous solution. It's fast and its design architecture has been planned for hundreds of thousands to millions of domains, and of course is database backed.

Failing that, I guess you could try putting the config file on tmpfs or something to keep it in memory, but I don't think that would improve performance all that much, since you're not really I/O bound, more CPU bound.

share|improve this answer
    
Oh, also, BIND9 is multithreaded and should be running multiple threads for each core you have, but under the one process. So you'll see 1 process but it should have multiple threads. –  Rafiq Maniar Jan 6 '11 at 9:54
    
When I look at top one cpu is at 100% utilization the other one is at 0% –  Jakob Jan 6 '11 at 12:26
    
You can specify the "-n <num cores>" option to BIND in order to manually set how many threads to use. On Ubuntu that should be in /etc/defaults/bind9 and something like: OPTIONS="-n 2" –  Rafiq Maniar Jan 7 '11 at 4:38

I do recommend Jan-Piet's book:

Alternative DNS Servers on Amazon or PDF version (free).

You'll find answers to all your questions regarding Bind and other DNS servers :).

share|improve this answer

Your Answer

 
discard

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.