mysqlbenchmarksql_benchmarksql5.0⽀持对MySQL的TPC-
C测试
2.4 编译
ant
此时会编译出⼀个版本 benchmarksql-5.0/dist/BenchmarkSQL-5.0.jar,但是该版本并不⽀持MySQL的TPC-C测试,需要做如下的修
改。
3 修改benchmarksql源码
3.1 修改benchmarksql-5.0/src/client/jTPCC.java,增加mysql相关部分,如下所⽰:if (iDB.equals("firebird"))
dbType = DB_FIREBIRD;    else if (iDB.equals("oracle"))dom对象的方法clonenode
dbType = DB_ORACLE;    else if (iDB.equals("postgres"))
dbType = DB_POSTGRES;    else if (iDB.equals("mysql"))
java开发0基础dbType = DB_UNKNOWN;    else
{        ("unknown database type '" + iDB + "'");        return;
}
3.2 修改benchmarksql-5.0/src/client/jTPCCConnection.java, SQL⼦查询增加"AS L"别名,如下所⽰:default:
stmtStockLevelSelectLow = dbConn.prepareStatement(            "SELECT count(*) AS low_stock FROM (" +            "    SELECT s_
3.3 编译修改后的源码,此时得到的benchmarksql版本 benchmarksql-5.0/dist/BenchmarkSQL-5.0.jar 已经⽀持MySQL的TPC-C测
试。
cd benchmarksql-5.0
ant
4 修改相关脚本,⽀持MySQL
4.1. 在benchmarksql-
5.0/run⽬录下,创建⽂件sql,内容如下:db=mysql
sql.jdbc.Driver
mysql面试题测试
conn=jdbc:mysql://127.0.0.1:3306/benchmarksqluser=benchmarksql
password=123456warehouses=1loadWorkers=4terminals=1//To run specified transactions per terminal- runMins must equa
C specnewOrderWeight=45paymentWeight=43orderStatusWeight=4deliveryWeight=4stockLevelWeight=4// Directory name to cre %tm-%td_%tH%tM%tS
osCollectorScript=./misc/os_collector_linux.py
osCollectorInterval=1//osCollectorSSHAddr=user@dbhostosCollectorDevices=net_eth0 blk_sda
4.2. 修改 ⽂件:benchmarksql-
5.0/run/funcs.sh,添加mysql 数据库类型。function setCP()
{    case "$(getProp db)" in
firebird)
cp="../lib/firebird/*:../lib/*"
;;
oracle)
cp="../lib/oracle/*"
if [ ! -z "${ORACLE_HOME}" -a -d ${ORACLE_HOME}/lib ] ; then
cp="${cp}:${ORACLE_HOME}/lib/*"
fi
cp="${cp}:../lib/*"
;;
postgres)
cp="../lib/postgres/*:../lib/*"
;;
mysql)
cp="../lib/mysql/*:../lib/*"
;;    esac
myCP=".:${cp}:../dist/*"
export myCP
}
...省略case "$(getProp db)" in
firebird|oracle|postgres|mysql)
;;    "") echo "ERROR: missing db= config option in ${PROPS}" >&2    exit 1
;;
*)  echo "ERROR: unsupported database type 'db=$(getProp db)' in ${PROPS}" >&2    exit 1 ;;esac
4.3 添加mysql java connector驱动,mysql-connector-java-
5.1.45.jar 需⾃⾏下载。
负40的原码和补码mkdir -p benchmarksql-5.0/lib/mysql
cp mysql-connector-java-5.1.45.jar  benchmarksql-5.0/lib/mysql/
4.4 修改benchmarksql-
5.0/run/runDatabaseBuild.sh,去掉djangovue项目开发书籍
extraHistIDAFTER_LOAD="indexCreates foreignKeys extraHistID buildFinish"修改为:AFTER_LOAD="indexCreates foreignKeys buildFinish"
5 测试MySQL TPC-C
cd benchmarksql-5.0/run
./runDatabaseBuild.sh  sql
./runBenchmark.sql
修改后的benchmarksql对MySQL进⾏TPC-C测试,结果如下所⽰:02:58:47,071 [Thread-1] INFO  jTPCC : Term-
00,02:58:47,071 [Thread-1] INFO  jTPCC : Term-00, Measured tpmC (NewOrders) = 136.7102:58:47,071 [Thread-
construction vessel for sale1] INFO  jTPCC : Term-00, Measured tpmTOTAL = 298.8102:58:47,071 [Thread-1] INFO  jTPCC : Term-
00, Session Start    = 2018-12-27 02:53:4602:58:47,071 [Thread-1] INFO  jTPCC : Term-00, Session End      = 2018-12-27 02:58:4702:58:47,071 [Thread-1] INFO  jTPCC : Term-00, Transaction Count = 1494
作者:偏执的⼯匠

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。