Author: rareddy
Date: 2010-05-24 12:41:41 -0400 (Mon, 24 May 2010)
New Revision: 2150
Modified:
trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
trunk/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
Log:
TEIID-1098: adding the "queryThreshold" property to the engine to define the
long running query time in seconds. Also added a method "getLongRunningRequests"
that will return any requests that took more time than the defined threshold property. The
default query threshold is 600 secs.
Modified: trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
===================================================================
--- trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2010-05-22
21:57:32 UTC (rev 2149)
+++ trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2010-05-24
16:41:41 UTC (rev 2150)
@@ -94,7 +94,9 @@
<!-- Enable Resultset Caching -->
<property name="resultSetCacheEnabled">true</property>
<!-- Turn on checking the entitlements on resources based on the roles defined
in VDB -->
- <property name="useEntitlements"
class="java.lang.Boolean">false</property>
+ <property name="useEntitlements"
class="java.lang.Boolean">false</property>
+ <!-- Long running query threshold, after which a alert can be generated by
tooling if configured-->
+ <property name="queryThresholdInSecs">600</property>
</bean>
<!-- JDBC Socket connection properties (SSL see below) -->
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java 2010-05-22
21:57:32 UTC (rev 2149)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java 2010-05-24
16:41:41 UTC (rev 2150)
@@ -40,4 +40,5 @@
Collection<org.teiid.adminapi.Transaction> getTransactions();
void terminateTransaction(String xid) throws AdminException ;
void mergeVDBs(String sourceVDBName, int sourceVDBVersion, String targetVDBName, int
targetVDBVersion) throws AdminException;
+ List<RequestMetadata> getLongRunningRequests();
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java
===================================================================
---
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java 2010-05-22
21:57:32 UTC (rev 2149)
+++
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java 2010-05-24
16:41:41 UTC (rev 2150)
@@ -34,6 +34,7 @@
static final int DEFAULT_FETCH_SIZE = RequestMessage.DEFAULT_FETCH_SIZE * 10;
static final int DEFAULT_PROCESSOR_TIMESLICE = 2000;
static final int DEFAULT_MAX_RESULTSET_CACHE_ENTRIES = 1024;
+ static final int DEFAULT_QUERY_THRESHOLD = 600;
static final String PROCESS_PLAN_QUEUE_NAME = "QueryProcessorQueue";
//$NON-NLS-1$
public static final int DEFAULT_MAX_PROCESS_WORKERS = 16;
@@ -50,6 +51,7 @@
private boolean resultSetCacheEnabled = true;
private int maxResultSetCacheEntries =
DQPConfiguration.DEFAULT_MAX_RESULTSET_CACHE_ENTRIES;
private boolean useEntitlements = false;
+ private int queryThresholdInSecs = DEFAULT_QUERY_THRESHOLD;
@ManagementProperty(description="Process pool maximum thread count. (default 16)
Increase this value if your load includes a large number of XQueries or if the
system's available processors is larger than 8")
public int getMaxThreads() {
@@ -161,5 +163,14 @@
public void setUseEntitlements(Boolean useEntitlements) {
this.useEntitlements = useEntitlements.booleanValue();
+ }
+
+ @ManagementProperty(description="Long running query threshold, after which a alert
can be generated by tooling if configured")
+ public int getQueryThresholdInSecs() {
+ return queryThresholdInSecs;
+ }
+
+ public void setQueryThresholdInSecs(int queryThresholdInSecs) {
+ this.queryThresholdInSecs = queryThresholdInSecs;
}
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-05-22
21:57:32 UTC (rev 2149)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-05-24
16:41:41 UTC (rev 2150)
@@ -173,6 +173,7 @@
private int maxCodeRecords = DQPConfiguration.DEFAULT_MAX_CODE_RECORDS;
private int maxFetchSize = DQPConfiguration.DEFAULT_FETCH_SIZE;
+ private int queryThreshold = DQPConfiguration.DEFAULT_QUERY_THRESHOLD;
// Resources
private BufferManager bufferManager;
@@ -214,7 +215,7 @@
if (state == null) {
return Collections.emptyList();
}
- return buildRequestInfos(state.getRequests());
+ return buildRequestInfos(state.getRequests(), -1);
}
public ClientState getClientState(String key, boolean create) {
@@ -232,10 +233,14 @@
* Return a list of all {@link RequestMetadata}
*/
public List<RequestMetadata> getRequests() {
- return buildRequestInfos(requests.keySet());
+ return buildRequestInfos(requests.keySet(), -1);
}
+
+ public List<RequestMetadata> getLongRunningRequests(){
+ return buildRequestInfos(requests.keySet(), this.queryThreshold);
+ }
- private List<RequestMetadata> buildRequestInfos(Collection<RequestID>
ids) {
+ private List<RequestMetadata> buildRequestInfos(Collection<RequestID>
ids, int longRunningQueryThreshold) {
List<RequestMetadata> results = new ArrayList<RequestMetadata>();
for (RequestID requestID : ids) {
@@ -291,7 +296,12 @@
info.setState(conInfo.isCanceled()?ProcessingState.CANCELED:conInfo.isDone()?ProcessingState.DONE:ProcessingState.PROCESSING);
results.add(info);
}
- results.add(req);
+
+ // check if only need long running queries.
+ long elapsedTime = System.currentTimeMillis() - req.getStartTime();
+ if (longRunningQueryThreshold == -1 || elapsedTime >
longRunningQueryThreshold) {
+ results.add(req);
+ }
}
}
return results;
@@ -624,6 +634,7 @@
this.maxCodeTables = config.getCodeTablesMaxCount();
this.maxCodeRecords = config.getCodeTablesMaxRows();
this.useEntitlements = config.useEntitlements();
+ this.queryThreshold = config.getQueryThresholdInSecs();
this.chunkSize = config.getLobChunkSizeInKB() * 1024;
Modified:
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
---
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-05-22
21:57:32 UTC (rev 2149)
+++
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-05-24
16:41:41 UTC (rev 2150)
@@ -247,6 +247,13 @@
}
@Override
+ @ManagementOperation(description="Long running requests",
impact=Impact.ReadOnly)
+ public List<RequestMetadata> getLongRunningRequests() {
+ return this.dqpCore.getLongRunningRequests();
+ }
+
+
+ @Override
@ManagementOperation(description="Get Runtime workmanager statistics",
impact=Impact.ReadOnly,params={@ManagementParameter(name="identifier",description="Use
\"runtime\" for engine, or connector name for connector")})
public WorkerPoolStatisticsMetadata getWorkManagerStatistics(String identifier) {
if ("runtime".equalsIgnoreCase(identifier)) { //$NON-NLS-1$
Show replies by date