命令: random_write_test [options] <total-bytes>
该命令用于测试hypertable的写入速度。它将产生随机数据插入到表RandomTest中,插入数据的value总长度为total-bytes。RandomTest表必须提前创建于namespace”/”下,并且只有一个名称为Field的CF。产生的row和value都是随机的ASCII字符串,row长度为12,value长度由blocksize参数指定,默认为1000.
Options:
--blocksize arg (=1000) Size of value to write
--checksum-file arg File to contain, for each insert, key '' <value-checksum> pairs
--flush Flush after each write
--no-log-sync Don't do a commit log sync when buffers are auto flushed
--seed arg (=1234) Random number generator seed
-h [ --help ] Show this help message and exit
--help-config Show help message for config properties
--version Show version information and exit
-v [ --verbose ] Show more verbose output
--debug Show debug output (shortcut of --logging-level debug)
--quiet Negate verbose
--silent Show as little output as possible
-l [ --logging-level ] arg (=info) Logging level: debug, info, notice, warn, error, crit, alert, fatal
--config arg (=/dinglicom/hypertable/0.9.7.2/conf/hypertable.cfg) Configuration file.
--induce-failure arg Arguments for inducing failure
--workers arg Number of worker threads
--reactors arg Number of reactor threads
-t [ --timeout ] arg System wide timeout in milliseconds
设置随机产生的value的长度,默认值为1000.
示例:random_write_test --blocksize 200 100000000;写入的每个cell的value长度为200,共写入100000000字节的数据,即500000个cell。可能得到下面类似的结果:
0% 10 20 30 40 50 60 70 80 90 100%
|----|----|----|----|----|----|----|----|----|----|
***************************************************
Elapsed time: 7.10 s
Total inserts: 500000
Throughput: 14931606.90 bytes/s
Throughput: 70432.11 inserts/s
其中:Total inserts表示插入的cell总数;第一个Throughput表示每秒写入的字节数,本例中等于100000000/7.10;第二个表示每秒写入的cell数目, 本例中等于500000/7.10。
实验表明:
在其余条件不变的前提下,该参数变大时,每秒写入的字节数将变大,即写入速度将提高,反之亦然。
在不清除已有表数据的情况下,重复插入的row将与之前的 row重复,即因为产生随机数的规则一致,所以每批插入时将得到同样的row集合。
指定一个文件,保存在插入每个cell时对value的checksum结果,文件中每行即为一组row/checksum结果对。
示例:random_write_test --blocksize 200 --checksum-file ./1.tsv 400; 将会在当前目录下新建一个文件1. Tsv,文件将包含下面类似的结果:
L2sH0+JmJoVC 1260310456
NdxdzOwOdF2z 561363194
对每个cell的写入都执行flush,这将降低写入速率。
示例:当执行random_write_test 100000000时,结果如下:
Elapsed time: 4.26 s
Total inserts: 100000
Throughput: 23762288.82 bytes/s
Throughput: 23480.52 inserts/s
但是执行random_write_test –flush 100000000时,结果如下:
Elapsed time: 180.63 s
Total inserts: 100000
Throughput: 560255.85 bytes/s
Throughput: 553.61 inserts/s
可见使用了此参数后,写入速度上与前者有着数量级的差异。
当缓冲(buffer)中的数据最终被持久化时,不进行Commit Log的同步,这将提高写入速率。
示例:当执行random_write_test 100000000时,结果如下:
Elapsed time: 4.26 s
Total inserts: 100000
Throughput: 23762288.82 bytes/s
Throughput: 23480.52 inserts/s
但是执行random_write_test –flush 100000000时,结果如下:
Elapsed time: 3.07 s
Total inserts: 100000
Throughput: 32984594.04 bytes/s
Throughput: 32593.47 inserts/s
可见不同步Commit Log时写入确实变快了一些。
命令: random_read_test [options] <total-bytes>
该命令用于测试hypertable的读取速度,应与random_write_test结合使用。它将按照写入相同的次序读取RandomTest表中的数据。如果发现row为空或者重复的数据,将抛出一个错误并退出,此时状态码为1。否则将输出与读取相关的统计信息并退出,此时状态码为0. total-bytes为需要读取的字节数。
Options:
--blocksize arg (=1000) Size of value to write
--checksum-file arg File to contain, for each insert, key '' <value-checksum> pairs
--seed arg (=1234) Random number generator seed
--max-keys arg (=0) Maximum number of keys to lookup
-h [ --help ] Show this help message and exit
--help-config Show help message for config properties
--version Show version information and exit
-v [ --verbose ] Show more verbose output
--debug Show debug output (shortcut of --logging-level debug)
--quiet Negate verbose
--silent Show as little output as possible
-l [ --logging-level ] arg (=info) Logging level: debug, info, notice, warn, error, crit, alert, fatal
--config arg (=/dinglicom/hypertable/0.9.7.2/conf/hypertable.cfg) Configuration file.
--induce-failure arg Arguments for inducing failure
--workers arg Number of worker threads
--reactors arg Number of reactor threads
-t [ --timeout ] arg System wide timeout in milliseconds
与random_write_test的同名参数相似,并应该保持一致,否则将报错。例如:如果先执行random_write_test 100000000,再执行random_read_test --blocksize 200 100000000将得到如下类似的错误:
Wrong number of results: 0 (key=pe8ATt1dRiZW, i=100000)
但如果将此参数变为1000或者省略此参数即可。此命令将得到下面类似的结果:
Elapsed time: 39.08 s
Total scanned: 100000
Throughput: 2589883.88 bytes/s
Throughput: 2559.17 scanned cells/s
结果字段含义同random_write_test。
与random_write_test的同名参数相似,用于在读取时对每个cell进行checksum,并将检验结果写入指定的文件中。此文件可与写入时生成的文件进行比较,如果一致,则读取没有错误,否则表明读取中有错误产生。
需要读取的key数目,默认为0,即所有的key。当指定了此参数后,将只读取指定数目的key。
示例:random_read_test –blocksize 200 –max-keys 10 20000;此示例表示之前写入数据时blocksize为200,读取时必须采用同样的参数。如果写入时total-bytes为20000,则表中共有100个cell,此处只要求读取前10个。可能得到下面类似的结果:
Elapsed time: 0.01 s
Total scanned: 10
Throughput: 3806280.74 bytes/s
Throughput: 1891.79 scanned cells/s
实验表明:当此参数和total-bytes冲突时,将以小的一方为准。例如:执行“random_read_test –blocksize 200 –max-keys 200 20000”时,将只读取所有的100个cell。但此参数和total-bytes都越界时将报错。例如:执行“random_read_test --blocksize 200 --max-keys 200 30000”时将报错。
命令:ht_write_test [options] <total-bytes>
该命令与random_write_test命令相似,也用于测试hypertable的写入速度。与random_write_test不同的是,该命令可以指定row的长度,即key-size参数。
该命令的value-size参数相当于random_write_test的blocksize参数。Max-keys参数表示写入的唯一row的最大数目,即一批写入的数据中,可以存在重复的row,但是唯一row的数目上限为此参数,这也是与random_write_test的不同之处。但是实际测试发现此参数并没有达到预期效果。
Description:
This program will generate various types of write worload for testing purposes.:
--max-keys arg (=0) Maximum number of unique keys to generate
--key-size arg (=12) Size of each key
--value-size arg (=1000) Size of each value
--seed arg (=1234) Pseudo random number generator seed
-h [ --help ] Show this help message and exit
--help-config Show help message for config properties
--version Show version information and exit
-v [ --verbose ] Show more verbose output
--debug Show debug output (shortcut of --logging-level debug)
--quiet Negate verbose
--silent Show as little output as possible
-l [ --logging-level ] arg (=info) Logging level: debug, info, notice, warn, error, crit, alert, fatal
--config arg (=/dinglicom/hypertable/0.9.7.2/conf/hypertable.cfg) Configuration file.
--induce-failure arg Arguments for inducing failure
--workers arg Number of worker threads
--reactors arg Number of reactor threads
-t [ --timeout ] arg System wide timeout in milliseconds
示例:ht_write_test --max-keys 3 --key-size 5 --value-size 500 4500;
此例将写入9个cell,每个cell的row长度为5,并且会出现重复的row,但是唯一的row应该最多为3个。可能得到下面类似的结果:
Elapsed time: 0.00 s
Total inserts: 9
Throughput: 1101601.72 bytes/s
Throughput: 2151.57 inserts/s
结果字段含义同random_write_test。
命令:csvalidate [options] <filename>
该命令验证cellstore文件的有效性,并可对损坏的cellstore文件进行修复。
Options:
--repair Repair any corruption that is found
--dfs arg DFS client endpoint in <host:port> format
--dfs-timeout arg Timeout in milliseconds for DFS client connections
-h [ --help ] Show this help message and exit
--help-config Show help message for config properties
--version Show version information and exit
-v [ --verbose ] Show more verbose output
--debug Show debug output (shortcut of --logging-level debug)
--quiet Negate verbose
--silent Show as little output as possible
-l [ --logging-level ] arg (=info) Logging level: debug, info, notice, warn, error, crit, alert, fatal
--config arg (=/dinglicom/hypertable/0.9.7.2/conf/hypertable.cfg) Configuration file.
--induce-failure arg Arguments for inducing failure
--workers arg Number of worker threads
--reactors arg Number of reactor threads
-t [ --timeout ] arg System wide timeout in milliseconds
示例:csvalidate /hypertable/tables/2/0/default/qyoNKN5rd__dbHKv/cs0; 当文件没有损坏时,可能得到下面类似的结果:
Checking /hypertable/tables/2/0/default/qyoNKN5rd__dbHKv/cs0 ... valid
示例:csvalidate –repair /hypertable/tables/2/0/default/qyoNKN5rd__dbHKv/cs0; 当文件没有损坏时,结果和上例类似,否则将试图修复此文件。