Author: shawkins
Date: 2012-02-07 23:26:20 -0500 (Tue, 07 Feb 2012)
New Revision: 3854
Added:
branches/7.7.x/test-integration/perf/
branches/7.7.x/test-integration/perf/pom.xml
branches/7.7.x/test-integration/perf/src/
branches/7.7.x/test-integration/perf/src/test/
branches/7.7.x/test-integration/perf/src/test/java/
branches/7.7.x/test-integration/perf/src/test/java/org/
branches/7.7.x/test-integration/perf/src/test/java/org/teiid/
branches/7.7.x/test-integration/perf/src/test/java/org/teiid/query/
branches/7.7.x/test-integration/perf/src/test/java/org/teiid/query/processor/
branches/7.7.x/test-integration/perf/src/test/java/org/teiid/query/processor/relational/
branches/7.7.x/test-integration/perf/src/test/java/org/teiid/query/processor/relational/TestPerformance.java
branches/7.7.x/test-integration/perf/src/test/resources/
Modified:
branches/7.7.x/api/src/main/java/org/teiid/logging/JavaLogger.java
branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/SPage.java
branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/STree.java
branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/TupleBrowser.java
branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/impl/LrfuEvictionQueue.java
branches/7.7.x/engine/src/main/java/org/teiid/query/processor/relational/EnhancedSortMergeJoinStrategy.java
branches/7.7.x/engine/src/main/java/org/teiid/query/processor/relational/RelationalNode.java
branches/7.7.x/test-integration/pom.xml
Log:
TEIID-1926 adding a performance test and changes to speed up the enhanced sort case
Modified: branches/7.7.x/api/src/main/java/org/teiid/logging/JavaLogger.java
===================================================================
--- branches/7.7.x/api/src/main/java/org/teiid/logging/JavaLogger.java 2012-02-08 02:54:20
UTC (rev 3853)
+++ branches/7.7.x/api/src/main/java/org/teiid/logging/JavaLogger.java 2012-02-08 04:26:20
UTC (rev 3854)
@@ -22,6 +22,7 @@
package org.teiid.logging;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -30,23 +31,34 @@
*/
public class JavaLogger implements org.teiid.logging.Logger {
+ private ConcurrentHashMap<String, Logger> loggers = new
ConcurrentHashMap<String, Logger>();
+
@Override
public boolean isEnabled(String context, int msgLevel) {
- Logger logger = Logger.getLogger(context);
+ Logger logger = getLogger(context);
Level javaLevel = convertLevel(msgLevel);
return logger.isLoggable(javaLevel);
}
+ private Logger getLogger(String context) {
+ Logger logger = loggers.get(context);
+ if (logger == null) {
+ logger = Logger.getLogger(context);
+ loggers.put(context, logger);
+ }
+ return logger;
+ }
+
public void log(int level, String context, Object msg) {
- Logger logger = Logger.getLogger(context);
+ Logger logger = getLogger(context);
Level javaLevel = convertLevel(level);
logger.log(javaLevel, msg.toString());
}
public void log(int level, String context, Throwable t, Object msg) {
- Logger logger = Logger.getLogger(context);
+ Logger logger = getLogger(context);
Level javaLevel = convertLevel(level);
logger.log(javaLevel, msg != null ? msg.toString() : null, t);
Modified: branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/SPage.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/SPage.java 2012-02-08
02:54:20 UTC (rev 3853)
+++ branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/SPage.java 2012-02-08
04:26:20 UTC (rev 3854)
@@ -27,9 +27,9 @@
import java.lang.ref.ReferenceQueue;
import java.util.Collections;
import java.util.IdentityHashMap;
-import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
+import java.util.ListIterator;
import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
@@ -132,7 +132,7 @@
return id;
}
- static SearchResult search(SPage page, List k, LinkedList<SearchResult> parent)
throws TeiidComponentException {
+ static SearchResult search(SPage page, List k, List<SearchResult> parent) throws
TeiidComponentException {
List<List<?>> previousValues = null;
for (;;) {
List<List<?>> values = page.getValues();
@@ -152,8 +152,8 @@
SPage childPage = page;
List oldKey = null;
List newKey = page.stree.extractKey(values.get(0));
- for (Iterator<SearchResult> desc = parent.descendingIterator();
desc.hasNext();) {
- SearchResult sr = desc.next();
+ for (ListIterator<SearchResult> desc = parent.listIterator();
desc.hasPrevious();) {
+ SearchResult sr = desc.previous();
int parentIndex = Math.max(0, -sr.index - 2);
if (oldKey == null) {
oldKey = sr.values.set(parentIndex, newKey);
Modified: branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/STree.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/STree.java 2012-02-08
02:54:20 UTC (rev 3853)
+++ branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/STree.java 2012-02-08
04:26:20 UTC (rev 3854)
@@ -235,7 +235,7 @@
* @throws IOException
* @throws TeiidComponentException
*/
- List find(List n, LinkedList<SearchResult> places) throws TeiidComponentException
{
+ List find(List n, List<SearchResult> places) throws TeiidComponentException {
SPage x = null;
for (int i = header.length - 1; i >= 0; i--) {
if (x == null) {
Modified: branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/TupleBrowser.java
===================================================================
---
branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/TupleBrowser.java 2012-02-08
02:54:20 UTC (rev 3853)
+++
branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/TupleBrowser.java 2012-02-08
04:26:20 UTC (rev 3854)
@@ -24,7 +24,6 @@
import java.util.ArrayList;
import java.util.Collections;
-import java.util.LinkedList;
import java.util.List;
import org.teiid.common.buffer.SPage.SearchResult;
@@ -53,6 +52,8 @@
private boolean direction;
private boolean inPartial;
+
+ private ArrayList<SearchResult> places = new ArrayList<SearchResult>();
/**
* Construct a value based browser. The {@link TupleSource} should already be in the
@@ -98,9 +99,8 @@
if (!isPartialKey && lowerBound != null &&
this.tree.comparator.compare(upperBound, lowerBound) < 0) {
valid = false;
}
- LinkedList<SearchResult> places = new LinkedList<SearchResult>();
- this.tree.find(upperBound, places);
- SearchResult upper = places.getLast();
+ this.tree.find(upperBound, getPlaces());
+ SearchResult upper = places.get(places.size() - 1);
bound = upper.page;
boundIndex = upper.index;
if (boundIndex < 0) {
@@ -141,10 +141,9 @@
}
private boolean setPage(List<?> lowerBound) throws TeiidComponentException {
- LinkedList<SearchResult> places = new LinkedList<SearchResult>();
- this.tree.find(lowerBound, places);
+ this.tree.find(lowerBound, getPlaces());
- SearchResult sr = places.getLast();
+ SearchResult sr = places.get(places.size() - 1);
page = sr.page;
index = sr.index;
boolean result = true;
@@ -156,6 +155,11 @@
return result;
}
+ private ArrayList<SearchResult> getPlaces() {
+ places.clear();
+ return places;
+ }
+
@Override
public List<?> nextTuple() throws TeiidComponentException,
TeiidProcessingException {
@@ -234,6 +238,11 @@
}
}
}
+
+ public void reset(TupleSource ts) throws TeiidComponentException {
+ this.valueSet = ts;
+ resetState();
+ }
private void resetState() throws TeiidComponentException {
if (updated) {
Modified:
branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/impl/LrfuEvictionQueue.java
===================================================================
---
branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/impl/LrfuEvictionQueue.java 2012-02-08
02:54:20 UTC (rev 3853)
+++
branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/impl/LrfuEvictionQueue.java 2012-02-08
04:26:20 UTC (rev 3854)
@@ -38,6 +38,8 @@
*/
public class LrfuEvictionQueue<V extends BaseCacheEntry> {
+ private static final long DEFAULT_HALF_LIFE = 1<<17;
+ private static final long MIN_INTERVAL = 1<<10;
//TODO: until Java 7 ConcurrentSkipListMap has a scaling bug in that
//the level function limits the effective map size to ~ 2^16
//above which it performs comparably under multi-threaded load to a synchronized
LinkedHashMap
@@ -49,7 +51,7 @@
public LrfuEvictionQueue(AtomicLong clock) {
this.clock = clock;
- setHalfLife(1<<17);
+ setHalfLife(DEFAULT_HALF_LIFE);
}
public boolean remove(V value) {
@@ -61,6 +63,10 @@
}
public void touch(V value) {
+ long tick = clock.get();
+ if (tick - MIN_INTERVAL < value.getKey().getLastAccess()) {
+ return;
+ }
evictionQueue.remove(value.getKey());
recordAccess(value);
evictionQueue.put(value.getKey(), value);
Modified:
branches/7.7.x/engine/src/main/java/org/teiid/query/processor/relational/EnhancedSortMergeJoinStrategy.java
===================================================================
---
branches/7.7.x/engine/src/main/java/org/teiid/query/processor/relational/EnhancedSortMergeJoinStrategy.java 2012-02-08
02:54:20 UTC (rev 3853)
+++
branches/7.7.x/engine/src/main/java/org/teiid/query/processor/relational/EnhancedSortMergeJoinStrategy.java 2012-02-08
04:26:20 UTC (rev 3854)
@@ -38,7 +38,6 @@
import org.teiid.core.TeiidProcessingException;
import org.teiid.core.types.DataTypeManager;
import org.teiid.query.optimizer.relational.rules.NewCalculateCostUtil;
-import org.teiid.query.processor.CollectionTupleSource;
import org.teiid.query.sql.lang.OrderBy;
import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.symbol.SingleElementSymbol;
@@ -55,6 +54,25 @@
*/
public class EnhancedSortMergeJoinStrategy extends MergeJoinStrategy {
+ private final class SingleTupleSource implements TupleSource {
+ boolean returned;
+ List keyTuple;
+
+ @Override
+ public List<?> nextTuple() throws TeiidComponentException,
+ TeiidProcessingException {
+ if (!returned) {
+ returned = true;
+ return keyTuple;
+ }
+ return null;
+ }
+
+ @Override
+ public void closeSource() {
+ }
+ }
+
private boolean semiDep;
private TupleSource currentSource;
@@ -62,6 +80,7 @@
private SourceState notSortedSource;
private List<?> currentTuple;
private TupleBrowser tb;
+ private SingleTupleSource keyTs;
private int reserved;
private STree index;
private int[] reverseIndexes;
@@ -99,6 +118,7 @@
this.notSortedSource = null;
this.sortedTuple = null;
this.reverseIndexes = null;
+ this.keyTs = null;
}
/**
@@ -177,6 +197,9 @@
this.index.removeRowIdFromKey();
state.markDistinct(true);
}
+ keyTs = new SingleTupleSource();
+ keyTs.keyTuple = new
ArrayList<Object>(notSortedSource.getExpressionIndexes().length);
+ tb = new TupleBrowser(this.index, keyTs, OrderBy.ASC);
}
@Override
@@ -189,8 +212,8 @@
private boolean shouldIndexIfSmall(SourceState source) throws
TeiidComponentException, TeiidProcessingException {
Number cardinality = source.getSource().getEstimateNodeCardinality();
- return (source.hasBuffer() || (cardinality != null &&
cardinality.floatValue() != NewCalculateCostUtil.UNKNOWN_VALUE &&
cardinality.floatValue() <= this.joinNode.getBatchSize()))
- && (source.getRowCount() <= this.joinNode.getBatchSize());
+ return (source.hasBuffer() || (cardinality != null &&
cardinality.floatValue() != NewCalculateCostUtil.UNKNOWN_VALUE &&
cardinality.floatValue() <= source.getSource().getBatchSize() / 4))
+ && (source.getRowCount() <= source.getSource().getBatchSize() / 2);
}
@Override
@@ -318,8 +341,10 @@
this.joinNode.addBatchRow(outputTuple(this.leftSource.getOuterVals(), tuple));
continue;
}
- List<?> key =
RelationalNode.projectTuple(this.notSortedSource.getExpressionIndexes(),
this.currentTuple);
- tb = new TupleBrowser(this.index, new
CollectionTupleSource(Arrays.asList(key).iterator()), OrderBy.ASC);
+ this.keyTs.keyTuple.clear();
+ RelationalNode.projectTuple(this.notSortedSource.getExpressionIndexes(),
this.currentTuple, this.keyTs.keyTuple, false);
+ keyTs.returned = false;
+ tb.reset(keyTs);
}
if (sortedTuple == null) {
sortedTuple = tb.nextTuple();
Modified:
branches/7.7.x/engine/src/main/java/org/teiid/query/processor/relational/RelationalNode.java
===================================================================
---
branches/7.7.x/engine/src/main/java/org/teiid/query/processor/relational/RelationalNode.java 2012-02-08
02:54:20 UTC (rev 3853)
+++
branches/7.7.x/engine/src/main/java/org/teiid/query/processor/relational/RelationalNode.java 2012-02-08
04:26:20 UTC (rev 3854)
@@ -378,11 +378,12 @@
public static <T> List<T> projectTuple(int[] indexes, List<T>
tupleValues) {
return projectTuple(indexes, tupleValues, false);
}
-
+
public static <T> List<T> projectTuple(int[] indexes, List<T>
tupleValues, boolean omitMissing) {
-
- List<T> projectedTuple = new ArrayList<T>(indexes.length);
-
+ return projectTuple(indexes, tupleValues, new ArrayList<T>(indexes.length),
omitMissing);
+ }
+
+ public static <T> List<T> projectTuple(int[] indexes, List<T>
tupleValues, List<T> projectedTuple, boolean omitMissing) {
for (int index : indexes) {
if (omitMissing && index == -1) {
projectedTuple.add(null);
Added: branches/7.7.x/test-integration/perf/pom.xml
===================================================================
--- branches/7.7.x/test-integration/perf/pom.xml (rev 0)
+++ branches/7.7.x/test-integration/perf/pom.xml 2012-02-08 04:26:20 UTC (rev 3854)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>teiid-test-integration</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.7.0.CR1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>test-integration-perf</artifactId>
+ <name>Common Integration Tests</name>
+ <description>Performance tests that do not require external
dependencies</description>
+
+ <dependencies>
+ <dependency>
+ <artifactId>teiid-cache-jbosscache</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ </dependency>
+ <dependency>
+ <groupId>jgroups</groupId>
+ <artifactId>jgroups</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
Property changes on: branches/7.7.x/test-integration/perf/pom.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
branches/7.7.x/test-integration/perf/src/test/java/org/teiid/query/processor/relational/TestPerformance.java
===================================================================
---
branches/7.7.x/test-integration/perf/src/test/java/org/teiid/query/processor/relational/TestPerformance.java
(rev 0)
+++
branches/7.7.x/test-integration/perf/src/test/java/org/teiid/query/processor/relational/TestPerformance.java 2012-02-08
04:26:20 UTC (rev 3854)
@@ -0,0 +1,250 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.query.processor.relational;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.teiid.common.buffer.BlockedException;
+import org.teiid.common.buffer.BufferManager;
+import org.teiid.common.buffer.TupleBatch;
+import org.teiid.common.buffer.impl.BufferFrontedFileStoreCache;
+import org.teiid.common.buffer.impl.BufferManagerImpl;
+import org.teiid.common.buffer.impl.FileStorageManager;
+import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidProcessingException;
+import org.teiid.core.types.DataTypeManager;
+import org.teiid.core.util.UnitTestUtil;
+import org.teiid.query.processor.relational.MergeJoinStrategy.SortOption;
+import org.teiid.query.processor.relational.SortUtility.Mode;
+import org.teiid.query.sql.lang.JoinType;
+import org.teiid.query.sql.lang.OrderBy;
+import org.teiid.query.sql.symbol.ElementSymbol;
+import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.util.CommandContext;
+
+@SuppressWarnings("nls")
+public class TestPerformance {
+
+ private static BufferManagerImpl bm;
+ private static ExecutorService es;
+ private static Random r = new Random(0);
+
+ private void runTask(final int iterations, int threadCount,
+ final Callable<Void> task) throws InterruptedException, Exception {
+ List<Callable<Void>> tasks = new
ArrayList<Callable<Void>>(threadCount);
+ for (int i = 0; i < threadCount; i++) {
+ tasks.add(new Callable<Void>() {
+
+ @Override
+ public Void call() throws Exception {
+ for (int j = 0; j < iterations; j++) {
+ task.call();
+ }
+ return null;
+ }
+
+ });
+ }
+ es.invokeAll(tasks);
+ for (Callable<Void> callable : tasks) {
+ callable.call();
+ }
+ }
+
+ private void process(RelationalNode node, int expectedRows)
+ throws TeiidComponentException, TeiidProcessingException {
+ node.open();
+
+ int currentRow = 1;
+ while(true) {
+ try {
+ TupleBatch batch = node.nextBatch();
+ currentRow += batch.getRowCount();
+ if(batch.getTerminationFlag()) {
+ break;
+ }
+ } catch (BlockedException e) {
+
+ }
+ }
+ assertEquals(expectedRows, currentRow - 1);
+ node.close();
+ }
+
+ public void helpTestSort(final BufferManager bufferManager, final int rowCount, final
int iterations, int threadCount) throws Exception {
+ final List<?>[] data = sampleData(rowCount);
+
+ ElementSymbol elem1 = new ElementSymbol("e1");
+ elem1.setType(DataTypeManager.DefaultDataClasses.INTEGER);
+ ElementSymbol elem2 = new ElementSymbol("e2");
+ elem2.setType(DataTypeManager.DefaultDataClasses.STRING);
+
+ final List<ElementSymbol> sortElements = Arrays.asList(elem1);
+ final List<ElementSymbol> elems = Arrays.asList(elem1, elem2);
+ final Callable<Void> task = new Callable<Void>() {
+ @Override
+ public Void call() throws Exception {
+ helpTestSort(Mode.SORT, rowCount, sortElements, data, elems, bufferManager);
+ return null;
+ }
+ };
+ runTask(iterations, threadCount, task);
+ }
+
+ private List<?>[] sampleData(final int rowCount) {
+ final List<?>[] data = new List<?>[rowCount];
+
+ for (int i = 0; i < rowCount; i++) {
+ data[i] = Arrays.asList(i, String.valueOf(i));
+ }
+ Collections.shuffle(Arrays.asList(data), r);
+ return data;
+ }
+
+ public void helpTestSort(Mode mode, int expectedRowCount, List<? extends
SingleElementSymbol> sortElements, List<?>[] data, List<? extends
SingleElementSymbol> elems, BufferManager bufferManager) throws
TeiidComponentException, TeiidProcessingException {
+ CommandContext context = new CommandContext ("pid", "test", null,
null, 1); //$NON-NLS-1$ //$NON-NLS-2$
+
+ FakeRelationalNode dataNode = new FakeRelationalNode(0, data);
+ dataNode.setElements(elems);
+ dataNode.initialize(context, bufferManager, null);
+
+ SortNode sortNode = new SortNode(1);
+ sortNode.setSortElements(new OrderBy(sortElements).getOrderByItems());
+ sortNode.setMode(mode);
+ sortNode.setElements(dataNode.getElements());
+ sortNode.addChild(dataNode);
+ sortNode.initialize(context, dataNode.getBufferManager(), null);
+
+ process(sortNode, expectedRowCount);
+ }
+
+ public void helpTestEquiJoin(int expectedRowCount, List<?>[] leftData,
List<?>[] rightData, List<? extends SingleElementSymbol> elems, BufferManager
bufferManager, JoinStrategy joinStrategy, JoinType joinType) throws
TeiidComponentException, TeiidProcessingException {
+ CommandContext context = new CommandContext ("pid", "test", null,
null, 1); //$NON-NLS-1$ //$NON-NLS-2$
+
+ FakeRelationalNode dataNode1 = new FakeRelationalNode(1, leftData);
+ dataNode1.setElements(elems);
+ dataNode1.initialize(context, bufferManager, null);
+
+ FakeRelationalNode dataNode2 = new FakeRelationalNode(2, rightData);
+ dataNode2.setElements(elems);
+ dataNode2.initialize(context, bufferManager, null);
+
+ JoinNode join = new JoinNode(3);
+ join.addChild(dataNode1);
+ join.addChild(dataNode2);
+ join.setJoinStrategy(joinStrategy.clone());
+ join.setElements(elems);
+ join.setJoinType(joinType);
+ join.setJoinExpressions(elems.subList(0, 1), elems.subList(0, 1));
+ join.initialize(context, bufferManager, null);
+
+ process(join, expectedRowCount);
+ }
+
+ public void helpTestEquiJoin(final BufferManager bufferManager, int leftRowCount, int
rightRowCount, final int iterations, int threadCount, final JoinStrategy joinStrategy,
final JoinType joinType, final int expectedRowCount) throws Exception {
+ final List<?>[] leftData = sampleData(leftRowCount);
+ final List<?>[] rightData = sampleData(rightRowCount);
+
+ ElementSymbol elem1 = new ElementSymbol("e1");
+ elem1.setType(DataTypeManager.DefaultDataClasses.INTEGER);
+ ElementSymbol elem2 = new ElementSymbol("e2");
+ elem2.setType(DataTypeManager.DefaultDataClasses.STRING);
+
+ final List<ElementSymbol> elems = Arrays.asList(elem1, elem2);
+ final Callable<Void> task = new Callable<Void>() {
+ @Override
+ public Void call() throws Exception {
+ helpTestEquiJoin(expectedRowCount, leftData, rightData, elems, bufferManager,
joinStrategy, joinType);
+ return null;
+ }
+ };
+ runTask(iterations, threadCount, task);
+ }
+
+ @BeforeClass public static void oneTimeSetup() throws TeiidComponentException {
+ bm = new BufferManagerImpl();
+
+ bm.setMaxProcessingKB(1<<12);
+ bm.setMaxReserveKB((1<<19)-(1<<17));
+ bm.setMaxActivePlans(20);
+
+ BufferFrontedFileStoreCache cache = new BufferFrontedFileStoreCache();
+ cache.setMemoryBufferSpace(1<<27);
+ FileStorageManager fsm = new FileStorageManager();
+ fsm.setStorageDirectory(UnitTestUtil.getTestScratchPath() + "/data");
+ cache.setStorageManager(fsm);
+ cache.initialize();
+ bm.setCache(cache);
+ bm.initialize();
+
+ es = Executors.newCachedThreadPool();
+ }
+
+ @Test public void runSort_1_100() throws Exception {
+ helpTestSort(bm, 100, 20000, 1);
+ }
+
+ @Test public void runSort_4_5000() throws Exception {
+ helpTestSort(bm, 5000, 1000, 4);
+ }
+
+ @Test public void runSort_16_250000() throws Exception {
+ helpTestSort(bm, 250000, 10, 16);
+ }
+
+ @Test public void runInnerEnhancedJoin_1_100_500() throws Exception {
+ helpTestEquiJoin(bm, 100, 500, 10000, 1, new
EnhancedSortMergeJoinStrategy(SortOption.SORT, SortOption.SORT), JoinType.JOIN_INNER,
100);
+ }
+
+ @Test public void runInnerEnhancedJoin_4_200_15000() throws Exception {
+ helpTestEquiJoin(bm, 200, 15000, 500, 4, new
EnhancedSortMergeJoinStrategy(SortOption.SORT, SortOption.SORT), JoinType.JOIN_INNER,
200);
+ }
+
+ @Test public void runInnerEnhancedJoin_16_400_500000() throws Exception {
+ helpTestEquiJoin(bm, 400, 500000, 10, 16, new
EnhancedSortMergeJoinStrategy(SortOption.SORT, SortOption.SORT), JoinType.JOIN_INNER,
400);
+ }
+
+ @Test public void runInnerMergeJoin_1_100_100() throws Exception {
+ helpTestEquiJoin(bm, 100, 100, 10000, 1, new MergeJoinStrategy(SortOption.SORT,
SortOption.SORT, false), JoinType.JOIN_INNER, 100);
+ }
+
+ @Test public void runInnerMergeJoin_4_4000_4000() throws Exception {
+ helpTestEquiJoin(bm, 4000, 4000, 500, 4, new MergeJoinStrategy(SortOption.SORT,
SortOption.SORT, false), JoinType.JOIN_INNER, 4000);
+ }
+
+ @Test public void runInnerMergeJoin_16_100000_100000() throws Exception {
+ helpTestEquiJoin(bm, 100000, 100000, 10, 16, new MergeJoinStrategy(SortOption.SORT,
SortOption.SORT, false), JoinType.JOIN_INNER, 100000);
+ }
+
+}
Property changes on:
branches/7.7.x/test-integration/perf/src/test/java/org/teiid/query/processor/relational/TestPerformance.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/7.7.x/test-integration/pom.xml
===================================================================
--- branches/7.7.x/test-integration/pom.xml 2012-02-08 02:54:20 UTC (rev 3853)
+++ branches/7.7.x/test-integration/pom.xml 2012-02-08 04:26:20 UTC (rev 3854)
@@ -19,6 +19,18 @@
<apache.ant.version>1.7.0</apache.ant.version>
</properties>
+ <profiles>
+ <profile>
+ <!--
+ This profile is activated manually, as in "mvn ... -P release ..."
+ -->
+ <id>perf</id>
+ <modules>
+ <module>perf</module>
+ </modules>
+ </profile>
+ </profiles>
+
<dependencies>
<dependency>
<groupId>org.jboss.teiid</groupId>