<?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>What I Learned Today &#187; performance</title>
	<atom:link href="http://christiansons.net/mike/blog/tag/performance/feed/" rel="self" type="application/rss+xml" />
	<link>http://christiansons.net/mike/blog</link>
	<description>Mike Christianson&#039;s journal of Java, Ant, SVN, Jetty, cygwin and other stuff.</description>
	<lastBuildDate>Wed, 04 Aug 2010 22:24:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Java garbage collection logging</title>
		<link>http://christiansons.net/mike/blog/2008/12/java-garbage-collection-logging/</link>
		<comments>http://christiansons.net/mike/blog/2008/12/java-garbage-collection-logging/#comments</comments>
		<pubDate>Thu, 11 Dec 2008 08:00:56 +0000</pubDate>
		<dc:creator>Mike Christianson</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[garbagecollection]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://blog.christiansons.net/?p=28</guid>
		<description><![CDATA[Java&#8217;s built-in garbage collection logging provides a quick, easy, and free way to profile or troubleshoot your Java application.  It can help you understand your application in terms of: memory usage (object count and size) heap size (initial and over time) GC metrics (frequency, pause time, and amount freed) So, now you can answer questions [...]]]></description>
			<content:encoded><![CDATA[<p>Java&#8217;s built-in garbage collection logging provides a quick, easy, and <em>free</em> way to profile or troubleshoot your Java application.  It can help you understand your application in terms of:</p>
<ul>
<li> memory usage (object count and size)</li>
<li>heap size (initial and over time)</li>
<li>GC metrics (frequency, pause time, and amount freed)</li>
</ul>
<p>So, now you can answer questions like &#8220;how much memory is my app using,&#8221; &#8220;how much time is being spent doing garbage collection,&#8221; and &#8220;how big is the heap over time.&#8221;</p>
<p style="border: thin dashed;">
<em>For help analyzing and visualizing a GC log file, be sure to check out <a href="http://christiansons.net/mike/blog/2009/01/gcviewer-garbage-collection-and-heap-analysis/">GCViewer, a garbage collection and heap analysis tool</a>.</em>
</p>
<p>GC logging is enabled using JVM arguments; below are the arguments I use.  <span id="more-28"></span>(Note: the log file specified as <em>file</em> is reset each time the VM starts.)</p>
<p><code>-verbose:gc -Xloggc:<em>file</em></code></p>
<p>Here&#8217;s an example GC log file which shows three GC events including one full GC.</p>
<pre>[GC 19062K-&gt;7172K(60800K), 0.0087190 secs]
[GC 9346K-&gt;7525K(60800K), 0.0052810 secs]
[Full GC 7525K-&gt;7477K(60800K), 0.0615190 secs]</pre>
<p>In the first event, garbage collection takes just under nine thousandths of a second to collect 11,890K memory used by objects (19,062K to 7,172K) while the heap is 60,800K.  The last event is a full GC lasting just over six hundredths of a second to free up 48K with no change in the heap.</p>
<p>Data like this can be invaluable in saving one&#8217;s sanity or ending arguments! For further details on garbage collection, see Sun&#8217;s <a title="article on GC Portal" href="http://java.sun.com/developer/technicalArticles/Programming/GCPortal/">GC Portal</a> and <a title="doc on GC tuning" href="http://java.sun.com/javase/technologies/hotspot/gc/gc_tuning_6.html">Virtual Machine Garbage Collection Tuning</a> documentation.</p>
]]></content:encoded>
			<wfw:commentRss>http://christiansons.net/mike/blog/2008/12/java-garbage-collection-logging/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
