Home > Archives > May 2008 Archive

May 2008 Archive

MySQL Cluster 6.2

  • May 29, 2008 12:51 PM

2008/5/21に(何の前触れも無く)突然MySQL Clusterの配布形態が変更された。
MySQL 5.1.24から正式にMySQL Clusterが別ソースツリーとして管理され、通常のMySQL Serverには組み込まれないことがアナウンスされた。
MySQL Clusterは次のURLからダウンロードする。
http://dev.mysql.com/downloads/cluster/

MySQL Cluster Carrier Grade Editionは、Data Nodeのバグ修正及び機能追加に焦点をあてた、MySQL Clusterの上位バージョンである。MySQL Server (SQL Node)に特に変更はない。

主な特徴は以下の通り。

・通常のMySQL Clusterよりもバグの修正が早い
・バックアップのステータスが細かくロギングされる
・Data Nodeのメモリ利用効率が良い
・DUMPコマンドの追加(トランザクションやロックの状態追跡)
・オンラインでカラムの追加、インデックスの追加、インデックスの削除が可能になった(以前はシングルユーザーモードにする必要があった)
・主キーアクセスのパフォーマンス向上

2008/5/20まで、MySQL Cluster 5.1の利用を検討する際は、次の2つのバージョンから選択していた。

名称 ライセンス 配布形態 バージョン表記など
MySQL Cluster 5.1 GPL/Commercial ソースコード/バイナリ
MySQL Cluster 5.1, CGE GPL/Commercial ソースコード CGE 6.2, MySQL 5.1.23-ndb-6.2.14,
CGE 6.3など


2008/5/21より、今まで”MySQL Cluster”と呼んでいたバージョンがなくなり、CGEのソースコードをベースとしたMySQL Cluster SE (Standard Edition)とCGEの二種類となった。

名称 ライセンス 配布形態 バージョン表記など
MySQL Cluster 6.2, SE (Standard Edition) GPL/Commercial ソースコード/バイナリ 機能はCGE 6.2相当
mysql-5.1.23-ndb-6.2.15など
MySQL Cluster 6.2 CGE GPL/Commercial ソースコード

MySQL Cluster “SE”と付いていれば新しい名称と分かる。また、MySQL Cluster “6.2”というバージョンを見れば、新しい名称を用いていることが分かる。しかし、単に”MySQL Cluster”とだけ書いてしまうと、それがCGEベースのSEのことなのか、あるいは5.1.23以前のMySQL Clusterのことを指しているのか分かりづらい。

またバージョンのつけ方も分かりづらい。新しい名称では、Data Nodeのバージョンをベースとしている。混乱しないためには、完全なバージョンをつけて指定すると良い。
mysql-5.1.23-ndb-6.2.15、またはMySQL 5.1.23-ndb-6.2.14などと記せば、MySQL ServerのバージョンおよびData Nodeのバージョンが分かりやすい。

http://www.mysql.com/products/database/cluster/
にSEとCGEの機能比較表が掲載されており、今までのCGEが二つのバージョンに分岐している。

MySQL Cluster Feature SE CGE
Main memory database (tables/indexes) Yes Yes
Main memory transaction management Yes Yes
ACID compliance Yes Yes
Crash Recovery Yes Yes
Online Parameter Support Yes Yes
Online Schema Changes Yes Yes
Data and Index Cache Yes Yes
Disk-based data Yes Yes
Configurable Checkpoints Yes Yes
Two-phase Commit Yes Yes
Online Backup Yes Yes
SQL Access Yes Yes
NDB Bindings (C++/Java/Python) Yes
Geographical Replication Option
LDAP Interface Option

  • Comments (Close): 0
  • TrackBack (Close): 0

MySQL Cluster 6.2

  • May 23, 2008 7:33 PM

今まで:
・MySQL Cluster 5.1
・MySQL Cluster CGE 6.2
・MySQL Cluster CGE 6.3

3つのバージョンで、それぞれGPLとCommercialライセンスが存在した。
バイナリの提供はMySQL Cluster 5.1のみ。

さっきから:
・MySQL Cluster 6.2
・MySQL Cluster 6.3

正式にMySQLツリーから離脱して、バージョンもCGEのバージョンを使うようになった。
それぞれSE (Standard Edition)とCGEがある。

MySQL Cluster 6.2だけ、バイナリが提供されることになった。
SEとCGEの違いがライセンスだけの違いなのか、バイナリ自体違うのかは不明。

