To protect your data, the CISO officer has suggested users to enable GitLab 2FA as soon as possible.

Commit 38092bc0 authored by jzigman's avatar jzigman
Browse files

[svn r569] Replaced the Derby benchmark with the H2 benchmark. The H2 database is

tested with a TPC-C like workload provided by the derbyTesting.jar from
Derby 10.5.3.0.

Added the h2 benchmark, removed derby benchmark, added the derby library.
Modified the libs and build to reflect these changes.
parent d3ad7e9d
<project name="derby" default="all" basedir="../..">
<description>DaCapo derby benchmark</description>
<property file="dacapo.properties"/>
<property name="bm-name" value="derby"/>
<property name="bm-version" value="10.5.3.0"/>
<property name="bm-url" value="${apache.dl.url}/db/derby/db-derby-${bm-version}"/>
<property name="bm-src" value="db-derby-${bm-version}-src.tar.gz"/>
<import file="../common.xml"/>
<property name="bm-build-top" location="${bm-build-dir}/db-derby-${bm-version}-src"/>
<target name="bm-harness" depends="junit">
<javac srcdir="${bm-src-dir}" destdir="${bm-output-dir}"
sourcepath="${bm-src-dir}"
source="1.5"
debug="true" debuglevel="lines,vars,source">
<classpath>
<!-- note that the jars build are either in the jars/sane or jars/insane
directory depending upon the build environment, however, they are
never in both directories -->
<pathelement location="${bm-build-top}/jars/sane/derby.jar"/>
<pathelement location="${bm-build-top}/jars/sane/derbyclient.jar"/>
<pathelement location="${bm-build-top}/jars/sane/derbytools.jar"/>
<pathelement location="${bm-build-top}/jars/sane/derbyTesting.jar"/>
<pathelement location="${bm-build-top}/jars/insane/derby.jar"/>
<pathelement location="${bm-build-top}/jars/insane/derbyclient.jar"/>
<pathelement location="${bm-build-top}/jars/insane/derbytools.jar"/>
<pathelement location="${bm-build-top}/jars/insane/derbyTesting.jar"/>
<pathelement path="${bm-output-dir}"/>
<pathelement path="${harness-classpath}"/>
</classpath>
</javac>
<jar destfile="${bm-jars}/tpcc.jar">
<fileset dir="${bm-output-dir}">
<include name="org/dacapo/derby/**"/>
</fileset>
</jar>
<delete dir="${bm-output-dir}/org/dacapo/derby"/>
</target>
<target name="unpack" depends="untar"/>
<target name="bm-build" depends="junit">
<copy tofile="${bm-build-top}/tools/java/junit.jar">
<fileset dir="${basedir}/libs/junit/dist/jar">
<include name="*.jar"/>
</fileset>
</copy>
<ant antfile="build.xml" inheritall="false" dir="${bm-build-top}">
<target name="all"/>
<target name="buildjars"/>
</ant>
</target>
<target name="jar">
<!-- not that the derby jars are located in either jars/sane or jars/insane
depending upon the build environment, however, these will only be in
one of those directories and not both -->
<copy todir="${bm-jars}" flatten="true">
<fileset dir="${bm-build-top}">
<include name="jars/*/derby.jar"/>
<include name="jars/*/derbytools.jar"/>
<include name="jars/*/derbyTesting.jar"/>
<include name="tools/java/junit.jar"/>
</fileset>
</copy>
</target>
</project>
benchmark derby
class org.dacapo.harness.Derby
thread-model per_cpu
libs "derby.jar","derbytools.jar","derbyTesting.jar","junit.jar","tpcc.jar";
size small args "-numberOfTerminals","${THREADS}",
"-totalTransactions", "200",
"-scale","1",
"-numberOfWarehouses", "1",
"-deadlockTimeout", "3",
"-transactionTimeout", "20",
"-retryLimit", "10"
threads 1;
size default args "-numberOfTerminals","${THREADS}",
"-totalTransactions","400",
"-scale","1",
"-numberOfWarehouses", "1",
"-deadlockTimeout", "3",
"-transactionTimeout", "20",
"-retryLimit", "10"
threads 1;
size large args "-numberOfTerminals","${THREADS}",
"-totalTransactions","800",
"-scale","1",
"-numberOfWarehouses", "1",
"-deadlockTimeout", "3",
"-transactionTimeout", "20",
"-retryLimit", "10"
threads 1;
/*
* Specifically targeted at class-unloading
*/
size dynamic args "-numberOfTerminals","1",
"-totalTransactions","4000",
"-scale", "1",
"-numberOfWarehouses", "1",
"-deadlockTimeout", "4",
"-transactionTimeout", "20",
"-retryLimit", "5"
threads 1
output
stdout digest 0x2b20faf05e30baae25244763a1ec60faf4f6d939,
stderr digest 0x816b1242d71780b24adf3b5a356a96a4db072332;
description
short "An SQL relational database engine written in Java",
long "Derby executes a JDBC benchmark, executing a number of transactions against a model of a banking application",
copyright "Copyright (c) 2001-2002, The Apache Software Foundation",
author "The Apache Software Foundation",
license "Apache License, Version 2.0",
url "http://db.apache.org/derby/",
version "10.5.3.0",
repeats "40 transactions per client",
threads "Multi-threaded";
package org.dacapo.derby;
import java.sql.Connection;
import java.sql.SQLException;
import org.apache.derbyTesting.system.oe.client.Display;
import org.apache.derbyTesting.system.oe.direct.Standard;
public final class Operation extends Standard
{
private int retryLimit;
/**
* Construct a wrapper subclasss of the
* org.apache.derbyTesting.system.oe.direct.Standard operations class. The
* wrapper catches exceptions generated by the operations, such as timeouts
* and deadlocks and will retry with the same data up to
* <code>retryLimit</code> times.
*
* @param conn
* A connection to the derby database.
* @param retryLimit
* The maximum number of retries before catastrophic failure.
* @throws SQLException
*/
public Operation(Connection conn, int retryLimit) throws SQLException
{
super(conn);
this.retryLimit = retryLimit;
}
public void stockLevel(Display display, Object displayData, short w, short d,
int threshold) throws Exception
{
boolean done = false;
int retry = 0;
Exception lastE = null;
while (retry < retryLimit && !done)
{
try
{
super.stockLevel(display, displayData, w, d, threshold);
done = true;
} catch (Exception e)
{
retry++;
lastE = e;
conn.rollback();
}
}
check(done, lastE);
}
public void orderStatus(Display display, Object displayData, short w,
short d, String customerLast) throws Exception
{
boolean done = false;
int retry = 0;
Exception lastE = null;
while (retry < retryLimit && !done)
{
try
{
super.orderStatus(display, displayData, w, d, customerLast);
done = true;
} catch (Exception e)
{
retry++;
lastE = e;
conn.rollback();
}
}
check(done, lastE);
}
public void orderStatus(Display display, Object displayData, short w,
short d, int c) throws Exception
{
boolean done = false;
int retry = 0;
Exception lastE = null;
while (retry < retryLimit && !done)
{
try
{
super.orderStatus(display, displayData, w, d, c);
done = true;
} catch (Exception e)
{
retry++;
lastE = e;
conn.rollback();
}
}
check(done, lastE);
}
public void payment(Display display, Object displayData, short w, short d,
short cw, short cd, String customerLast, String amount) throws Exception
{
boolean done = false;
int retry = 0;
Exception lastE = null;
while (retry < retryLimit && !done)
{
try
{
super.payment(display, displayData, w, d, cw, cd, customerLast, amount);
done = true;
} catch (Exception e)
{
retry++;
lastE = e;
conn.rollback();
}
}
check(done, lastE);
}
public void payment(Display display, Object displayData, short w, short d,
short cw, short cd, int c, final String amount) throws Exception
{
boolean done = false;
int retry = 0;
Exception lastE = null;
while (retry < retryLimit && !done)
{
try
{
super.payment(display, displayData, w, d, cw, cd, c, amount);
done = true;
} catch (Exception e)
{
retry++;
lastE = e;
conn.rollback();
}
}
check(done, lastE);
}
public void newOrder(Display display, Object displayData, short w, short d,
int c, int[] items, short[] quantities, short[] supplyW) throws Exception
{
boolean done = false;
int retry = 0;
Exception lastE = null;
while (retry < retryLimit && !done)
{
try
{
super.newOrder(display, displayData, w, d, c, items, quantities,
supplyW);
done = true;
} catch (Exception e)
{
retry++;
lastE = e;
conn.rollback();
}
}
check(done, lastE);
}
public void scheduleDelivery(Display display, Object displayData, short w,
short carrier) throws Exception
{
boolean done = false;
int retry = 0;
Exception lastE = null;
while (retry < retryLimit && !done)
{
try
{
super.scheduleDelivery(display, displayData, w, carrier);
done = true;
} catch (Exception e)
{
retry++;
lastE = e;
conn.rollback();
}
}
check(done, lastE);
}
private static void check(boolean done, Exception lastE) throws Exception
{
if (!done && lastE != null)
{
lastE.printStackTrace();
throw lastE;
}
}
}
<project name="h2" default="all" basedir="../..">
<description>DaCapo h2 benchmark</description>
<property file="dacapo.properties"/>
<property name="bm-name" value="h2"/>
<import file="../common.xml"/>
<target name="bm-harness" depends="junit,h2,derby">
<javac srcdir="${bm-src-dir}" destdir="${bm-output-dir}"
sourcepath="${bm-src-dir}"
source="1.5"
debug="true" debuglevel="lines,vars,source">
<classpath>
<!-- note that the jars build are either in the jars/sane or jars/insane
directory depending upon the build environment, however, they are
never in both directories -->
<pathelement location="${derbytesting-jar}"/>
<pathelement location="${h2-jar}"/>
<pathelement location="${junit-jar}"/>
<pathelement path="${bm-output-dir}"/>
<pathelement path="${harness-classpath}"/>
</classpath>
</javac>
<jar destfile="${bm-jars}/tpcc.jar">
<fileset dir="${bm-output-dir}">
<include name="org/dacapo/h2/**"/>
</fileset>
</jar>
<delete dir="${bm-output-dir}/org/dacapo/h2"/>
</target>
<target name="bm-build" depends="junit,h2,derby"/>
</project>
benchmark h2
class org.dacapo.harness.H2
thread-model per_cpu
libs "derbyTesting.jar","junit-3.8.1.jar","h2-1.2.121.jar","tpcc.jar";
size small args "-numberOfTerminals","${THREADS}",
"-totalTransactions", "3200",
"-scale","1",
"-numberOfWarehouses", "1",
"-retryLimit", "10",
"-createSuffix", ";MVCC=true"
threads 1
output stdout digest 0xc288238cd21fe6190545de5c9cd896b0e5b66a9d;
size default args "-numberOfTerminals","${THREADS}",
"-totalTransactions","12800",
"-scale","1",
"-numberOfWarehouses", "1",
"-retryLimit", "10",
"-createSuffix", ";MVCC=true"
threads 1
output stdout digest 0x782c90958012af6327f433b70a85a1b1841a0606;
size large args "-numberOfTerminals","${THREADS}",
"-totalTransactions","51200",
"-scale","1",
"-numberOfWarehouses", "1",
"-retryLimit", "10",
"-createSuffix", ";MVCC=true"
threads 1
output stdout digest 0xe50827b7a55671b6455676390db41f2edc77c994;
description
short "An SQL relational database engine written in Java",
long "H2 executes a TPC-C like benchmark written by Apache as part of the Apache Derby database. The application models: customers, districts, warehouses, purchases and deliveries.",
copyright "Copyright (c) 2001-2002, The Apache Software Foundation and H2 Group, H2",
author "TPC-C like workload authored by The Apache Software Foundation, and Database authored by H2",
license "Apache License, Version 2.0 covering TPC-C like workload, and Eclipse Public License Version 1.0 covering H2",
url "http://db.apache.org/derby/ and http://www.h2database.com",
version "10.5.3.0 and 1.2.121",
repeats "12800 Transactions evenly divided amoung the hardware threads.",
threads "One client thread per hardware thread.";
/*
*
* Derby - Class org.apache.derbyTesting.system.oe.direct.Standard
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*
* Contributors:
* Apache Software Foundation (ASF) - initial API and implementation
* Australian National University - adaptation to DaCapo test harness
*/
package org.dacapo.h2;
import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import org.apache.derbyTesting.system.oe.client.Display;
import org.apache.derbyTesting.system.oe.direct.Standard;
import org.apache.derbyTesting.system.oe.routines.Data;
import org.apache.derbyTesting.system.oe.model.Customer;
import org.apache.derbyTesting.system.oe.model.District;
import org.apache.derbyTesting.system.oe.model.Warehouse;
/**
* Construct a wrapper sub-classs of the
* org.apache.derbyTesting.system.oe.direct.Standard
* operations class, which can be found in:
* db-derby-10.5.3.0-src/java/testing/org/apache/derbyTesting/system/oe/direct/Standard.java
* in the
* http://apache.wildit.net.au/db/derby/db-derby-10.5.3.0/db-derby-10.5.3.0-src.tar.gz
*
* This class is created as the parent class uses a Java call-back for
* updating C_DATA for a client which Derby understands but H2 does not.
* Thus, we override both <code>payment</code> methods copying the code
* from the parent class (Standard) to this class so that we can make a
* call to the modified version of <code>paymentById</code>.
*
* The method <code>paymentById</code> is taken from the clas Standard
* and is modified to remove the call-back.
*/
public final class Operation extends Standard
{
/**
* @param conn
* A connection to the derby database.
* @param retryLimit
* The maximum number of retries before catastrophic failure.
* @throws SQLException
*/
public Operation(Connection conn) throws SQLException
{
super(conn);
}
// The following two payment methods are taken verbatim from
// org.apache.derbyTesting.system.oe.direct.Standard
// so that we can in effect override the private method paymentById
/**
* Payment by customer last name.
* Section 2.5.2
* The CUSTOMER row will be fetched and then updated.
* This is due to the need to select the specific customer
* first based upon last name (which will actually fetch and
* hence lock a number of customers).
*/
public void payment(Display display, Object displayData, short w, short d,
short cw, short cd, String customerLast, String amount)
throws Exception {
PreparedStatement pyCustomerByName = prepareStatement(
"SELECT C_ID " +
"FROM CUSTOMER WHERE C_W_ID = ? AND C_D_ID = ? AND C_LAST = ? " +
"ORDER BY C_FIRST");
// Since so much data is needed for the payment transaction
// from the customer we don't fill it in as we select the
// correct customer. Instead we just fetch the identifier
// and then execute a payment by identifier.
try {
pyCustomerByName.setShort(1, cw);
pyCustomerByName.setShort(2, cd);
pyCustomerByName.setString(3, customerLast);
ResultSet rs = pyCustomerByName.executeQuery();
nameList.clear();
while (rs.next())
{
nameList.add(rs.getObject("C_ID"));
}
reset(pyCustomerByName);
if (nameList.isEmpty())
throw new SQLException("Payment by name - no matching customer "
+ customerLast);
// Customer to use is midpoint (with round up) (see 2.5.2.2)
int mid = nameList.size()/2;
if (mid != 0) {
if (nameList.size()%2 == 1)
mid++;
}
int c = ((Integer) nameList.get(mid)).intValue();
paymentById(display, displayData, w, d, cw, cd, c, amount);
} catch (SQLException e) {
conn.rollback();
throw e;
}
if (display != null)
;
}
/**
* Payment by customer identifier.
* Section 2.5.2.
* The CUSTOMER row is update and then fetched.
*
*/
public void payment(Display display, Object displayData, short w, short d,
short cw, short cd, int c, final String amount) throws Exception {
try {
paymentById(display, displayData, w, d, cw, cd, c, amount);
} catch (SQLException e) {
conn.rollback();
throw e;
}
if (display != null)
;
}
// Modified operations from Standard, replaced due to callback in to Java that
// is not supported on most SQL.
/*
* Objects for re-use within the transactions
*/
private final Warehouse warehouse = new Warehouse();
private final District district = new District();
private final List nameList = new ArrayList();
private void paymentById(Display display, Object displayData, short w, short d,
short cw, short cd, int c, final String s_amount) throws Exception {
PreparedStatement pyCustomerPayment = prepareStatement(
"UPDATE CUSTOMER SET C_BALANCE = C_BALANCE - ?, " +
"C_YTD_PAYMENT = C_YTD_PAYMENT + ?, " +
"C_PAYMENT_CNT = C_PAYMENT_CNT + 1 " +
"WHERE C_W_ID = ? AND C_D_ID = ? AND C_ID = ?");
PreparedStatement pyCustomerInfoId = prepareStatement(
"SELECT C_FIRST, C_MIDDLE, C_LAST, C_BALANCE, " +
"C_STREET_1, C_STREET_2, C_CITY, C_STATE, C_ZIP, " +
"C_PHONE, C_SINCE, C_CREDIT, C_CREDIT_LIM, C_DISCOUNT, C_DATA " +
"FROM CUSTOMER WHERE C_W_ID = ? AND C_D_ID = ? AND C_ID = ?");
// This is removed as the call out to java from the SQL engine did not work
// from H2, this value can be calculated externally and set so this callback
// is somewhat redundant.
PreparedStatement pyCustomerUpdateBadCredit = prepareStatement(
// "UPDATE CUSTOMER SET C_DATA = " +
// " BAD_CREDIT_DATA(C_DATA, ?, ?, C_W_ID, C_W_ID, C_ID, ?) " +
"UPDATE CUSTOMER SET C_DATA = ? " +
"WHERE C_W_ID = ? AND C_D_ID = ? AND C_ID = ?");
PreparedStatement pyCustomerGetData = prepareStatement(
"SELECT SUBSTR(C_DATA, 1, 200) AS C_DATA_200 " +
"FROM CUSTOMER WHERE C_W_ID = ? AND C_D_ID = ? AND C_ID = ?");
PreparedStatement pyDistrictUpdate = prepareStatement(
"UPDATE DISTRICT SET D_YTD = D_YTD + ? WHERE D_W_ID = ? AND D_ID = ?"</