<?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>JJB Blog &#187; disk</title>
	<atom:link href="http://blog.johnjosephbachir.org/tag/disk/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.johnjosephbachir.org</link>
	<description></description>
	<lastBuildDate>Wed, 04 Jan 2012 05:47:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>How to use a RAM / memory disk for MySQL in Rails</title>
		<link>http://blog.johnjosephbachir.org/2007/09/29/how-to-use-a-ram-memory-disk-for-mysql-in-rails/</link>
		<comments>http://blog.johnjosephbachir.org/2007/09/29/how-to-use-a-ram-memory-disk-for-mysql-in-rails/#comments</comments>
		<pubDate>Sat, 29 Sep 2007 20:53:45 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[disk]]></category>
		<category><![CDATA[functional]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[memorydisk]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ram]]></category>
		<category><![CDATA[ramdisk]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubyonrails]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[tests]]></category>
		<category><![CDATA[unit]]></category>
		<category><![CDATA[unittests]]></category>

		<guid isPermaLink="false">http://blog.johnjosephbachir.org/2007/09/29/how-to-use-a-ram-memory-disk-for-mysql-in-rails/</guid>
		<description><![CDATA[I wanted to use a RAM disk for my MySQL data files when running my tests for a Rails project. I succeeded, but it only cut 2 seconds off of my ~30 second test suite for my functional tests, and didn&#8217;t cut any time off of my unit tests. But nevertheless, here is how I [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to use a RAM disk for my MySQL data files when running my tests for a Rails project. I succeeded, but it only cut 2 seconds off of my ~30 second test suite for my functional tests, and didn&#8217;t cut any time off of my unit tests. But nevertheless, here is how I achieved this, in case it is useful to others. All of this is on OS X, using MySQL 5 from Macports.</p>
<p>What we are doing is creating a RAM disk, and then creating a seperate MySQL instance that stores its data on that RAM disk.</p>
<p>[bash]<br />
# Create the RAM disk<br />
hdid -nomount ram://52428800<br />
newfs_hfs /dev/disk1<br />
mkdir /tmp/ramdisk1<br />
mount -t hfs /dev/disk1 /tmp/ramdisk1</p>
<p># Initialize the MySQL environment<br />
mysql_install_db5 &#8211;datadir=/tmp/ramdisk1</p>
<p># Start the MySQL server<br />
/opt/local/libexec/mysqld &#8211;basedir=/opt/local &#8211;datadir=/tmp/ramdisk1  &#8211;pid-file=/tmp/mysql_memory_localhost.pid &#8211;port=10000 &#8211;socket=/tmp/mysql_memory.sock</p>
<p># Create your test database<br />
mysqladmin5 &#8211;socket=/tmp/mysql_memory.sock -uroot create projectname_test<br />
[/bash]</p>
<p>Now in your <strong>database.yml</strong> file, add <code>socket: /tmp/mysql_memory.sock</code> to the test database configuration.</p>
<p>(thanks to <a href="http://osxdaily.com/2007/03/23/create-a-ram-disk-in-mac-os-x/">this tutorial</a> for how-to create a RAM disk in OS X)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.johnjosephbachir.org/2007/09/29/how-to-use-a-ram-memory-disk-for-mysql-in-rails/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