ソースは、つい最近HA関連製品のプロダクトマネージャになって、エントリーを二つほど書いた
Ramon's Pageのブログなど。

  • Comments (Close): 0
  • TrackBack (Close): 0

Solaris+MySQL

  • May 16, 2008 7:10 PM

VMWare上にSolarisをインストールした。

メモリ512MB程度ではGUIのインストーラが途中で固まるのでCUIに変更
する必要がある。

オプションは、ほぼデフォルトで。

pkginfo | grep mysql
で見ると、MySQLがインストールされているっぽいので、削除する。

pkgrmなどのコマンドを使って、削除する。

mysqlグループとユーザーを作成する。

管理コンソールを立ち上げるには、これ。
# /usr/sadm/bin/smc &

MySQLのインストール場所はどこがいい?

"bash"でbashに切り替わるので、タブ補完がつかえて便利。


  • Comments (Close): 0
  • TrackBack (Close): 0

slow query log解析ツール

  • May 12, 2008 6:01 PM

1. http://www.hackmysql.com/mysqlsla
2. http://myprofi.sourceforge.net/

または、http://www.mysqlperformanceblog.com/2006/09/06/slow-query-log-analyzes-tools/
こちらの元MySQL社員のブログ・エントリーで説明されている方法で、
こちらのスクリプトを使うことで、
3. http://www.mysqlperformanceblog.com/files/utils/mysql_slow_log_parser
現状のスロークエリログをそのまま解析できるかも知れません。


例えばこんなスロークエリログがあったとすると、こんな感じで。

data@macbook$ cat ./data1/1slow.log /usr/local/mysql/bin/mysqld, Version: 5.0.42-enterprise-gpl-log (MySQL Enterprise Server (GPL)). started with: Tcp port: 3306 Unix socket: /tmp/mysql.sock Time Id Command Argument # Time: 070629 10:51:21 # User@Host: root[root] @ localhost [] # Query_time: 13 Lock_time: 0 Rows_sent: 0 Rows_examined: 4194304 use test; SET insert_id=2097153; insert into t2(b) select b from t2; # Time: 070629 10:52:14 # User@Host: root[root] @ localhost [] # Query_time: 27 Lock_time: 0 Rows_sent: 0 Rows_examined: 8388608 SET insert_id=4194305; insert into t2(b) select b from t2; # Time: 070629 10:53:59 # User@Host: root[root] @ localhost [] # Query_time: 60 Lock_time: 0 Rows_sent: 0 Rows_examined: 16979416 SET insert_id=8489709; insert into t2(b) select b+rand()*100 from t2 limit 10000000;


data@macbook$ /usr/local/mysql/bin/mysqldumpslow ./data1/1slow.log

Reading mysql slow query log from ./data1/1slow.log
Count: 1 Time=60.00s (60s) Lock=0.00s (0s) Rows=0.0 (0), root[root]@localhost
SET insert_id=N;
insert into t2(b) select b+rand()*N from t2 limit N

Count: 2 Time=20.00s (40s) Lock=0.00s (0s) Rows=0.0 (0), root[root]@localhost
SET insert_id=N;
insert into t2(b) select b from t2

data@macbook$ perl ./mysql_slow_log_parser.pl ./data1/1slow.log

Starting...
### 1 Query
### Total time: 27, Average time: 27
### Taking 27 seconds to complete
### Rows analyzed 8388608
SET insert_id=XXX;
insert into tXXX(b) select b from tXXX;

SET insert_id=4194305;
insert into t2(b) select b from t2;


### 1 Query
### Total time: 13, Average time: 13
### Taking 13 seconds to complete
### Rows analyzed 4194304
use test;
SET insert_id=XXX;
insert into tXXX(b) select b from tXXX;

use test;
SET insert_id=2097153;
insert into t2(b) select b from t2;

4. http://www.jebriggs.com/blog/perl/mysql-slow-query-log-viewer-myslowcgi.html

  • Comments (Close): 0
  • TrackBack (Close): 0

all dump 1000結果のログ

  • May 7, 2008 1:19 PM

まっさらな状態から1000行追加した状態

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

1000行追加して、2000行になった状態

