Author: [email protected]
Date: Tue Apr 5 17:17:30 2011
New Revision: 944
Log:
[AMDATU-340] Fixed support for testing cassandra PM on earlier versions
(without Hector API)
Modified:
trunk/etc/jmeter/Amdatu Cassandra PM.jmx
trunk/etc/performancetest-bundle/src/main/java/org/amdatu/test/performance/service/CassandraTest.java
trunk/etc/performancetest-bundle/src/main/java/org/amdatu/test/performance/service/InitServiceImpl.java
trunk/etc/performancetest-bundle/src/main/java/org/amdatu/test/performance/service/RESTPerformanceTest.java
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/analysis/JMeterResultsParser.java
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/analysis/ReportSummary.java
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/analysis/Statistics.java
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/analysis/XYSample.java
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/analysis/ZSamples.java
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/main/Main.java
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/runtest/ApplicationContext.java
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/runtest/JMeterRunner.java
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/runtest/TestContext.java
Modified: trunk/etc/jmeter/Amdatu Cassandra PM.jmx
==============================================================================
--- trunk/etc/jmeter/Amdatu Cassandra PM.jmx (original)
+++ trunk/etc/jmeter/Amdatu Cassandra PM.jmx Tue Apr 5 17:17:30 2011
@@ -26,6 +26,15 @@
<stringProp name="ThreadGroup.delay"></stringProp>
</ThreadGroup>
<hashTree>
+ <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig"
testname="Thread nr" enabled="true">
+ <stringProp name="CounterConfig.start">1</stringProp>
+ <stringProp name="CounterConfig.end"></stringProp>
+ <stringProp name="CounterConfig.incr">1</stringProp>
+ <stringProp name="CounterConfig.name">threadnr</stringProp>
+ <stringProp name="CounterConfig.format"></stringProp>
+ <boolProp name="CounterConfig.per_user">false</boolProp>
+ </CounterConfig>
+ <hashTree/>
<ConfigTestElement guiclass="HttpDefaultsGui"
testclass="ConfigTestElement" testname="HTTP Request Defaults" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments"
guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined
Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
@@ -50,17 +59,46 @@
<stringProp name="LoopController.loops">10</stringProp>
</LoopController>
<hashTree>
+ <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig"
testname="Counter" enabled="true">
+ <stringProp name="CounterConfig.start">1</stringProp>
+ <stringProp name="CounterConfig.end"></stringProp>
+ <stringProp name="CounterConfig.incr">1</stringProp>
+ <stringProp name="CounterConfig.name">index</stringProp>
+ <stringProp name="CounterConfig.format"></stringProp>
+ <boolProp name="CounterConfig.per_user">false</boolProp>
+ </CounterConfig>
+ <hashTree/>
+ <HTTPSampler guiclass="HttpTestSampleGui" testclass="HTTPSampler"
testname="Create private CF" enabled="true">
+ <elementProp name="HTTPsampler.Arguments" elementType="Arguments"
guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined
Variables" enabled="true">
+ <collectionProp name="Arguments.arguments"/>
+ </elementProp>
+ <stringProp name="HTTPSampler.domain"></stringProp>
+ <stringProp name="HTTPSampler.port"></stringProp>
+ <stringProp name="HTTPSampler.connect_timeout"></stringProp>
+ <stringProp name="HTTPSampler.response_timeout"></stringProp>
+ <stringProp name="HTTPSampler.protocol"></stringProp>
+ <stringProp name="HTTPSampler.contentEncoding"></stringProp>
+ <stringProp
name="HTTPSampler.path">/rest/performancetest/cassandra/private/CF_${index}</stringProp>
+ <stringProp name="HTTPSampler.method">PUT</stringProp>
+ <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
+ <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
+ <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
+ <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
+ <boolProp name="HTTPSampler.monitor">false</boolProp>
+ <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
+ </HTTPSampler>
+ <hashTree/>
<HTTPSampler guiclass="HttpTestSampleGui" testclass="HTTPSampler"
testname="Global setValue" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments"
guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined
Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="HTTPSampler.domain"></stringProp>
- <stringProp name="HTTPSampler.port">3737</stringProp>
+ <stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
- <stringProp
name="HTTPSampler.path">/rest/performancetest/cassandra/global/setvalue</stringProp>
+ <stringProp
name="HTTPSampler.path">/rest/performancetest/cassandra/global/${threadnr}/setvalue</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
@@ -75,12 +113,12 @@
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="HTTPSampler.domain"></stringProp>
- <stringProp name="HTTPSampler.port">3737</stringProp>
+ <stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
- <stringProp
name="HTTPSampler.path">/rest/performancetest/cassandra/private/setvalue</stringProp>
+ <stringProp
name="HTTPSampler.path">/rest/performancetest/cassandra/private/CF_${index}/setvalue</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
@@ -95,7 +133,7 @@
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="HTTPSampler.domain"></stringProp>
- <stringProp name="HTTPSampler.port">3737</stringProp>
+ <stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp>
@@ -115,12 +153,12 @@
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="HTTPSampler.domain"></stringProp>
- <stringProp name="HTTPSampler.port">3737</stringProp>
+ <stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
- <stringProp
name="HTTPSampler.path">/rest/performancetest/cassandra/private/getrowkeys</stringProp>
+ <stringProp
name="HTTPSampler.path">/rest/performancetest/cassandra/private/CF_${index}/getrowkeys</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
@@ -135,12 +173,12 @@
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="HTTPSampler.domain"></stringProp>
- <stringProp name="HTTPSampler.port">3737</stringProp>
+ <stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
- <stringProp
name="HTTPSampler.path">/rest/performancetest/cassandra/global/getsupercolumns</stringProp>
+ <stringProp
name="HTTPSampler.path">/rest/performancetest/cassandra/global/${threadnr}/getsupercolumns</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
@@ -155,12 +193,12 @@
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="HTTPSampler.domain"></stringProp>
- <stringProp name="HTTPSampler.port">3737</stringProp>
+ <stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
- <stringProp
name="HTTPSampler.path">/rest/performancetest/cassandra/private/getsupercolumns</stringProp>
+ <stringProp
name="HTTPSampler.path">/rest/performancetest/cassandra/private/CF_${index}/getsupercolumns</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
@@ -175,12 +213,12 @@
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="HTTPSampler.domain"></stringProp>
- <stringProp name="HTTPSampler.port">3737</stringProp>
+ <stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
- <stringProp
name="HTTPSampler.path">/rest/performancetest/cassandra/global/removerows</stringProp>
+ <stringProp
name="HTTPSampler.path">/rest/performancetest/cassandra/global/${threadnr}/removerows</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
@@ -195,12 +233,12 @@
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="HTTPSampler.domain"></stringProp>
- <stringProp name="HTTPSampler.port">3737</stringProp>
+ <stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
- <stringProp
name="HTTPSampler.path">/rest/performancetest/cassandra/private/removerows</stringProp>
+ <stringProp
name="HTTPSampler.path">/rest/performancetest/cassandra/private/CF_${index}/removerows</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
Modified:
trunk/etc/performancetest-bundle/src/main/java/org/amdatu/test/performance/service/CassandraTest.java
==============================================================================
---
trunk/etc/performancetest-bundle/src/main/java/org/amdatu/test/performance/service/CassandraTest.java
(original)
+++
trunk/etc/performancetest-bundle/src/main/java/org/amdatu/test/performance/service/CassandraTest.java
Tue Apr 5 17:17:30 2011
@@ -16,7 +16,6 @@
*/
package org.amdatu.test.performance.service;
-import static
org.amdatu.test.performance.service.TestColumnFamilyProvider.GLOBAL_CF;
import static
org.amdatu.test.performance.service.TestColumnFamilyProvider.KEYSPACE;
import org.amdatu.cassandra.application.CassandraDaemonService;
@@ -29,86 +28,76 @@
import org.apache.thrift.TException;
public class CassandraTest {
- private final static int INSERTS = 500;
- private static int COUNTER = 1;
+ private final static int INSERTS = 100;
private CassandraPersistenceManager m_pm;
- private String m_privateCFName;
+ private CassandraDaemonService m_daemon;
public CassandraTest(CassandraDaemonService daemon,
CassandraPersistenceManager pm) throws NotFoundException,
InvalidRequestException, TException {
m_pm = pm;
- m_privateCFName = "CF_" + COUNTER++;
- if (!daemon.columnFamilyExists(KEYSPACE, m_privateCFName)) {
- daemon.addColumnFamily(KEYSPACE, m_privateCFName,
ColumnType.SUPER.value, CompareType.BYTESTYPE.value,
CompareType.BYTESTYPE.value);
- }
+ m_daemon = daemon;
}
- public String testGlobalSetValue() throws CassandraException {
- long start = System.currentTimeMillis();
- for (int i=0; i<INSERTS; i++) {
- m_pm.setValue(GLOBAL_CF, "row_" + i, "super", "column",
"value_"+i);
+ public boolean isHectorAPIAvailable() {
+ try {
+ CassandraPersistenceManager.class.getDeclaredMethod("getRows",
String.class, Class.class);
+ return true;
}
- long diff = System.currentTimeMillis() - start;
- return "Test completed in " + diff + " milliseconds";
- }
+ catch (SecurityException e) {}
+ catch (NoSuchMethodException e) {}
- public String testPrivateSetValue() throws CassandraException {
- long start = System.currentTimeMillis();
- for (int i=0; i<INSERTS; i++) {
- m_pm.setValue(m_privateCFName, "row_" + i, "super", "column",
"value_"+i);
- }
- long diff = System.currentTimeMillis() - start;
- return "Test completed in " + diff + " milliseconds";
+ return false;
}
-
- public String testGlobalGetRowKeys() throws CassandraException {
- long start = System.currentTimeMillis();
- for (int i=0; i<50; i++) {
- m_pm.getRowKeys(GLOBAL_CF);
- }
- long diff = System.currentTimeMillis() - start;
- return "Test completed in " + diff + " milliseconds";
- }
-
- public String testPrivateGetRowKeys() throws CassandraException {
+
+ public String createPrivateColumnFamily(String name) throws
CassandraException, NotFoundException,
+ InvalidRequestException, TException {
long start = System.currentTimeMillis();
- for (int i=0; i<50; i++) {
- m_pm.getRowKeys(m_privateCFName);
+ if (!m_daemon.columnFamilyExists(KEYSPACE, name)) {
+ m_daemon.addColumnFamily(KEYSPACE, name, ColumnType.SUPER.value,
CompareType.BYTESTYPE.value,
+ CompareType.BYTESTYPE.value);
}
long diff = System.currentTimeMillis() - start;
return "Test completed in " + diff + " milliseconds";
}
-
- public String testGlobalGetSuperColumns() throws CassandraException {
+
+ public String testSetValue(String cfName, String rowPrefix) throws
CassandraException {
long start = System.currentTimeMillis();
- for (int i=0; i<INSERTS; i++) {
- m_pm.getSuperColumns(GLOBAL_CF, "row_"+i, String.class);
+ for (int i = 0; i < INSERTS; i++) {
+ if (isHectorAPIAvailable()) {
+ m_pm.setValue(cfName, rowPrefix + "row_" + i, "super",
"column", "value_" + i);
+ } else {
+ m_pm.setStringValue(cfName, rowPrefix + "row_" + i, "super",
"column", "value_" + i);
+ }
}
long diff = System.currentTimeMillis() - start;
return "Test completed in " + diff + " milliseconds";
}
-
- public String testPrivateGetSuperColumns() throws CassandraException {
+
+ public String testGetRowKeys(String cfName) throws CassandraException {
long start = System.currentTimeMillis();
- for (int i=0; i<INSERTS; i++) {
- m_pm.getSuperColumns(m_privateCFName, "row_"+i, String.class);
+ for (int i = 0; i < 10; i++) {
+ m_pm.getRowKeys(cfName);
}
long diff = System.currentTimeMillis() - start;
return "Test completed in " + diff + " milliseconds";
}
-
- public String testGlobalRemoveRows() throws CassandraException {
+
+ public String testGetSuperColumns(String cfName, String rowPrefix) throws
CassandraException {
long start = System.currentTimeMillis();
- for (int i=0; i<INSERTS; i++) {
- m_pm.deleteRow(GLOBAL_CF, "row_"+i);
+ for (int i = 0; i < INSERTS; i++) {
+ if (isHectorAPIAvailable()) {
+ m_pm.getSuperColumns(cfName, rowPrefix + "row_" + i,
String.class);
+ } else {
+ m_pm.getSuperValues(cfName, rowPrefix + "row_" + i);
+ }
}
long diff = System.currentTimeMillis() - start;
return "Test completed in " + diff + " milliseconds";
}
-
- public String testPrivateRemoveRows() throws CassandraException {
+
+ public String testRemoveRows(String cfName, String rowPrefix) throws
CassandraException {
long start = System.currentTimeMillis();
- for (int i=0; i<INSERTS; i++) {
- m_pm.deleteRow(m_privateCFName, "row_"+i);
+ for (int i = 0; i < INSERTS; i++) {
+ m_pm.deleteRow(cfName, rowPrefix + "row_" + i);
}
long diff = System.currentTimeMillis() - start;
return "Test completed in " + diff + " milliseconds";
Modified:
trunk/etc/performancetest-bundle/src/main/java/org/amdatu/test/performance/service/InitServiceImpl.java
==============================================================================
---
trunk/etc/performancetest-bundle/src/main/java/org/amdatu/test/performance/service/InitServiceImpl.java
(original)
+++
trunk/etc/performancetest-bundle/src/main/java/org/amdatu/test/performance/service/InitServiceImpl.java
Tue Apr 5 17:17:30 2011
@@ -6,16 +6,22 @@
import org.osgi.service.log.LogService;
public class InitServiceImpl implements InitService {
+ private static boolean DROP = false;
+
private volatile CassandraDaemonService m_cassandraDaemon;
private volatile LogService m_logService;
public void start() throws TException, InvalidRequestException {
// This service removes the test keyspace if it exists, to ensure that
upon startup
// everything is 'clean'
- if
(m_cassandraDaemon.keyspaceExists(TestColumnFamilyProvider.KEYSPACE)) {
- m_logService.log(LogService.LOG_WARNING, "Dropping keyspace '" +
TestColumnFamilyProvider.KEYSPACE + "', this may take some time...");
- m_cassandraDaemon.dropKeyspace(TestColumnFamilyProvider.KEYSPACE);
- m_logService.log(LogService.LOG_WARNING, "Dropping keyspace
finished.");
+ if (DROP) {
+ if
(m_cassandraDaemon.keyspaceExists(TestColumnFamilyProvider.KEYSPACE)) {
+ m_logService.log(LogService.LOG_WARNING, "Dropping keyspace '"
+ TestColumnFamilyProvider.KEYSPACE + "', this may take some time...");
+
m_cassandraDaemon.dropKeyspace(TestColumnFamilyProvider.KEYSPACE);
+ m_logService.log(LogService.LOG_WARNING, "Dropping keyspace
finished.");
+ } else {
+ m_logService.log(LogService.LOG_WARNING, "Test keyspace does
not yet exist.");
+ }
}
}
}
Modified:
trunk/etc/performancetest-bundle/src/main/java/org/amdatu/test/performance/service/RESTPerformanceTest.java
==============================================================================
---
trunk/etc/performancetest-bundle/src/main/java/org/amdatu/test/performance/service/RESTPerformanceTest.java
(original)
+++
trunk/etc/performancetest-bundle/src/main/java/org/amdatu/test/performance/service/RESTPerformanceTest.java
Tue Apr 5 17:17:30 2011
@@ -20,7 +20,9 @@
import java.net.URL;
import javax.ws.rs.GET;
+import javax.ws.rs.PUT;
import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.CacheControl;
@@ -30,11 +32,14 @@
import org.amdatu.cassandra.application.CassandraDaemonService;
import org.amdatu.cassandra.persistencemanager.CassandraPersistenceManager;
import org.amdatu.web.httpcontext.ResourceProvider;
+import org.osgi.service.log.LogService;
/**
*/
@Path("performancetest")
public class RESTPerformanceTest implements ResourceProvider {
+ private volatile LogService m_logService;
+
// Disable HTTP caching in this REST interface
private static CacheControl m_cacheControl;
static {
@@ -45,14 +50,38 @@
// Service dependencies injected by the dependency manager
private CassandraDaemonService m_cassandraDaemon;
private CassandraPersistenceManager m_pm;
+
+ public void start() {
+ m_logService.log(LogService.LOG_INFO, "Cassandra PM performance test
REST interface started");
+ }
@GET
@Produces({MediaType.TEXT_PLAIN})
- @Path("cassandra/global/setvalue")
- public Response testGlobalSetValue() {
+ @Path("cassandra/status")
+ public Response status() {
+ return buildOK("Cassandra performancetest service online");
+ }
+
+ @PUT
+ @Produces({MediaType.TEXT_PLAIN})
+ @Path("cassandra/private/{cfname}")
+ public Response createColumnFamily(@PathParam("cfname") final String
columnFamilyName) {
+ String result;
+ try {
+ result = new CassandraTest(m_cassandraDaemon,
m_pm).createPrivateColumnFamily(columnFamilyName);
+ } catch (Exception e) {
+ throw new WebApplicationException(e);
+ }
+ return buildOK(result);
+ }
+
+ @GET
+ @Produces({MediaType.TEXT_PLAIN})
+ @Path("cassandra/global/{prefix}/setvalue")
+ public Response testGlobalSetValue(@PathParam("prefix") final String
rowPrefix) {
String result;
try {
- result = new CassandraTest(m_cassandraDaemon,
m_pm).testGlobalSetValue();
+ result = new CassandraTest(m_cassandraDaemon,
m_pm).testSetValue(TestColumnFamilyProvider.GLOBAL_CF, rowPrefix);
} catch (Exception e) {
throw new WebApplicationException(e);
}
@@ -61,11 +90,11 @@
@GET
@Produces({MediaType.TEXT_PLAIN})
- @Path("cassandra/private/setvalue")
- public Response testPrivateSetValue() {
+ @Path("cassandra/private/{cfname}/setvalue")
+ public Response testPrivateSetValue(@PathParam("cfname") final String
columnFamilyName) {
String result;
try {
- result = new CassandraTest(m_cassandraDaemon,
m_pm).testPrivateSetValue();
+ result = new CassandraTest(m_cassandraDaemon,
m_pm).testSetValue(columnFamilyName, "");
} catch (Exception e) {
throw new WebApplicationException(e);
}
@@ -78,7 +107,7 @@
public Response testGlobalGetRowKeys() {
String result;
try {
- result = new CassandraTest(m_cassandraDaemon,
m_pm).testGlobalGetRowKeys();
+ result = new CassandraTest(m_cassandraDaemon,
m_pm).testGetRowKeys(TestColumnFamilyProvider.GLOBAL_CF);
} catch (Exception e) {
throw new WebApplicationException(e);
}
@@ -87,11 +116,11 @@
@GET
@Produces({MediaType.TEXT_PLAIN})
- @Path("cassandra/private/getrowkeys")
- public Response testPrivateGetRowKeys() {
+ @Path("cassandra/private/{cfname}/getrowkeys")
+ public Response testPrivateGetRowKeys(@PathParam("cfname") final String
columnFamilyName) {
String result;
try {
- result = new CassandraTest(m_cassandraDaemon,
m_pm).testPrivateGetRowKeys();
+ result = new CassandraTest(m_cassandraDaemon,
m_pm).testGetRowKeys(columnFamilyName);
} catch (Exception e) {
throw new WebApplicationException(e);
}
@@ -100,11 +129,11 @@
@GET
@Produces({MediaType.TEXT_PLAIN})
- @Path("cassandra/global/getsupercolumns")
- public Response testGlobalGetSuperColumns() {
+ @Path("cassandra/global/{prefix}/getsupercolumns")
+ public Response testGlobalGetSuperColumns(@PathParam("prefix") final
String rowPrefix) {
String result;
try {
- result = new CassandraTest(m_cassandraDaemon,
m_pm).testGlobalGetSuperColumns();
+ result = new CassandraTest(m_cassandraDaemon,
m_pm).testGetSuperColumns(TestColumnFamilyProvider.GLOBAL_CF, rowPrefix);
} catch (Exception e) {
throw new WebApplicationException(e);
}
@@ -113,11 +142,11 @@
@GET
@Produces({MediaType.TEXT_PLAIN})
- @Path("cassandra/private/getsupercolumns")
- public Response testPrivateGetSuperColumns() {
+ @Path("cassandra/private/{cfname}/getsupercolumns")
+ public Response testPrivateGetSuperColumns(@PathParam("cfname") final
String columnFamilyName) {
String result;
try {
- result = new CassandraTest(m_cassandraDaemon,
m_pm).testPrivateGetSuperColumns();
+ result = new CassandraTest(m_cassandraDaemon,
m_pm).testGetSuperColumns(columnFamilyName, "");
} catch (Exception e) {
throw new WebApplicationException(e);
}
@@ -126,11 +155,11 @@
@GET
@Produces({MediaType.TEXT_PLAIN})
- @Path("cassandra/global/removerows")
- public Response testGlobalRemoveRows() {
+ @Path("cassandra/global/{cfname}/removerows")
+ public Response testGlobalRemoveRows(@PathParam("prefix") final String
rowPrefix) {
String result;
try {
- result = new CassandraTest(m_cassandraDaemon,
m_pm).testGlobalRemoveRows();
+ result = new CassandraTest(m_cassandraDaemon,
m_pm).testRemoveRows(TestColumnFamilyProvider.GLOBAL_CF, rowPrefix);
} catch (Exception e) {
throw new WebApplicationException(e);
}
@@ -139,11 +168,11 @@
@GET
@Produces({MediaType.TEXT_PLAIN})
- @Path("cassandra/private/removerows")
- public Response testPrivateRemoveRows() {
+ @Path("cassandra/private/{cfname}/removerows")
+ public Response testPrivateRemoveRows(@PathParam("cfname") final String
columnFamilyName) {
String result;
try {
- result = new CassandraTest(m_cassandraDaemon,
m_pm).testPrivateRemoveRows();
+ result = new CassandraTest(m_cassandraDaemon,
m_pm).testRemoveRows(columnFamilyName, "");
} catch (Exception e) {
throw new WebApplicationException(e);
}
Modified:
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/analysis/JMeterResultsParser.java
==============================================================================
---
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/analysis/JMeterResultsParser.java
(original)
+++
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/analysis/JMeterResultsParser.java
Tue Apr 5 17:17:30 2011
@@ -78,7 +78,7 @@
m_sampleCount++;
XYSample result = new XYSample();
- result.name = stepName;
+ result.stepName = stepName;
result.responseTime = responseTime;
result.timeStamp = timeStamp;
result.success = success;
Modified:
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/analysis/ReportSummary.java
==============================================================================
---
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/analysis/ReportSummary.java
(original)
+++
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/analysis/ReportSummary.java
Tue Apr 5 17:17:30 2011
@@ -41,12 +41,14 @@
private List<JMeterPlanReport> m_reports = new
ArrayList<JMeterPlanReport>();
private String m_versionX;
private String m_versionY;
+ private String m_reportName;
private String m_reportFileName;
private String m_template = null;
- public ReportSummary(ApplicationContext context) {
+ public ReportSummary(ApplicationContext context, String reportName) {
m_context = context;
- m_reportFileName = context.resultsDir + File.separator +
context.getReportName() + ".html";
+ m_reportName = reportName;
+ m_reportFileName = context.resultsDir + File.separator + reportName +
".html";
}
public void mergeAndAdd(JMeterResultsParser x, JMeterResultsParser y)
throws IOException, MathException {
@@ -58,7 +60,7 @@
for (String key : resultsX.keySet()) {
List<XYSample> samplesX = resultsX.get(key);
List<XYSample> samplesY = resultsY.get(key);
- ZSamples mergedReport = new ZSamples(m_context, samplesX,
samplesY);
+ ZSamples mergedReport = new ZSamples(m_context, samplesX,
samplesY, report.getName());
report.addSampleResult(mergedReport);
}
report.setThroughput(x.getThroughput(), y.getThroughput());
Modified:
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/analysis/Statistics.java
==============================================================================
---
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/analysis/Statistics.java
(original)
+++
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/analysis/Statistics.java
Tue Apr 5 17:17:30 2011
@@ -65,7 +65,7 @@
m_context.setContext(x, y);
// Merge and add the JMeter results to the overall report
- ReportSummary report = new ReportSummary(m_context);
+ ReportSummary report = new ReportSummary(m_context, reportName);
report.mergeAndAdd(resultsX, resultsY);
m_reports.add(report);
}
Modified:
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/analysis/XYSample.java
==============================================================================
---
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/analysis/XYSample.java
(original)
+++
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/analysis/XYSample.java
Tue Apr 5 17:17:30 2011
@@ -22,7 +22,7 @@
* @author ivol
*/
public class XYSample {
- String name; // Name of the sample, i.e. 'Open dashboard'
+ String stepName; // Name of the sample, i.e. 'Open dashboard'
int responseTime; // Response time
long timeStamp; // Timestamp, used for throughput calculation
boolean success; // Success indication
Modified:
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/analysis/ZSamples.java
==============================================================================
---
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/analysis/ZSamples.java
(original)
+++
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/analysis/ZSamples.java
Tue Apr 5 17:17:30 2011
@@ -37,7 +37,8 @@
public class ZSamples {
private List<Double> m_samplesX;
private List<Double> m_samplesY;
-
+ private String m_planName;
+
String name;
public boolean H0; // H0 := mean(X) = mean(Y)
double power = 0.9999;
@@ -66,8 +67,10 @@
private ApplicationContext m_context;
String runtime;
- public ZSamples(ApplicationContext context, List<XYSample> x,
List<XYSample> y) throws IOException, MathException {
+ public ZSamples(ApplicationContext context, List<XYSample> x,
List<XYSample> y, String planName) throws IOException, MathException {
m_context = context;
+ m_planName = planName.replace(m_context.getVersionVsVersion(), "");
+
preProcess(x, y);
calculate();
@@ -81,6 +84,10 @@
total += diff;
sampleSize++;
}
+ if (sampleSize <= 1) {
+ System.out.println("Not enough samples for '" + name + "' to
perform statistic analysis");
+ return;
+ }
sampleMean = total/sampleSize;
@@ -124,7 +131,8 @@
private List<Double> getZ() throws IOException, MathException {
List<Double> results = new ArrayList<Double>();
- String fileName = name + m_context.getSamplesPostFix() + ".Z";
+ String fileName = m_planName + name + m_context.getSamplesPostFix() +
".Z";
+
File samplesZOutput = new File(m_context.resultsDir, fileName);
FileOutputStream fos = null;
PrintWriter pw = null;
@@ -158,10 +166,11 @@
for (int i=0; i<results.size(); i++) {
z[i] = results.get(i);
}
-
- medianZ = new Median().evaluate(z);
- waldWolfowitzZ = getWaldWolfowitzProbability(z);
-
+
+ if (z.length > 0) {
+ medianZ = new Median().evaluate(z);
+ waldWolfowitzZ = getWaldWolfowitzProbability(z);
+ }
return results;
}
@@ -178,8 +187,8 @@
if (x.size() != y.size()) {
System.err.println("Mismatch in sample sizes: X=" + x.size() + ",
Y=" + y.size());
}
- name = x.get(0).name;
-
+ name = x.get(0).stepName;
+
// Generate new sample means
int newSampleSize = getSampleSize(x.size());
m_samplesX = new ArrayList<Double>();
@@ -240,7 +249,7 @@
medianY = new Median().evaluate(yValues);
waldWolfowitzY = getWaldWolfowitzProbability(yValues);
}
-
+
private double getWaldWolfowitzProbability(double[] values) throws
MathException {
List<Integer> signs = new ArrayList<Integer>();
double Nplus = 0, Nmin = 0;
@@ -254,7 +263,7 @@
Nplus++;
}
}
-
+
double runs = 0;
for (int i=0; i<signs.size(); i++) {
if (i > 0) {
@@ -263,7 +272,7 @@
}
}
}
-
+
// Now R should be normally distributed under the null hypothesis of
randomness
// with mean and variance:
double N = Nmin + Nplus;
@@ -271,6 +280,10 @@
double varR = ((meanR-1)*(meanR-2))/(N-1);
// Now calculate the probability of our outcome or runs under the null
hypothesis
+ if (varR == 0) {
+ System.out.println("Variance for Wald-Walfowitz test is 0, cannot
perform Wald-Wolfowitz test for these samples");
+ return 0;
+ }
if (runs < meanR) {
return new NormalDistributionImpl(meanR,
Math.sqrt(varR)).cumulativeProbability(runs);
} else {
Modified:
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/main/Main.java
==============================================================================
---
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/main/Main.java
(original)
+++
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/main/Main.java
Tue Apr 5 17:17:30 2011
@@ -157,22 +157,13 @@
List<String[]> tests = new ArrayList<String[]>();
if (arguments.containsKey(VERSIONDIR_ARG)) {
boolean verify =
Boolean.TRUE.equals(arguments.get(VERIFY_ARG));
- File[] versions = new
File(arguments.get(VERSIONDIR_ARG).toString()).listFiles();
- for (File v1: versions) {
- for (File v2: versions) {
- if (!v1.getName().endsWith(".jar") &&
!v2.getName().endsWith(".jar")) {
- if (verify ||
!v1.getAbsolutePath().equals(v2.getAbsolutePath())) {
- tests.add(new String[]{v1.getAbsolutePath(),
v2.getAbsolutePath()});
- }
- }
- }
- }
+ tests = buildTests(verify, new
File(arguments.get(VERSIONDIR_ARG).toString()));
// Remove verify flag if set, verification runs are already
explicitly set in the test array
if (verify) {
arguments.remove(VERIFY_ARG);
}
- } else {
+ } else if (arguments.containsKey(AMDATU_X_ARG)) {
tests.add(new String[]{arguments.get(AMDATU_X_ARG).toString(),
arguments.get(AMDATU_Y_ARG).toString()});
}
@@ -201,15 +192,16 @@
}
}
}
- if (Boolean.TRUE.equals(arguments.get(ANALYZE_ARG))) {
- if (!arguments.containsKey(RESULTSDIR_ARG)) {
- printUsage();
- } else {
- Statistics stats = new Statistics(context);
- stats.analyze();
- stats.print();
- System.out.println("Amdatu performance test analysis
completed.");
- }
+ }
+ if (Boolean.TRUE.equals(arguments.get(ANALYZE_ARG))) {
+ if (!arguments.containsKey(RESULTSDIR_ARG)) {
+ printUsage();
+ } else {
+ ApplicationContext context = new
ApplicationContext(arguments);
+ Statistics stats = new Statistics(context);
+ stats.analyze();
+ stats.print();
+ System.out.println("Amdatu performance test analysis
completed.");
}
}
} catch (Throwable t) {
@@ -270,13 +262,17 @@
AmdatuLauncher launcher = new AmdatuLauncher(context);
JMeterRunner jmeter = new JMeterRunner(context);
- int n;
- for (n=1; n<=context.testLoops; n++) {
+ int n = context.clean ? 1 : 0;
+ for (;n<=context.testLoops; n++) {
System.out.println("*************************************************************");
- System.out.println("Running test loop " + n + " of " +
context.testLoops + "...");
-
+ if (n == 0) {
+ System.out.println("Running ramp-up loop (results will be
ignored)...");
+ } else {
+ System.out.println("Running test loop " + n + " of " +
context.testLoops + "...");
+ }
String[] versions = new String[]{ApplicationContext.VERSION_X,
ApplicationContext.VERSION_Y};
for (String version : versions) {
+ System.out.println("***** Running test on version '" +
version + "'...");
try {
context.setCurrentContext(version);
try {
@@ -286,7 +282,7 @@
launcher.kill();
launcher.start();
}
- jmeter.run();
+ jmeter.run(n == 0);
} finally {
launcher.stop();
}
@@ -303,5 +299,27 @@
return n;
}
-
+ private static List<String[]> buildTests(boolean verify, File dir) {
+ List<String[]> tests = new ArrayList<String[]>();
+ File[] versions = dir.listFiles();
+ for (File v1: versions) {
+ if (v1.isFile()) {
+ for (File v2: versions) {
+ if (v2.isFile()) {
+ if (!v1.getName().endsWith(".jar") &&
!v2.getName().endsWith(".jar")) {
+ if (verify ||
!v1.getAbsolutePath().equals(v2.getAbsolutePath())) {
+ // Now we only add the test when v1 == v2 or
v1 > v2
+ TestContext tc1 = new TestContext(v1);
+ TestContext tc2 = new TestContext(v2);
+ if (tc1.isAfterVersion(tc2.version) >= 0 ) {
+ tests.add(new
String[]{v1.getAbsolutePath(), v2.getAbsolutePath()});
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return tests;
+ }
}
\ No newline at end of file
Modified:
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/runtest/ApplicationContext.java
==============================================================================
---
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/runtest/ApplicationContext.java
(original)
+++
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/runtest/ApplicationContext.java
Tue Apr 5 17:17:30 2011
@@ -78,12 +78,12 @@
}
}
- public String getReportName() {
- return "report_" + contextX.label + "-vs-" + contextY.label;
+ public String getVersionVsVersion() {
+ return contextX.version + "-vs-" + contextY.version;
}
public String getSamplesPostFix() {
- return "_" + contextX.label + "-vs-" + contextY.label + "_samples";
+ return "_" + contextX.version + "-vs-" + contextY.version +
"_samples";
}
private File getRootTmpDir(Object tmpDirArg) {
Modified:
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/runtest/JMeterRunner.java
==============================================================================
---
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/runtest/JMeterRunner.java
(original)
+++
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/runtest/JMeterRunner.java
Tue Apr 5 17:17:30 2011
@@ -51,7 +51,7 @@
m_context = context;
}
- public void run() throws FileNotFoundException, IOException,
InterruptedException {
+ public void run(boolean rampUp) throws FileNotFoundException, IOException,
InterruptedException {
File resultDir = new File(m_context.resultsDir);
File jmeterLogFile = new File(resultDir, "jmeter.log");
@@ -65,8 +65,12 @@
preparePlan(jmeterPlan);
// Run the JMeter plan!
- String sampleName = jmeterPlan.getName().replace(".jmx", "") +
m_context.getSamplesPostFix()+ "." + m_context.currentContextName;
- m_sampleFile = new File(resultDir, sampleName);
+ if (rampUp) {
+ m_sampleFile = new File(m_context.rootTmpDir,
"rampupsamples");
+ } else {
+ String sampleName = jmeterPlan.getName().replace(".jmx",
"") + m_context.getSamplesPostFix()+ "." + m_context.currentContextName;
+ m_sampleFile = new File(resultDir, sampleName);
+ }
List<String> command = new ArrayList<String>();
String os = System.getProperty("os.name");
if (os.indexOf("Windows") != -1) {
@@ -94,17 +98,24 @@
cmd += c + " ";
}
cmd = cmd.substring(0, cmd.length()-1);
+
System.out.println("------------------------------------------------");
+ System.out.println("Executing JMeter plan '" +
jmeterPlan.getName() + "'" + (rampUp ? " (ramp-up mode)" : ""));
+ System.out.println("");
System.out.println("Executing '" + cmd + "'");
ProcessBuilder processBuilder = new ProcessBuilder(command);
processBuilder.directory(jmeterDir);
- System.out.println("Running JMeter plan '" +
jmeterPlan.getAbsolutePath() + "' from directory '" +
jmeterDir.getAbsolutePath() + "'");
+ System.out.println("Running JMeter plan '" +
jmeterPlan.getName() + "' from directory '" + jmeterDir.getAbsolutePath() +
"'");
+ long before = System.currentTimeMillis();
m_jmeterProcess = processBuilder.start();
Utils.dispatchOutput(m_jmeterProcess);
m_jmeterProcess.waitFor();
-
+ long diff = System.currentTimeMillis() - before;
+ System.out.println("JMeter plan execution finished in " + diff
+ " milliseconds");
if (m_context.omit > 0) {
- merge(m_sampleFile.getAbsolutePath()+ ".tmp",
m_context.omit);
+ if (!rampUp) {
+ merge(m_sampleFile.getAbsolutePath()+ ".tmp",
m_context.omit);
+ }
new File(m_sampleFile.getAbsolutePath()+ ".tmp").delete();
}
}
@@ -165,7 +176,7 @@
}
} else if (isNewFile) {
if (line.indexOf("<testResults ") != -1) {
- line = line.replace(">", " amdatuversion=\"" +
m_context.currentContext.label + "\">");
+ line = line.replace(">", " amdatuversion=\"" +
m_context.currentContext.version + "\">");
}
write = true;
}
Modified:
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/runtest/TestContext.java
==============================================================================
---
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/runtest/TestContext.java
(original)
+++
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/runtest/TestContext.java
Tue Apr 5 17:17:30 2011
@@ -19,16 +19,16 @@
import java.io.File;
public class TestContext {
- public String label;
+ public String version;
public String binFile;
public TestContext(File zipFile) {
binFile = zipFile.getAbsolutePath();
- label = getVersionFromZipName(zipFile.getName());
+ version = getVersionFromZipName(zipFile.getName());
}
public TestContext(String name) {
- label = name;
+ version = name;
}
private static String getVersionFromZipName(String zipName) {
@@ -43,13 +43,13 @@
// 0 if they are equal
// -1 if the specified version is before the version of this context
// +1 if the specified version is after the version of this context
- public int isAfterVersion(String version) {
- if (label.equals(version)) {
+ public int isAfterVersion(String version2) {
+ if (version.equals(version2)) {
// Same versions
return 0;
}
- String[] v1 = label.split("\\.");
- String[] v2 = version.split("\\.");
+ String[] v1 = version.split("\\.");
+ String[] v2 = version2.split("\\.");
if (v1[2].endsWith("-SNAPSHOT")) {
v1[2] = v1[2].substring(0, v1[2].indexOf("-SNAPSHOT"));
}
_______________________________________________
Amdatu-commits mailing list
[email protected]
http://lists.amdatu.org/mailman/listinfo/amdatu-commits