Add tomcat-jdbc to benchmark.

pull/11/head
Brett Wooldridge 11 years ago
parent dd7547de1a
commit 45cd785cb2

@ -3,11 +3,16 @@
CLASSPATH=$CLASSPATH:~/.m2/repository/org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar
CLASSPATH=$CLASSPATH:~/.m2/repository/org/slf4j/slf4j-api/1.7.5/slf4j-api-1.7.5.jar
CLASSPATH=$CLASSPATH:~/.m2/repository/org/slf4j/slf4j-simple/1.7.5/slf4j-simple-1.7.5.jar
CLASSPATH=$CLASSPATH:~/.m2/repository/com/jolbox/bonecp/0.8.0-rc3/bonecp-0.8.0-rc3.jar
CLASSPATH=$CLASSPATH:~/.m2/repository/com/google/guava/guava/15.0/guava-15.0.jar
CLASSPATH=$CLASSPATH:~/.m2/repository/org/apache/tomcat/tomcat-jdbc/7.0.47/tomcat-jdbc-7.0.47.jar
CLASSPATH=$CLASSPATH:~/.m2/repository/org/apache/tomcat/tomcat-juli/7.0.47/tomcat-juli-7.0.47.jar
CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/tools.jar
CLASSPATH=$CLASSPATH:./core/target/HikariCP-1.1.9-SNAPSHOT.jar
CLASSPATH=$CLASSPATH:./agent/target/HikariCP-agent-1.1.9-SNAPSHOT.jar
CLASSPATH=$CLASSPATH:./core/target/HikariCP-1.2.2-SNAPSHOT.jar
CLASSPATH=$CLASSPATH:./agent/target/HikariCP-agent-1.2.2-SNAPSHOT.jar
CLASSPATH=$CLASSPATH:./core/target/test-classes
java -classpath $CLASSPATH \

@ -123,6 +123,18 @@
<version>0.9.1.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
<version>7.0.47</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>tomcat</groupId>
<artifactId>tomcat-juli</artifactId>
<version>5.5.23</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>

@ -10,6 +10,8 @@ import java.util.concurrent.TimeUnit;
import javax.sql.DataSource;
import org.apache.tomcat.jdbc.pool.PoolProperties;
import snaq.db.DBPoolDataSource;
import com.jolbox.bonecp.BoneCPConfig;
@ -38,7 +40,7 @@ public class Benchmark1
if (args.length < 3)
{
System.err.println("Usage: <poolname> <threads> <poolsize>");
System.err.println(" <poolname> 'hikari' or 'bone'");
System.err.println(" <poolname> 'hikari', 'bone', 'dbpool', 'c3p0', 'tomcat'");
System.exit(0);
}
@ -66,6 +68,11 @@ public class Benchmark1
benchmarks.ds = benchmarks.setupC3P0();
System.out.printf("Benchmarking C3P0 - %d threads, %d connections", THREADS, POOL_MAX);
}
else if (args[0].equals("tomcat"))
{
benchmarks.ds = benchmarks.setupTomcat();
System.out.printf("Benchmarking Tomcat-JDBC - %d threads, %d connections", THREADS, POOL_MAX);
}
else
{
System.err.println("Start with one of: hikari, bone");
@ -75,6 +82,7 @@ public class Benchmark1
System.out.println("\nMixedBench");
System.out.println(" Warming up JIT");
benchmarks.startMixedBench(100, 10000);
benchmarks.startMixedBench(100, 10000);
System.out.println(" MixedBench Final Timing Runs");
benchmarks.startMixedBench(THREADS, 1000);
benchmarks.startMixedBench(THREADS, 1000);
@ -238,6 +246,27 @@ public class Benchmark1
}
}
private DataSource setupTomcat()
{
PoolProperties p = new PoolProperties();
p.setUrl("jdbc:stub");
p.setDriverClassName("com.zaxxer.hikari.performance.StubDriver");
p.setUsername("sa");
p.setPassword("");
p.setInitialSize(POOL_MAX / 2);
p.setMinIdle(0);
p.setMaxIdle(POOL_MAX);
p.setMaxActive(POOL_MAX);
p.setMaxWait(8000);
p.setMinEvictableIdleTimeMillis((int) TimeUnit.MINUTES.toMillis(30));
p.setTestOnBorrow(true);
p.setValidationQuery("VALUES 1");
DataSource dataSource = new org.apache.tomcat.jdbc.pool.DataSource(p);
return dataSource;
}
private class MixedRunner implements Measurable
{
private CyclicBarrier barrier;

Loading…
Cancel
Save