2008-05-07 11:43:16 [MgmSrvr] INFO -- Node 2: Data usage is 3%(82 32K pages of total 2560)
2008-05-07 11:43:16 [MgmSrvr] INFO -- Node 2: Index usage is 0%(22 8K pages of total 2336)
2008-05-07 11:43:16 [MgmSrvr] INFO -- Node 2: Resource 0 min: 0 max: 639 curr: 0
2008-05-07 11:43:16 [MgmSrvr] INFO -- Node 3: Data usage is 3%(82 32K pages of total 2560)
2008-05-07 11:43:16 [MgmSrvr] INFO -- Node 3: Index usage is 0%(22 8K pages of total 2336)
2008-05-07 11:43:16 [MgmSrvr] INFO -- Node 3: Resource 0 min: 0 max: 639 curr: 0
2008-05-07 11:43:16 [MgmSrvr] INFO -- Node 4: Data usage is 3%(84 32K pages of total 2560)
2008-05-07 11:43:16 [MgmSrvr] INFO -- Node 4: Index usage is 1%(24 8K pages of total 2336)
2008-05-07 11:43:16 [MgmSrvr] INFO -- Node 4: Resource 0 min: 0 max: 639 curr: 0
2008-05-07 11:43:16 [MgmSrvr] INFO -- Node 5: Data usage is 3%(84 32K pages of total 2560)
2008-05-07 11:43:16 [MgmSrvr] INFO -- Node 5: Index usage is 1%(24 8K pages of total 2336)
2008-05-07 11:43:16 [MgmSrvr] INFO -- Node 5: Resource 0 min: 0 max: 639 curr: 0

mysql> delete from t1 limit 1000;
で1000行削除した状態

2008-05-07 11:50:39 [MgmSrvr] INFO -- Node 2: Data usage is 3%(82 32K pages of total 2560)
2008-05-07 11:50:39 [MgmSrvr] INFO -- Node 2: Index usage is 0%(22 8K pages of total 2336)
2008-05-07 11:50:39 [MgmSrvr] INFO -- Node 2: Resource 0 min: 0 max: 639 curr: 0
2008-05-07 11:50:39 [MgmSrvr] INFO -- Node 3: Data usage is 3%(82 32K pages of total 2560)
2008-05-07 11:50:39 [MgmSrvr] INFO -- Node 3: Index usage is 0%(22 8K pages of total 2336)
2008-05-07 11:50:39 [MgmSrvr] INFO -- Node 3: Resource 0 min: 0 max: 639 curr: 0
2008-05-07 11:50:39 [MgmSrvr] INFO -- Node 4: Data usage is 3%(84 32K pages of total 2560)
2008-05-07 11:50:39 [MgmSrvr] INFO -- Node 4: Index usage is 1%(24 8K pages of total 2336)
2008-05-07 11:50:39 [MgmSrvr] INFO -- Node 4: Resource 0 min: 0 max: 639 curr: 0
2008-05-07 11:50:40 [MgmSrvr] INFO -- Node 5: Data usage is 3%(84 32K pages of total 2560)
2008-05-07 11:50:40 [MgmSrvr] INFO -- Node 5: Index usage is 1%(24 8K pages of total 2336)
2008-05-07 11:50:40 [MgmSrvr] INFO -- Node 5: Resource 0 min: 0 max: 639 curr: 0

そこへ1000行追加した状態(データは2000行)

2008-05-07 11:51:16 [MgmSrvr] INFO -- Node 2: Local checkpoint 124 started. Keep GCI = 179891 oldest restorable GCI = 179944
2008-05-07 11:51:28 [MgmSrvr] INFO -- Node 2: Data usage is 3%(82 32K pages of total 2560)
2008-05-07 11:51:28 [MgmSrvr] INFO -- Node 2: Index usage is 0%(22 8K pages of total 2336)
2008-05-07 11:51:28 [MgmSrvr] INFO -- Node 2: Resource 0 min: 0 max: 639 curr: 0
2008-05-07 11:51:28 [MgmSrvr] INFO -- Node 3: Data usage is 3%(82 32K pages of total 2560)
2008-05-07 11:51:28 [MgmSrvr] INFO -- Node 3: Index usage is 0%(22 8K pages of total 2336)
2008-05-07 11:51:28 [MgmSrvr] INFO -- Node 3: Resource 0 min: 0 max: 639 curr: 0
2008-05-07 11:51:28 [MgmSrvr] INFO -- Node 4: Data usage is 3%(84 32K pages of total 2560)
2008-05-07 11:51:28 [MgmSrvr] INFO -- Node 4: Index usage is 1%(24 8K pages of total 2336)
2008-05-07 11:51:28 [MgmSrvr] INFO -- Node 4: Resource 0 min: 0 max: 639 curr: 0
2008-05-07 11:51:28 [MgmSrvr] INFO -- Node 5: Data usage is 3%(84 32K pages of total 2560)
2008-05-07 11:51:28 [MgmSrvr] INFO -- Node 5: Index usage is 1%(24 8K pages of total 2336)
2008-05-07 11:51:28 [MgmSrvr] INFO -- Node 5: Resource 0 min: 0 max: 639 curr: 0

