Blogbench User's Guide - liweizhao/webbench GitHub Wiki
Most of the scripts files used to collect system information are modified or used directly from Dbt-2 benchmark. It needs these tool packages: libpng, libgd, gnuplot.
Character set of resource files of blogbench is UTF8. For the same data length to generate, character set of database server should be UTF8.
Blogbench is not only a java program, but also includes many scripts for collecting system information. In Linux/Unix system, you need to change mod of the script files. This is very simple by executing the ‘configure_blogbench.sh’ script. For tests of MySQL or Oracle, you can execute the script file ‘run_blogbench.sh’. Specified –h option to see more details.
Normally, blogbench needn’t preheating. The blogbench test is similar to sysbench that test includes two steps: load data and run test. In RUN operation, blogbench will query the corresponding relation of all ID, UserID and PublishTime through this SQL statement:
SELECT ID, UserID, PublishTime FROM table_name
For these three columns are all in indexes, after this step, index pages will be loaded into memory. So if test duration is enough, blogbench test needn’t extra preheating.
Notice that the RUN operation maybe includes publish-blog transaction and this will change the test table size. You need to load data before begin another test.
Use bellow command to run blogbench:
java com.netease.webbench.blogbench.Main [OPTIONS] [ACTION]
OPTIONS:
- -h/ --host: database host ['127.0.0.1'];
- -P/--port: database port [3306];
- -D/--database: database schema ['test'];
- -u/--user: database user [root];
- -p/--password: database password [''];
- --database-type: database type [mysql];
- --driver-name: name of JDBC driver,optional;
- --jdbc-url: URL of JDBC,optional;
- --table-name: test table name ['Blog'];
- --table-size: number of records to insert into table, only useful for LOAD action [1000000].
- --table-engine: storage engine of test table, only useful for MySQL database type [innodb]
- --table-comment: out of date
- --ntse-create-table-args: none standard create table arguments ['usemms:true; cache_update:true; cached_columns:AccessCount'];
- --TRX N: TRX is the name of transaction,N is the relative proportion of a transaction. If N is 0, then this type of transaction is disable; Possible values of TRX are shown below: list-blogs, show-blog, update-access, update-comment, show-siblings, publish-blog, update-blog
- --blog-zipf-pct N: [5]
- --blog-zipf-res N: [95]
- --blog-zipf-part N: [200] Zipf distribution used to select blogs. Means that ‘blog-zipf-pct’% blogs hold ‘blog-zipf-res’% access probability, and the hottest blogs are divided into ‘blog-zipf-part’ parts.
- --user-zipf-pct N: [5]
- --user-zipf-res N: [95]
- --user-zipf-part N: [200] Zipf distribution used to select users. Means that ‘user-zipf-pct’% users hold ‘user-zipf-res’% blogs, and the hottest users are divided into ‘user-zipf-part’ parts.
- --min-title-size N: minimum length of title [10];
- --max-title-size N: maximum length of title, [30];
- --min-abs-size N: minimum length of abstract [10];
- --max-abs-size N: maximum length of abstract [500];
- --min-cnt-size N: minimum length of content [20];
- --max-cnt-size N: maximum length of content [20000];
- --avg-cnt-size N: average length of content [2000];
- --threads N: number of test threads [100];
- --max-tran N: maximum number of transactions [Long.MAX];
- --max-time N: test duration(seconds) [Long.MAX];
- --defer-index: whether defer creating index, only useful for LOAD action. See 2.2 for more details.
- --report-dir: directory for test result [
./result
]; - --collect-sysstat: whether collect system condition automatically [true]
- --print-period: throughput print period(seconds) [60];
- --large-blog: generate extra large blogs [true]. Length of the large blogs is between maxx-cnt-size/2 ~ max-cnt-size, as the law of uniform distribution;
- --debug: print debug information, only for development [false];
- --use-two-tables: if divide the blog content into a single table. [false]
ACTION:
- load: load data;
- run: run test;
Blogbench provides python script to help user configure test cases conveniently. Some common options can be configured through configure file ‘run_blogbench.cfg’.
- -h: print this help message and exit;
- -l / -L / --load: do loading data operation;
- -r / -R / --run: do running test operation; If both of these two options are specified, they will be executed orderly. If either options is specified, the configure item in configure file is skipped.
- -c / --configure-file:use this configure file, default is 'run_blogbench.cfg';
[environment]
- java_classpath:class path of java program
- main_class:main function of blogbench
[common]
- threads:number of test threads;
- table_size: number of records to load into test table;
- duration:test duration;
- report_dir:path of report directory;
- test_case:name of test case, optional: mix-tran, list-blogs, show-blog, update-access, update-comment, update-blog, publish-blog;
- use_two_tables: whether divide the blog content into a single table;
- operations: type of operations,optional: ‘load’(or ‘l’), ‘run’(or ‘r’). If both operations is needed, it can be divided by ‘,’, such as ‘load,run’. If operation types have been specified through command line, this item is skipped.
[database]
- db_type: database type,optional: mysql, oracle, postgresql. If it is mysql, the [mysql] segment is needed;
- db_host: database host;
- db_port: database port;
- db_user: database user;
- db_psw: database password;
- schema_name: database name;
[mysql] #optional#
- mysql_home: installed directory of MySQL;
- mysql_config: configure file of MySQL;
- mysql_pid: path of MySQL pid file;
- table_engine: test table engine;
- auto_restart: whether restart MySQL server
[ntse] #optional#
- use_mms: if test table engine is NTSE, whether use MMS.
After finishing blogbench test, these statistic information will be output:
- Throughput of each type of transactions
- Number of each type of transactions finished
- Response time(milliseconds): average、minimum、maximum、90% threshold
If –report-dir option is not specified, the test result of blogbench is output to ‘./report’ directory. Otherwise is output to specified directory. The test result includes several parts:
- OS runtime information, e.g. CPU, IO etc.
- Database statistic information during test (Only support MySQL currently)
- Result of blogbench includes bellow files:
- blogbench-report.pdf Blogbench report in chart format;
- blogbench-report.txt Blogbench report in text format;
- loaddata_performance.txt Statistic information of loading data;
- SingleTps-Blogbench.txt Single TPS of all transactions
- TotalTps-Blogbench.txt Total TPS of all transactions
Blogbench can monitor system environment below:
- Condition of OS,such of CPU, IO;
- MySQL configure: result of
show global variables
command (only useful to MySQL); - MySQL status before and after test: result of
show global status
command (only useful to MySQL); - Print real time throughput as ASCII chart.
Blogbench could be not only used to test RDBMS. Besides, it can be extended to test most of the popular databases, such as MongoDB, Redis. Plugins for MongoDB and Redis are available:
- https://github.com/liweizhao/blogbench-mongodb-plugin
- https://github.com/liweizhao/blogbench-redis-plugin
You can also write your custom plugin for any database. The steps are simple:
First, implement these interfaces:
- com.netease.webbench.blogbench.BlogbenchPlugin
- com.netease.webbench.blogbench.dao.BlogDAO
- com.netease.webbench.blogbench.dao.BlogDaoFactory
- com.netease.webbench.blogbench.dao.DataLoader
Second, set plugin class name in configure file "config/plugin.properties".
If Ctrl + C are entered when blogbench test hasn’t finished, then blogbench will catch this signal and save the test result even blogbench hasn’t run for the specified test time.