<?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>williamhathaway.com &#187; opends</title>
	<atom:link href="http://www.williamhathaway.com/wordpress/tag/opends/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.williamhathaway.com/wordpress</link>
	<description></description>
	<lastBuildDate>Wed, 21 Jul 2010 03:10:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Creating a slow operation log for OpenDS</title>
		<link>http://www.williamhathaway.com/wordpress/2009/11/02/creating-a-slow-operation-log-for-opends/</link>
		<comments>http://www.williamhathaway.com/wordpress/2009/11/02/creating-a-slow-operation-log-for-opends/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 20:58:39 +0000</pubDate>
		<dc:creator>William Hathaway</dc:creator>
				<category><![CDATA[ldap]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[opends]]></category>

		<guid isPermaLink="false">http://www.williamhathaway.com/wordpress/?p=480</guid>
		<description><![CDATA[For anyone that has spent much time looking at MySQL performance, you will be familiar with the &#8216;slow query log&#8217;.  This basically is a log where queries that took over some amount of time would get recorded.   For kicks, I tried implementing a similar hook for OpenDS.  My current version is in pretty rough shape [...]]]></description>
			<content:encoded><![CDATA[<p>For anyone that has spent much time looking at MySQL performance, you will be familiar with the &#8216;slow query log&#8217;.  This basically is a log where queries that took over some amount of time would get recorded.   For kicks, I tried implementing a similar hook for <a href="http://www.opends.org/">OpenDS</a>.  My current version is in pretty rough shape (not very efficient or configurable), but seems to work.  I started from a copy of the TextAccessLogPublisher.java file and created a new one called TextSlowAccessLogPublisher.java.  My logic is basically:</p>
<ul>
<li>create a hash table</li>
<li>emptied out all the log XYZIntermediateMessage and connect/disconnect methods</li>
<li>when a request comes in, store the text to log in the hash table (keyed off connectionID and opNumber) instead of outputting it (changed the logSearchRequest, logModifyRequest, &#8230; methods)</li>
<li>when a request is finished processing, we check the elapsed time (etime)
<ul>
<li>if the elapsed time greater  than our or equal to our threshold
<ul>
<li>print the request info we stashed in the hash table and delete it</li>
<li>print the response info</li>
</ul>
</li>
<li>if the elapsed time is less than our threshold
<ul>
<li>delete the request info from the hash table, don&#8217;t print anything</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>There are a few more things I want to do:</p>
<ul>
<li>Make the &#8216;slow operation threshold time&#8217; dynamically changeable (looks like I will need to mess with configuration objects since I want to add an additional parameter not in the standard access log type)</li>
<li>Add extra information to the output format such as authorization DN (and potentially client connection info if not too hard to retrieve)</li>
<li>Instead of all the text formatting for every request, just put the Operation object into the hash table, since the majority of operations won&#8217;t ever get printed we shouldn&#8217;t burn CPU formatting them.  The operations would only be formatted to text if the operations end up being slow and printed.</li>
</ul>
<p><strong>Files</strong></p>
<ul>
<li><a href="http://williamhathaway.com/downloads/TextSlowAccessLogPublisher.java">TextSlowAccessLogPublisher.java</a> (currently quick-n-dirty quality)</li>
<li><a href="http://williamhathaway.com/downloads/activate_opends_slow_query_log.ldif">LDIF</a> to enable the slow query log</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.williamhathaway.com/wordpress/2009/11/02/creating-a-slow-operation-log-for-opends/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