そこへ1000行追加した状態(データは3000行)

2008-05-07 13:05:06 [MgmSrvr] INFO -- Node 2: Local checkpoint 125 started. Keep GCI = 181081 oldest restorable GCI = 181083
2008-05-07 13:05:14 [MgmSrvr] INFO -- Node 2: Data usage is 3%(82 32K pages of total 2560)
2008-05-07 13:05:14 [MgmSrvr] INFO -- Node 2: Index usage is 1%(24 8K pages of total 2336)
2008-05-07 13:05:14 [MgmSrvr] INFO -- Node 2: Resource 0 min: 0 max: 639 curr: 0
2008-05-07 13:05:14 [MgmSrvr] INFO -- Node 3: Data usage is 3%(82 32K pages of total 2560)
2008-05-07 13:05:14 [MgmSrvr] INFO -- Node 3: Index usage is 1%(24 8K pages of total 2336)
2008-05-07 13:05:14 [MgmSrvr] INFO -- Node 3: Resource 0 min: 0 max: 639 curr: 0
2008-05-07 13:05:14 [MgmSrvr] INFO -- Node 4: Data usage is 3%(94 32K pages of total 2560)
2008-05-07 13:05:14 [MgmSrvr] INFO -- Node 4: Index usage is 1%(25 8K pages of total 2336)
2008-05-07 13:05:14 [MgmSrvr] INFO -- Node 4: Resource 0 min: 0 max: 639 curr: 0
2008-05-07 13:05:14 [MgmSrvr] INFO -- Node 5: Data usage is 3%(94 32K pages of total 2560)
2008-05-07 13:05:14 [MgmSrvr] INFO -- Node 5: Index usage is 1%(25 8K pages of total 2336)
2008-05-07 13:05:14 [MgmSrvr] INFO -- Node 5: Resource 0 min: 0 max: 639 curr: 0


最後にndb_desc

[root@h1 mysql-cluster]# /usr/local/mysql/bin/ndb_desc -c 192.168.47.128 t1 -d mysqlslap -p
-- t1 --
Version: 1
Fragment type: 5
K Value: 6
Min load factor: 78
Max load factor: 80
Temporary table: no
Number of attributes: 11
Number of primary keys: 1
Length of frm data: 382
Row Checksum: 1
Row GCI: 1
SingleUserMode: 0
ForceVarPart: 1
TableStatus: Retrieved
-- Attributes --
id Varchar(32;latin1_swedish_ci) PRIMARY KEY DISTRIBUTION KEY AT=SHORT_VAR ST=MEMORY
intcol1 Int NULL AT=FIXED ST=MEMORY
intcol2 Int NULL AT=FIXED ST=MEMORY
intcol3 Int NULL AT=FIXED ST=MEMORY
intcol4 Int NULL AT=FIXED ST=MEMORY
intcol5 Int NULL AT=FIXED ST=MEMORY
charcol1 Varchar(128;latin1_swedish_ci) NULL AT=SHORT_VAR ST=MEMORY
charcol2 Varchar(128;latin1_swedish_ci) NULL AT=SHORT_VAR ST=MEMORY
charcol3 Varchar(128;latin1_swedish_ci) NULL AT=SHORT_VAR ST=MEMORY
charcol4 Varchar(128;latin1_swedish_ci) NULL AT=SHORT_VAR ST=MEMORY
charcol5 Varchar(128;latin1_swedish_ci) NULL AT=SHORT_VAR ST=MEMORY

-- Indexes --
PRIMARY KEY(id) - UniqueHashIndex
PRIMARY(id) - OrderedIndex

-- Per partition info --
Partition Row count Commit count Frag fixed memory Frag varsized memory
0 763 1355 65536 655360
1 800 1184 65536 655360
3 685 1197 65536 655360
2 752 1264 65536 655360

NDBT_ProgramExit: 0 - OK


-----

INSERTを繰り返して、10000件のデータとなった状態

