<?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>Just a Few Lines &#187; misc</title>
	<atom:link href="http://justafewlines.com/tag/misc/feed/" rel="self" type="application/rss+xml" />
	<link>http://justafewlines.com</link>
	<description>That&#039;s all it takes, usually...</description>
	<lastBuildDate>Tue, 13 Jul 2010 23:28:46 +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>RAM disks for fun and profit</title>
		<link>http://justafewlines.com/2009/10/ram-disks-for-fun-and-profit/</link>
		<comments>http://justafewlines.com/2009/10/ram-disks-for-fun-and-profit/#comments</comments>
		<pubDate>Fri, 16 Oct 2009 21:40:44 +0000</pubDate>
		<dc:creator>Pawel</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[misc]]></category>

		<guid isPermaLink="false">http://justafewlines.com/?p=211</guid>
		<description><![CDATA[Some time ago I was digging through my very old files, back from Windows 9x days. One of the interesting things was a note I wrote to myself, explaining how to setup a RAM disk. While glancing through it an idea struck me &#8211; &#8220;can I use it for Tomcat and other Java stuff?&#8221;. It [...]]]></description>
			<content:encoded><![CDATA[<p>Some time ago I was digging through my very old files, back from Windows 9x days. One of the interesting things was a note I wrote to myself, explaining how to setup a RAM disk. While glancing through it an idea struck me &#8211; &#8220;can I use it for Tomcat and other Java stuff?&#8221;. </p>
<p>It turns out, I can. If you don&#8217;t feel like reading the whole story, here&#8217;s the bottom line: use RAM disk for everything Java &#8211; it&#8217;s WAY faster than HDD. For more details, read on.<span id="more-211"></span></p>
<h3>What is a RAM disk?</h3>
<p><a href="http://en.wikipedia.org/wiki/RAM_disk">Wikipedia</a> explains it quite well. Simply put, it&#8217;s a block of RAM memory that operating system treats as a regular hard drive. Two main differences between a RAM disk and hard disk are speed (RAM is *MUCH* faster than HDD) and data volatility (all data on RAM disk is lost when you unplug power or simply restart you computer).</p>
<h3>How do I use it</h3>
<p>My PC has only 3GB of RAM installed, so I can&#8217;t keep everything in RAM. To give the whole idea a shot, I decided to put all Java-related things (Netbeans, JRE, Scala run-time, Tomcat etc.) on RAM disk. The results are *amazing*. Netbeans starts much, much faster. I use nightly builds, so I upgrade and restart the IDE often &#8211; that&#8217;s also super fast. As for Tomcat or JBoss startup/deployment times, well, you just need to see it yourself :)</p>
<p>In short, here&#8217;s how I use it:</p>
<ul>
<li>I keep Netbeans, JDK and other binaries stored on a HDD, RAR&#8217;ed with compression level 0 (for speed)</li>
<li>I also keep Netbeans settings directory stored separately, in a similar fashion</li>
<li>A batch file in my autostart that creates all a RAM disk, and extracts the abovementioned archives to the RAM disk</li>
<li>I execute another batch file that whenever I change somehting in my Netbeans config. This batch backs up the new configuration to HDD</li>
</ul>
<p>I don&#8217;t keep any source code on RAM disk, but I might start doing it after I test the whole idea for a little longer.</p>
<p>As you can see, there is some maintenance overhead, but IMHO it&#8217;s well worth it. Besides, one could use simpler scenario, supported by the RAM disk tool I use:</p>
<ul>
<li>After system startup, create RAM disk and load an image file</li>
<li>Before system shutdown, save RAM disk data to an image file</li>
</ul>
<p>I stick with archives juggling for testing purposes, but I&#8217;ll probably switch to the simpler scenario eventually.</p>
<p>I didn&#8217;t really benchmark it, but the experience I&#8217;m getting every time I do anything that requires any disk operations is very pleasing.</p>
<h3>The tool</h3>
<p>I use ImDisk Virtual Disk Driver, written by <a href="http://www.ltr-data.se">Olof Lagerkvist<a/>. You can download it <a href="http://www.ltr-data.se/files/imdiskinst.exe">here</a> (it&#8217;s free and open-source). I tried it under Windows XP SP3 and Windows 7, both 32 bit. Author claims that it works on 64 bit systems, but I didn&#8217;t have a chance to verify it yet.</p>
<h3>In conclusion</h3>
<p>I&#8217;ve been using the solution described above for couple weeks, and so far I haven&#8217;t encountered any problems. The only price I pay for this is longer system start-up time, but I don&#8217;t really restart my PC, so it doesn&#8217;t matter if it boots 20 seconds longer while I&#8217;m making my morning coffee.</p>
<p>So, if you do Java development, especially Java server-side stuff, I strongly encourage you to give RAM disks a try. I&#8217;ll say it again &#8211; the speed gain is AMAZING :)</p>
<p>P.S. I discovered one nice side effect of the above usage scenario. Like I mentioned, I use nightly builds of different software packages, and sometimes it causes problems. For example, every now and then Netbeans doesn&#8217;t run properly after update. Earlier, in such case, I&#8217;d simply reinstall the thing. Now I just clean up the RAM disk and restore everything from backup, which takes couple seconds (literally).</p>
<p><script type="text/javascript">var dzone_url = 'http://justafewlines.com/2009/10/ram-disks-for-fun-and-profit/';</script><br />
<script type="text/javascript">var dzone_style = '2';</script><br />
<script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script> </p>
]]></content:encoded>
			<wfw:commentRss>http://justafewlines.com/2009/10/ram-disks-for-fun-and-profit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
