Home > MySQL Clusterメモリ容量の見積

MySQL Clusterメモリ容量の見積

  • May 1, 2008 7:10 PM

Data Nodeは4つ、NoOfReplicasは2つ、のMySQL Cluster環境。

mysqlslapでデータを生成する。

./bin/mysqlslap --user=root \ --host=localhost \ --password=root \ --auto-generate-sql \ --auto-generate-sql-guid-primary \ --engine=ndbcluster \ --number-int-cols=5 \ --number-char-cols=5 \ --protocol=tcp \ --concurrency=1 \ --auto-generate-sql-write-number=1000 \ --auto-generate-sql-execute-number=1 \ --iteration=1 \ --only-print \ --auto-generate-sql-load-type=write >> xxx.txt

xxx.txtの最終行のdrop文を削除して、実行する。
データ数も念のためカウントして1000行入っていることを確認する。

この1000行のデータロード前と後とで、"all dump 1000"でデータ消費量を確認する。

データ挿入前


2008-05-01 18:24:17 [MgmSrvr] INFO -- Node 2: Data usage is 0%(24 32K pages of total 2560)
2008-05-01 18:24:17 [MgmSrvr] INFO -- Node 2: Index usage is 0%(17 8K pages of total 2336)
2008-05-01 18:24:17 [MgmSrvr] INFO -- Node 2: Resource 0 min: 0 max: 639 curr: 0
2008-05-01 18:24:17 [MgmSrvr] INFO -- Node 3: Data usage is 0%(24 32K pages of total 2560)
2008-05-01 18:24:17 [MgmSrvr] INFO -- Node 3: Index usage is 0%(17 8K pages of total 2336)
2008-05-01 18:24:17 [MgmSrvr] INFO -- Node 3: Resource 0 min: 0 max: 639 curr: 0
2008-05-01 18:24:17 [MgmSrvr] INFO -- Node 4: Data usage is 1%(32 32K pages of total 2560)
2008-05-01 18:24:17 [MgmSrvr] INFO -- Node 4: Index usage is 0%(18 8K pages of total 2336)
2008-05-01 18:24:17 [MgmSrvr] INFO -- Node 4: Resource 0 min: 0 max: 639 curr: 0
2008-05-01 18:24:17 [MgmSrvr] INFO -- Node 5: Data usage is 1%(32 32K pages of total 2560)
2008-05-01 18:24:17 [MgmSrvr] INFO -- Node 5: Index usage is 0%(18 8K pages of total 2336)
2008-05-01 18:24:17 [MgmSrvr] INFO -- Node 5: Resource 0 min: 0 max: 639 curr: 0

データ挿入後

2008-05-01 18:32:19 [MgmSrvr] INFO -- Node 2: Data usage is 2%(62 32K pages of total 2560) 2008-05-01 18:32:19 [MgmSrvr] INFO -- Node 2: Index usage is 0%(22 8K pages of total 2336) 2008-05-01 18:32:19 [MgmSrvr] INFO -- Node 2: Resource 0 min: 0 max: 639 curr: 0 2008-05-01 18:32:19 [MgmSrvr] INFO -- Node 3: Data usage is 3%(78 32K pages of total 2560) 2008-05-01 18:32:19 [MgmSrvr] INFO -- Node 3: Index usage is 0%(22 8K pages of total 2336) 2008-05-01 18:32:19 [MgmSrvr] INFO -- Node 3: Resource 0 min: 0 max: 639 curr: 0 2008-05-01 18:32:19 [MgmSrvr] INFO -- Node 4: Data usage is 2%(74 32K pages of total 2560) 2008-05-01 18:32:19 [MgmSrvr] INFO -- Node 4: Index usage is 1%(24 8K pages of total 2336) 2008-05-01 18:32:19 [MgmSrvr] INFO -- Node 4: Resource 0 min: 0 max: 639 curr: 0 2008-05-01 18:32:19 [MgmSrvr] INFO -- Node 5: Data usage is 3%(90 32K pages of total 2560) 2008-05-01 18:32:19 [MgmSrvr] INFO -- Node 5: Index usage is 1%(24 8K pages of total 2336) 2008-05-01 18:32:19 [MgmSrvr] INFO -- Node 5: Resource 0 min: 0 max: 639 curr: 0

計算すると、こんな感じ。
データ用:((62-24)+(78-24)+(74-32)+(90-32))*32K=192*32K=6144K
インデックス用:((22-17)+(22-17)+(24-18)+(24-18))*8K=22*8K=176K

で、テーブルスキーマは、こんな感じ

CREATE TABLE `t1` (
`id` varchar(32) NOT NULL,
`intcol1` int(32) DEFAULT NULL,
`intcol2` int(32) DEFAULT NULL,
`intcol3` int(32) DEFAULT NULL,
`intcol4` int(32) DEFAULT NULL,
`intcol5` int(32) DEFAULT NULL,
`charcol1` varchar(128) DEFAULT NULL,
`charcol2` varchar(128) DEFAULT NULL,
`charcol3` varchar(128) DEFAULT NULL,
`charcol4` varchar(128) DEFAULT NULL,
`charcol5` varchar(128) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=ndbcluster

このテーブルスキーマから計算すると、
INT: 4*5=20
VARCHAR: 36+5*132=696
Total 716 byte
となるのだけど、716*1000と6166Kは違う。

原因は、

1.この式がおかしい

2.データ挿入前の分を引いたのだけど、これが余分だった。
引かないと、データは9728K byteとなるのだけど、これも716*1000とはちょっと違う。

関連エントリー

Home > MySQL Clusterメモリ容量の見積

Search
Feeds

Return to page top