[root@h1 mysql-cluster]# /usr/local/mysql/bin/ndb_desc -c 192.168.47.128 t1 -d mysqlslap -p
-- t1 --
Version: 1
Fragment type: 5
K Value: 6
Min load factor: 78
Max load factor: 80
Temporary table: no
Number of attributes: 11
Number of primary keys: 1
Length of frm data: 382
Row Checksum: 1
Row GCI: 1
SingleUserMode: 0
ForceVarPart: 1
TableStatus: Retrieved
-- Attributes --
id Varchar(32;latin1_swedish_ci) PRIMARY KEY DISTRIBUTION KEY AT=SHORT_VAR ST=MEMORY
intcol1 Int NULL AT=FIXED ST=MEMORY
intcol2 Int NULL AT=FIXED ST=MEMORY
intcol3 Int NULL AT=FIXED ST=MEMORY
intcol4 Int NULL AT=FIXED ST=MEMORY
intcol5 Int NULL AT=FIXED ST=MEMORY
charcol1 Varchar(128;latin1_swedish_ci) NULL AT=SHORT_VAR ST=MEMORY
charcol2 Varchar(128;latin1_swedish_ci) NULL AT=SHORT_VAR ST=MEMORY
charcol3 Varchar(128;latin1_swedish_ci) NULL AT=SHORT_VAR ST=MEMORY
charcol4 Varchar(128;latin1_swedish_ci) NULL AT=SHORT_VAR ST=MEMORY
charcol5 Varchar(128;latin1_swedish_ci) NULL AT=SHORT_VAR ST=MEMORY

-- Indexes --
PRIMARY KEY(id) - UniqueHashIndex
PRIMARY(id) - OrderedIndex

-- Per partition info --
Partition Row count Commit count Frag fixed memory Frag varsized memory
0 2515 3107 131072 1966080
2 2572 3084 131072 1966080
1 2507 2891 131072 1966080
3 2406 2918 131072 1966080

NDBT_ProgramExit: 0 - OK


all dump 1000の結果

2008-05-07 14:45:43 [MgmSrvr] INFO -- Node 2: Data usage is 6%(166 32K pages of total 2560)
2008-05-07 14:45:43 [MgmSrvr] INFO -- Node 2: Index usage is 1%(28 8K pages of total 2336)
2008-05-07 14:45:43 [MgmSrvr] INFO -- Node 2: Resource 0 min: 0 max: 639 curr: 0
2008-05-07 14:45:43 [MgmSrvr] INFO -- Node 3: Data usage is 6%(166 32K pages of total 2560)
2008-05-07 14:45:43 [MgmSrvr] INFO -- Node 3: Index usage is 1%(28 8K pages of total 2336)
2008-05-07 14:45:43 [MgmSrvr] INFO -- Node 3: Resource 0 min: 0 max: 639 curr: 0
2008-05-07 14:45:43 [MgmSrvr] INFO -- Node 4: Data usage is 6%(178 32K pages of total 2560)
2008-05-07 14:45:43 [MgmSrvr] INFO -- Node 4: Index usage is 1%(31 8K pages of total 2336)
2008-05-07 14:45:43 [MgmSrvr] INFO -- Node 4: Resource 0 min: 0 max: 639 curr: 0
2008-05-07 14:45:43 [MgmSrvr] INFO -- Node 5: Data usage is 6%(178 32K pages of total 2560)
2008-05-07 14:45:43 [MgmSrvr] INFO -- Node 5: Index usage is 1%(31 8K pages of total 2336)
2008-05-07 14:45:43 [MgmSrvr] INFO -- Node 5: Resource 0 min: 0 max: 639 curr: 0

---

32Kページに、15行くらい入る計算になる。

1行:2200バイト


Partition 0, 1:5022行、166ページ
Partition 2, 3:4978行、178ページ


-----

INT: 4*5=20
VARCHAR: (12+12)+5*(128+12)=724
オーバーヘッド:16
Total 760 byte

(32*1024 - 128) / 760 = 43行:1ページに入るデータの量

合計233ページ必要なはず


344ページ利用中ということは、286~344ページが実際に利用されている計算になる。
(20%ずつページを増やしていくので)


2515rows: 60 pages
1page:


  • Comments (Close): 0
  • TrackBack (Close): 0

VMWare ServerをVistaで使うと初回起動時に、かなり時間がかかって操作不能になる。

  • May 7, 2008 10:48 AM
  • Comments (Close): 0
  • TrackBack (Close): 0

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とはちょっと違う。

  • Comments (Close): 0
  • TrackBack (Close): 0

Index of all entries

Home > Archives > May 2008 Archive

Search
Feeds

Return to page top