<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Great Tasting Java &#187; Performance</title>
	<atom:link href="http://www.greattastingjava.com/wordpress/index.php/category/performance/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.greattastingjava.com/wordpress</link>
	<description>Headley Williamson's Java code, answers, tutorials, and courses</description>
	<lastBuildDate>Wed, 21 Jul 2010 17:15:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>ATG Dynamo DRP Hung threads solution</title>
		<link>http://www.greattastingjava.com/wordpress/index.php/2007/06/19/atg-dynamo-drp-hung-threads-solution/</link>
		<comments>http://www.greattastingjava.com/wordpress/index.php/2007/06/19/atg-dynamo-drp-hung-threads-solution/#comments</comments>
		<pubDate>Tue, 19 Jun 2007 14:44:17 +0000</pubDate>
		<dc:creator>hwilliamson</dc:creator>
				<category><![CDATA[Code Examples]]></category>
		<category><![CDATA[J2EE]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Servlets]]></category>

		<guid isPermaLink="false">http://www.greattastingjava.com/wordpress/2007/06/19/atg-dynamo-drp-hung-threads-solution/</guid>
		<description><![CDATA[What is a DRP Thread?
DRP stands for Distribution and Replication Protocol.  It is the protocol for communication between an HTTP server (Web server) and an application Server (ATG). When a user clicks on a link or summits a form in his/her web browser, that information or the “request” is sent to a webserver. The [...]]]></description>
			<content:encoded><![CDATA[<p>What is a DRP Thread?<br />
DRP stands for Distribution and Replication Protocol.  It is the protocol for communication between an HTTP server (Web server) and an application Server (ATG). When a user clicks on a link or summits a form in his/her web browser, that information or the “request” is sent to a webserver. The webserver examines the request and determines if it needs to pass on the request to the application server. If it does need to pass the request, it uses the DRP protocol to send the message. Inside the application server when it receives a request, it starts a DRP thread to handle the request. That thread performs the necessary actions, and returns the response to the webserver, which then returns the response to the user’s browser.</p>
<p>Why do they get Hung?<br />
The main reason the threads hang is because it can not finish the request in a timely manner. If your data needs continuously updating, some of queries loose efficiency because their execution paths over time need to be re-analyzed. Over the last couple years we have seen this in several of our queries. </p>
<p>Since we have a set number of available DRP threads (40 in our case), when they are all hanging, the application server is no longer able to serve requests. </p>
<p>This problem is an Enterprise problem. This means all ATG applications run into this problem, if the queries don’t return.</p>
<p>The solution to the problem.</p>
<p>Overview<br />
The solution is to first monitor and identify DRP hung threads, send email regarding their hung status, and then kill them before they can do damage. This solution requires a monitor running inside the application server that will periodically take an inventory of the running DRP threads. When a thread age reaches a predetermined threshold, it will be terminated, and information about the terminated thread will be sent to a predetermined email for evaluation.</p>
<p>The following are the control inputs for the DRPThread Monitor stored in a property file. The property file is loaded upon startup.</p>
<p>This tells the monitor to auto-start.<br />
threadMonitorAutoStart = true</p>
<p>This is how often it checks the DRP threads<br />
threadMonitorWaitInterval = 5000</p>
<p>This is percent of DRP threads in use before checking threshold<br />
threadMonitorThreshold= 80</p>
<p>This is the Age limit of threads. When the age limit is surpassed<br />
thresholdAgeLimit = 300000</p>
<p>This is the max age of any thread. A thread over this age is killed<br />
maxThreadAge= 1800000</p>
<p>List of email address sent notifications when a DRP thread is killed<br />
emailNotificationList = hwilliamson@greattastingjava.com</p>
<p>Pseudo Code </p>
<p>1.	Application server starts up<br />
2.	Starts DRP Monitor</p>
<p>a.	If threadMonitorAutoStart = true, then monitor continues to start up, else it stops.<br />
b.	Loop until forced stop</p>
<ul>
i.	Check DRP server<br />
1.	percent active thread > threadMonitorThreshold &#038;&#038; age of thread > thresholdAgeLimit) || age of thread > maxThreadAge  then<br />
a.	Email info about hung thread<br />
b.	Kill thread<br />
ii.	Sleep threadMonitorWaitInterval
</ul>
<p>Code Sample</p>
<p>		while (!forcedStop) {</p>
<p>			try {</p>
<p>				RequestServerHandler handlers[] = drpServer.getRequestHandlers();</p>
<p>				int activeCount = drpServer.getActiveHandlerCount();</p>
<p>				double percentActive = (activeCount/handlers.length) *100.0;</p>
<p>				for (int i = 0; i < handlers.length; i++) {</p>
<p>					if (handlers[i] instanceof DrpServerConnection) {</p>
<p>						DrpServerConnection connection = (DrpServerConnection) handlers[i];<br />
						if (connection.getHandlingRequest()) {</p>
<p>							if ((percentActive> threadMonitorThreshold &#038;&#038; connection.getCurrentRequestTime() > thresholdAgeLimit) ||connection.getCurrentRequestTime() > maxThreadAge)<br />
							{<br />
								logger.debug(&#8221;killing:&#8221; + connection);</p>
<p>								String path = connection.getCurrentRequestPathInfo();<br />
								long time = connection.getCurrentRequestTime();</p>
<p>								connection.killHandler();</p>
<p>								Mail mail = new Mail();<br />
								mail.postMail(emailNotificationList,&#8221;DRP Thread Killed&#8221;, &#8220;Path:&#8221; +path +&#8221;\n&#8221;<br />
																							+&#8221;Time:&#8221; +time+&#8221;\n&#8221;,&#8221;hwilliamson@greattastingjava.com&#8221;);<br />
								logger.debug(&#8221;emailing:&#8221; + emailNotificationList);</p>
<p>							}<br />
						}<br />
					}<br />
				}<br />
				sleepDRPThreadMonitor();<br />
			} catch (Exception ex)<br />
			{<br />
				ex.printStackTrace();<br />
			}<br />
		}</p>
]]></content:encoded>
			<wfw:commentRss>http://www.greattastingjava.com/wordpress/index.php/2007/06/19/atg-dynamo-drp-hung-threads-solution/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Example Code:HWThreadedHash (Multithreaded Hashtable), a Multithreaded hash table will improve your applications performance</title>
		<link>http://www.greattastingjava.com/wordpress/index.php/2005/12/30/example-codehwthreadedhash-multithreaded-hashtable-a-multithreaded-hash-table-will-improve-your-applications-performance/</link>
		<comments>http://www.greattastingjava.com/wordpress/index.php/2005/12/30/example-codehwthreadedhash-multithreaded-hashtable-a-multithreaded-hash-table-will-improve-your-applications-performance/#comments</comments>
		<pubDate>Sat, 31 Dec 2005 00:05:05 +0000</pubDate>
		<dc:creator>hwilliamson</dc:creator>
				<category><![CDATA[Code Examples]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[multithreading]]></category>

		<guid isPermaLink="false">http://www.greattastingjava.com/wordpress/2005/12/30/example-codehwthreadedhash-multithreaded-hashtable-a-multithreaded-hash-table-will-improve-your-applications-performance/</guid>
		<description><![CDATA[Photo: Don
I have written a multithreaded hash table framework.  You can put multiple tasks to do work for you with a simple “put” with a key,Then when it completes you can do a “get” to return the data worked on. The “get” will block until that requested thread is finished working.

The best way to [...]]]></description>
			<content:encoded><![CDATA[<div class="flickr-illustrate" style="border: solid black 2px;padding: 3px;float:right;display: inline;font-family: Arial,Helvetica;font-style: italic;font-size: .75em;text-align: center;padding-left:5px;padding-right:3px;padding-top:5px;margin:8px;"><a href="http://www.flickr.com/photos/98027690@N00/4931077"><img src="http://static.flickr.com/3/4931077_4a4db873f9_m.jpg" style="border: solid black 1px;padding: 0px;margin: 0px;" border="0"/></a><a class="f-i-attribution" style="text-decoration: none;color:black;display:block;font-weight:bold;text-align:right;" href="http://www.flickr.com/people/dwstucke/">Photo: Don</a></div>
<p>I have written a multithreaded hash table framework.  You can put multiple tasks to do work for you with a simple “put” with a key,Then when it completes you can do a “get” to return the data worked on. The “get” will block until that requested thread is finished working.<br />
<span id="more-9"></span><br />
The best way to use this is to first “put” all the work that you need to get done. Then after you can start doing a “get” on what ever data is needed.</p>
<p>I have used this framework to reduce a 6 minute batch process  down to 13 seconds.By slicing up the work to do the data gathering first (puts) , and then data assembly second(gets).</p>
<p>Of course The slowest slice is the fastest your program is going to run.<br />
 Good luck&#8230;</p>
<p><a href="http://www.greattastingjava.com/downloads/HWThreadedHash.java">HWThreadedHash.java</a><br />
<a href="http://www.greattastingjava.com/downloads/HWThread.java">HWThread.java</a><br />
<a href="http://www.greattastingjava.com/downloads/HWThreadedHashExample.java">HWThreadedHashExample.java</a></p>
<p><tags><br />
threads,multithread,performance,hashtable,hash, Java, programming, software, examples<br />
</tags></p>
]]></content:encoded>
			<wfw:commentRss>http://www.greattastingjava.com/wordpress/index.php/2005/12/30/example-codehwthreadedhash-multithreaded-hashtable-a-multithreaded-hash-table-will-improve-your-applications-performance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Message Beans: Container Vs. Bean Managed Transactions, XA Transaction problem</title>
		<link>http://www.greattastingjava.com/wordpress/index.php/2005/12/27/message-beans-container-vs-bean-managed-transactions-xa-transaction-problem/</link>
		<comments>http://www.greattastingjava.com/wordpress/index.php/2005/12/27/message-beans-container-vs-bean-managed-transactions-xa-transaction-problem/#comments</comments>
		<pubDate>Wed, 28 Dec 2005 00:20:21 +0000</pubDate>
		<dc:creator>hwilliamson</dc:creator>
				<category><![CDATA[J2EE]]></category>
		<category><![CDATA[Performance]]></category>

		<guid isPermaLink="false">http://www.greattastingjava.com/wordpress/2005/12/27/message-beans-container-vs-bean-managed-transactions-xa-transaction-problem/</guid>
		<description><![CDATA[I recently tried to get a container managed transaction message bean to read from a MQ queue then read from an oracle database.   I got an error indicating that I did not have XA Transactions turned on in my MQ queue. Then I dug a little deeper….

This is what I found:
Bean Managed Transaction [...]]]></description>
			<content:encoded><![CDATA[<p>I recently tried to get a container managed transaction message bean to read from a MQ queue then read from an oracle database.   I got an error indicating that I did not have XA Transactions turned on in my MQ queue. Then I dug a little deeper….<br />
<span id="more-7"></span></p>
<p>This is what I found:</p>
<p>Bean Managed Transaction in Message Beans:<br />
•	Single threaded if more than one data source was used.</p>
<p>Container Managed Transaction in Message Beans:<br />
•	Multi threaded even if more than one data source was used, but slower due to XA Transactions. </p>
<p>The solution I found:<br />
Use Container Management Transactions, but use a stateless session bean with bean managed transactions to access your second data source.</p>
<p><tags><br />
Message Beans, Java, MQ, Transactions<br />
</tags></p>
]]></content:encoded>
			<wfw:commentRss>http://www.greattastingjava.com/wordpress/index.php/2005/12/27/message-beans-container-vs-bean-managed-transactions-xa-transaction-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configuring Optimizeit 6.0 to work with Dynamo 6.4</title>
		<link>http://www.greattastingjava.com/wordpress/index.php/2005/12/16/configuring-optimizeit-60-to-work-with-dynamo-64/</link>
		<comments>http://www.greattastingjava.com/wordpress/index.php/2005/12/16/configuring-optimizeit-60-to-work-with-dynamo-64/#comments</comments>
		<pubDate>Fri, 16 Dec 2005 22:32:20 +0000</pubDate>
		<dc:creator>hwilliamson</dc:creator>
				<category><![CDATA[Performance]]></category>

		<guid isPermaLink="false">http://www.greattastingjava.com/wordpress/2005/12/16/configuring-optimizeit-60-to-work-with-dynamo-64/</guid>
		<description><![CDATA[I wanted to profile an ATG Dynamo 6.4 app, so I down loaded a 10 day trial version of Optimizeit 6.0, but it only came with instructions for configuring ATG Dynamo 4.5.
So here are the instructions for configuring Optimizeit with ATG Dynamo 6.4

1. When Optimizeit first starts it will ask you for the path to [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to profile an ATG Dynamo 6.4 app, so I down loaded a 10 day trial version of Optimizeit 6.0, but it only came with instructions for configuring ATG Dynamo 4.5.</p>
<p>So here are the instructions for configuring Optimizeit with ATG Dynamo 6.4<br />
<span id="more-6"></span><br />
1. When Optimizeit first starts it will ask you for the path to the JVM you want to use. I set it to the Dynamo jvm C:\ATG\DAS6.3.0\DAS\os_specific_files\i486-unknown-win32\jre\bin\java.exe</p>
<p>2. In my C:\ATG\ATG6.4.0\home\localconfig I edited the PostEnvironment.bat file added/edited the following lines:</p>
<table width="100" border="1" class="ex" cellspacing="0">
<tr>
<td>
<pre>
set OPTIT_HOME=C:\\Optimizeit\\OptimizeitEntSuite60
set CLASSPATH=%OPTIT_HOME%\lib\optit.jar;
%OPTIT_HOME%\\lib\\flexlm.jar;%CLASSPATH%
set PATH=%PATH%;%OPTIT_HOME%\\lib;
SET JAVAPARAMETERS=%JAVAPARAMETERS% -Xrunpri:directi=f
-Xnoclassgc -Djava.compiler=NONE -Xbootclasspath/a:
"%OPTIT_HOME%\\lib\\oibcp.jar"
set JAVA_ARGS=%JAVA_ARGS% %JAVAPARAMETERS%
</pre>
</td>
</tr>
</table>
<p>3. Then I made the following chang to In my C:\ATG\ATG6.4.0\home\bin\startDynamo.bat</p>
<table width="100" border="1" class="ex" cellspacing="0">
<tr>
<td>
<pre>
%JAVA_VM% %JAVA_ARGS% %SECURITY_ARGS%
%DYN_EXTRA_ARGS% intuitive.audit.GenericAudit
atg.applauncher.dynamo.DynamoServerLauncher
%DYNAMO_MODULES% %CONFIGPATH% -shellrestart %LOGARGUMENT%
</pre>
</td>
</tr>
</table>
<p>Technorati Tags: <a href="http://technorati.com/tag/Java" rel="tag">Java</a>, <a href="http://technorati.com/tag/ATG" rel="tag"> ATG</a>, <a href="http://technorati.com/tag/Dynamo" rel="tag"> Dynamo</a>, <a href="http://technorati.com/tag/Dynamo+6.4" rel="tag"> Dynamo 6.4</a>, <a href="http://technorati.com/tag/Optimizeit+6.0" rel="tag"> Optimizeit 6.0</a>, <a href="http://technorati.com/tag/Optimizeit" rel="tag"> Optimizeit </a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.greattastingjava.com/wordpress/index.php/2005/12/16/configuring-optimizeit-60-to-work-with-dynamo-64/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MQ 5.3 performance testing with Message Beans and Websphere 6.0</title>
		<link>http://www.greattastingjava.com/wordpress/index.php/2005/12/15/mq-53-performance-testing-with-message-beans-and-websphere-60/</link>
		<comments>http://www.greattastingjava.com/wordpress/index.php/2005/12/15/mq-53-performance-testing-with-message-beans-and-websphere-60/#comments</comments>
		<pubDate>Thu, 15 Dec 2005 23:14:32 +0000</pubDate>
		<dc:creator>hwilliamson</dc:creator>
				<category><![CDATA[J2EE]]></category>
		<category><![CDATA[Performance]]></category>

		<guid isPermaLink="false">http://www.greattastingjava.com/wordpress/2005/12/15/mq-53-performance-testing-with-message-beans-and-websphere-60/</guid>
		<description><![CDATA[Earlier in the week I did some testing of MQ with message beans.
This is what I got.
10,000 very small   messages of 10 bytes going through 1 queue with persistence turned on takes about  37 seconds.
10,000 large messages of 10,000  bytes through 1 queue with persistence turned on takes about 90  [...]]]></description>
			<content:encoded><![CDATA[<div>Earlier in the week I did some testing of MQ with message beans.</div>
<div>This is what I got.</div>
<div><span class="263461620-12122005">10,000 very small   messages of 10 bytes going through 1 queue with persistence turned on takes about  37 seconds.</span></div>
<div><span class="263461620-12122005">10,000 large messages of 10,000  bytes through 1 queue with persistence turned on takes about 90  seconds</span></div>
<p>Technorati Tags: <a href="http://technorati.com/tag/Java" rel="tag">Java</a>, <a href="http://technorati.com/tag/ATG" rel="tag">ATG</a>, <a href="http://technorati.com/tag/Performance" rel="tag"> Performance</a>, <a href="http://technorati.com/tag/Optimizeit" rel="tag"> Optimizeit </a>, <a href="http://technorati.com/tag/Dynamo" rel="tag"> Dynamo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.greattastingjava.com/wordpress/index.php/2005/12/15/mq-53-performance-testing-with-message-beans-and-websphere-60/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
