3150. [func] Improved startup and reconfiguration time by

enabling zones to load in multiple threads. [RT #25333]
This commit is contained in:
Evan Hunt
2011-09-02 21:15:39 +00:00
parent 541dd4d80f
commit 8a2ab2b920
37 changed files with 1873 additions and 177 deletions

View File

@@ -1,9 +1,17 @@
These scripts generate a named.conf file with an arbitrary number of
small zones, for testing startup performance.
To generate a test server with 1000 zones, run:
To generate a test server with 1000 zones each of which contains 5 A
records, run:
$ sh setup.sh 1000 > named.conf
$ sh setup.sh 1000 5 > named.conf
Zones are generated with random names, and all of them load from the same
file: smallzone.db.
Zones are generated with random names, and the zone files are created
in the subdirectory "zones".
Or, to generate a test server with 100 zones which all load from the same
generic file (smallzone.db):
$ sh setup.sh -s 100 > named.conf
The "number of records" argument is ignored if -s is used.

View File

@@ -0,0 +1,3 @@
#!/bin/sh
rm -rf zones
rm -f named.conf

View File

@@ -14,17 +14,19 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: makenames.pl,v 1.2 2011/07/06 05:05:51 each Exp $
# $Id: makenames.pl,v 1.3 2011/09/02 21:15:35 each Exp $
use strict;
die "Usage: makenames.pl <num>" if (@ARGV == 0);
die "Usage: makenames.pl <num> [<len>]" if (@ARGV == 0 || @ARGV > 2);
my $len = 10;
$len = @ARGV[1] if (@ARGV == 2);
my @chars = split("", "abcdefghijklmnopqrstuvwxyz123456789");
srand;
for (my $i = 0; $i < @ARGV[0]; $i++) {
my $name = "";
for (my $j = 0; $j < 10; $j++) {
for (my $j = 0; $j < $len; $j++) {
my $r = rand 35;
$name .= $chars[$r];
}

View File

@@ -0,0 +1,51 @@
#!/usr/bin/perl
#
# Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: mkzonefile.pl,v 1.2 2011/09/02 21:15:35 each Exp $
use strict;
die "Usage: makenames.pl zonename num_records" if (@ARGV != 2);
my $zname = @ARGV[0];
my $nrecords = @ARGV[1];
my @chars = split("", "abcdefghijklmnopqrstuvwxyz");
print"\$TTL 300 ; 5 minutes
\$ORIGIN $zname.
@ IN SOA mname1. . (
2011080201 ; serial
20 ; refresh (20 seconds)
20 ; retry (20 seconds)
1814400 ; expire (3 weeks)
600 ; minimum (1 hour)
)
NS ns
ns A 10.53.0.3\n";
srand;
for (my $i = 0; $i < $nrecords; $i++) {
my $name = "";
for (my $j = 0; $j < 8; $j++) {
my $r = rand 25;
$name .= $chars[$r];
}
print "$name" . "\tIN\tA\t";
my $x = int rand 254;
my $y = int rand 254;
my $z = int rand 254;
print "10.$x.$y.$z\n";
}

View File

@@ -14,13 +14,30 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: setup.sh,v 1.3 2011/07/07 23:47:49 tbox Exp $
# $Id: setup.sh,v 1.4 2011/09/02 21:15:35 each Exp $
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <number of zones>"
usage () {
echo "Usage: $0 [-s] <number of zones> [<records per zone>]"
echo " -s: use the same zone file all zones"
exit 1
}
if [ "$#" -lt 1 -o "$#" -gt 3 ]; then
usage
fi
single_file=""
if [ $1 = "-s" ]; then
single_file=yes
shift
fi
nzones=$1
shift
nrecords=5
[ "$#" -eq 1 ] && nrecords=$1
. ../system/conf.sh
cat << EOF
@@ -59,6 +76,12 @@ logging {
EOF
$PERL makenames.pl $1 | while read zonename; do
$PERL makenames.pl $nzones | while read zonename; do
if [ $single_file ]; then
echo "zone $zonename { type master; file \"smallzone.db\"; };"
else
[ -d zones ] || mkdir zones
$PERL mkzonefile.pl $zonename $nrecords > zones/$zonename.db
echo "zone $zonename { type master; file \"zones/$zonename.db\"; };"
fi
done