summaryrefslogtreecommitdiff
path: root/ndb
diff options
context:
space:
mode:
authorunknown <stewart@mysql.com>2005-11-16 19:47:03 +1100
committerunknown <stewart@mysql.com>2005-11-16 19:47:03 +1100
commit74ae82f5c4ed135f4edbc0aa223a45fdd507cb3b (patch)
treea8fc116dd9dc3389840579c8a62f73800b225429 /ndb
parent517967de1ab922113a97d0dd19d0c2ea50978c67 (diff)
downloadmariadb-git-74ae82f5c4ed135f4edbc0aa223a45fdd507cb3b.tar.gz
WL#2779 ndb_size.pl
Add display of minimum requirements for various cluster parameters e.g. DataMemory, IndexMemory, MaxNoOfTables, MaxNoOfAttributes etc and the memory usage because of them. ndb/tools/ndb_size.pl: Computer minimum parameter settings (MaxNoOfTables, Attributes, Indexes, Triggers) and the memory usage because of these settings. ndb/tools/ndb_size.tmpl: display parameters
Diffstat (limited to 'ndb')
-rw-r--r--ndb/tools/ndb_size.pl57
-rw-r--r--ndb/tools/ndb_size.tmpl40
2 files changed, 96 insertions, 1 deletions
diff --git a/ndb/tools/ndb_size.pl b/ndb/tools/ndb_size.pl
index 0203b0c1112..ece0901e0b2 100644
--- a/ndb/tools/ndb_size.pl
+++ b/ndb/tools/ndb_size.pl
@@ -64,6 +64,14 @@ my $tables = $dbh->selectall_arrayref("show tables");
my @table_size;
+my @dbDataMemory;
+my @dbIndexMemory;
+my @NoOfAttributes;
+my @NoOfIndexes;
+my @NoOfTables;
+$NoOfTables[$_]{val} = @{$tables} foreach 0..$#releases;
+
+
sub align {
my($to,@unaligned) = @_;
my @aligned;
@@ -147,7 +155,10 @@ foreach(@{$tables})
elsif($type =~ /binary/ || $type =~ /char/)
{@realsize=($size,$size,$size)}
elsif($type =~ /text/ || $type =~ /blob/)
- {@realsize=(256,256,1)} # FIXME check if 5.1 is correct
+ {
+ @realsize=(256,256,1);
+ $NoOfTables[$_]{val} += 1 foreach 0..$#releases; # blob uses table
+ } # FIXME check if 5.1 is correct
@realsize= align(4,@realsize);
@@ -265,7 +276,51 @@ foreach(@{$tables})
IndexMemory=>\@IndexMemory,
};
+
+ $dbDataMemory[$_]{val} += $DataMemory[$_]{val} foreach 0..$#releases;
+ $dbIndexMemory[$_]{val} += $IndexMemory[$_]{val} foreach 0..$#releases;
+ $NoOfAttributes[$_]{val} += @columns foreach 0..$#releases;
+ $NoOfIndexes[$_]{val} += @indexes foreach 0..$#releases;
+}
+
+my @NoOfTriggers;
+# for unique hash indexes
+$NoOfTriggers[$_]{val} += $NoOfIndexes[$_]{val}*3 foreach 0..$#releases;
+# for ordered index
+$NoOfTriggers[$_]{val} += $NoOfIndexes[$_]{val} foreach 0..$#releases;
+
+my @ParamMemory;
+foreach (0..$#releases) {
+ $ParamMemory[0]{releases}[$_]{val}= POSIX::ceil(200*$NoOfAttributes[$_]{val}/1024);
+ $ParamMemory[0]{name}= 'Attributes';
+
+ $ParamMemory[1]{releases}[$_]{val}= 20*$NoOfTables[$_]{val};
+ $ParamMemory[1]{name}= 'Tables';
+
+ $ParamMemory[2]{releases}[$_]{val}= 10*$NoOfIndexes[$_]{val};
+ $ParamMemory[2]{name}= 'OrderedIndexes';
+
+ $ParamMemory[3]{releases}[$_]{val}= 15*$NoOfIndexes[$_]{val};
+ $ParamMemory[3]{name}= 'UniqueHashIndexes';
}
$template->param(tables => \@table_size);
+$template->param(Parameters => [{name=>'DataMemory (kb)',
+ releases=>\@dbDataMemory},
+ {name=>'IndexMemory (kb)',
+ releases=>\@dbIndexMemory},
+ {name=>'MaxNoOfTables',
+ releases=>\@NoOfTables},
+ {name=>'MaxNoOfAttributes',
+ releases=>\@NoOfAttributes},
+ {name=>'MaxNoOfOrderedIndexes',
+ releases=>\@NoOfIndexes},
+ {name=>'MaxNoOfUniqueHashIndexes',
+ releases=>\@NoOfIndexes},
+ {name=>'MaxNoOfTriggers',
+ releases=>\@NoOfTriggers}
+ ]
+ );
+$template->param(ParamMemory => \@ParamMemory);
+
print $template->output;
diff --git a/ndb/tools/ndb_size.tmpl b/ndb/tools/ndb_size.tmpl
index 5d9fc8bf0c5..dc02b5a5970 100644
--- a/ndb/tools/ndb_size.tmpl
+++ b/ndb/tools/ndb_size.tmpl
@@ -15,6 +15,46 @@ td,th { border: 1px solid black }
<p>This information should be valid for MySQL 4.1 and 5.0. Since 5.1 is not a final release yet, the numbers should be used as a guide only.</p>
+<h2>Parameter Settings</h2>
+<p><b>NOTE</b> the configuration parameters below do not take into account system tables and other requirements.</p>
+<table>
+ <tr>
+ <th>Parameter</th>
+ <TMPL_LOOP NAME=releases>
+ <th><TMPL_VAR NAME=rel></th>
+ </TMPL_LOOP>
+ </tr>
+<TMPL_LOOP NAME=Parameters>
+ <tr>
+ <td><TMPL_VAR NAME=name></td>
+ <TMPL_LOOP NAME=releases>
+ <td><TMPL_VAR NAME=val></td>
+ </TMPL_LOOP>
+ </tr>
+</TMPL_LOOP>
+</table>
+
+<h2>Memory usage because of parameters</h2>
+
+<p>Usage is in kilobytes. Actual usage will vary as you should set the parameters larger than those listed in the table above.</p>
+<table>
+ <tr>
+ <th>Parameter</th>
+ <TMPL_LOOP NAME=releases>
+ <th><TMPL_VAR NAME=rel></th>
+ </TMPL_LOOP>
+ </tr>
+<TMPL_LOOP NAME=ParamMemory>
+ <tr>
+ <td><TMPL_VAR NAME=name></td>
+ <TMPL_LOOP NAME=releases>
+ <td><TMPL_VAR NAME=val></td>
+ </TMPL_LOOP>
+ </tr>
+</TMPL_LOOP>
+</table>
+
+<h2>Table List</h2>
<ul>
<TMPL_LOOP NAME="tables">
<li><a href="#<TMPL_VAR NAME="table">"><TMPL_VAR NAME="table"></a></li>