<?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>Postcards from Utopia &#187; admin</title>
	<atom:link href="http://blog.vergiss-blackjack.de/category/admin/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.vergiss-blackjack.de</link>
	<description></description>
	<lastBuildDate>Wed, 08 Feb 2012 23:00:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
		<item>
		<title>Run PostgreSQL in a ram disk</title>
		<link>http://blog.vergiss-blackjack.de/2011/02/run-postgresql-in-a-ram-disk/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=run-postgresql-in-a-ram-disk</link>
		<comments>http://blog.vergiss-blackjack.de/2011/02/run-postgresql-in-a-ram-disk/#comments</comments>
		<pubDate>Mon, 21 Feb 2011 11:29:56 +0000</pubDate>
		<dc:creator>georg</dc:creator>
				<category><![CDATA[admin]]></category>
		<category><![CDATA[administration]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[test]]></category>

		<guid isPermaLink="false">http://blog.vergiss-blackjack.de/?p=141</guid>
		<description><![CDATA[At a a project I am heavily relying on PostgreSQL in the unit tests. This works fine but creating and dropping databases takes quite a while which goes against the purpose of unit tests. One simple solution to this is to run PostgreSQL in a RAM disk which will make IO-heavy operations  a ...]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.vergiss-blackjack.de%2F2011%2F02%2Frun-postgresql-in-a-ram-disk%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.vergiss-blackjack.de%2F2011%2F02%2Frun-postgresql-in-a-ram-disk%2F&amp;source=piefke_schorsch&amp;style=normal&amp;service=bit.ly&amp;hashtags=administration,database,postgresql,tdd,test&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>At a a project I am heavily relying on PostgreSQL in the unit tests. This works fine but creating and dropping databases takes quite a while which goes against the purpose of unit tests. One simple solution to this is to run PostgreSQL in a RAM disk which will make IO-heavy operations  a snap.</p>
<p><span id="more-141"></span></p>
<h2>Setup</h2>
<p>The way I suggest works simply by</p>
<ol>
<li>Creating a RAM disk</li>
<li>Copying the contents of the PostgreSQL directory to the RAM disk</li>
<li>Mounting the RAM disk over the PostgreSQL directory</li>
</ol>
<p>This has the clear drawback that there is no write-back of any changed data. However, as I need the data only during testing this is acceptable.</p>
<h2>Alternatives</h2>
<p>Unfortunately PostgreSQL does not support RAM-based tables otherwise this would be a much cleaner solution. Another solution would be to create a new cluster directly in the RAM disk (using <code>pg_createcluster</code>). The drawback with this method is that the configuration and possibly already existing DB structures are not preserved.</p>
<h2>Mount script</h2>
<p>This was hacked together in a few minutes but &#8220;it works for me&#8221;™ using Ubuntu 10.10.</p>
<pre>sudo /etc/init.d/postgresql stop
TMPDIR=/tmp/tmpfs; # the actual mount point for the tmpfs
MOUNTPOINT=/var/lib/postgresql/;
[ -d $TMPDIR ] || mkdir $TMPDIR;
sudo mount -t tmpfs -o size=512M,nr_inodes=10k,mode=0777 tmpfs $TMPDIR;
sudo rsync --archive $MOUNTPOINT/ $TMPDIR/;
sudo mount -o bind $TMPDIR $MOUNTPOINT;
sudo /etc/init.d/postgresql start</pre>
<p class="wp-flattr-button"></p> <p><a href="http://blog.vergiss-blackjack.de/?flattrss_redirect&amp;id=141&amp;md5=45cc34b33f18879031d8d205d8128d95" title="Flattr" target="_blank"><img src="http://blog.vergiss-blackjack.de/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.vergiss-blackjack.de/2011/02/run-postgresql-in-a-ram-disk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nagios Plugin to check memory consumption</title>
		<link>http://blog.vergiss-blackjack.de/2010/04/nagios-plugin-to-check-memory-consumption/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nagios-plugin-to-check-memory-consumption</link>
		<comments>http://blog.vergiss-blackjack.de/2010/04/nagios-plugin-to-check-memory-consumption/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 23:38:39 +0000</pubDate>
		<dc:creator>georg</dc:creator>
				<category><![CDATA[admin]]></category>
		<category><![CDATA[administration]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[nagios]]></category>

		<guid isPermaLink="false">http://blog.vergiss-blackjack.de/?p=63</guid>
		<description><![CDATA[For some reason the Nagios package in Debian / Ubuntu does not provide a plugin to check the memory consumption so I built a simple script to do that. It ignores swap space (since if your machine starts swapping you're lost anyway) and caches (it's nice to have memory available for caches but this ...]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.vergiss-blackjack.de%2F2010%2F04%2Fnagios-plugin-to-check-memory-consumption%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.vergiss-blackjack.de%2F2010%2F04%2Fnagios-plugin-to-check-memory-consumption%2F&amp;source=piefke_schorsch&amp;style=normal&amp;service=bit.ly&amp;hashtags=administration,monitoring,nagios&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>For some reason the Nagios package in Debian / Ubuntu does not provide a plugin to check the memory consumption so I built a simple script to do that. It ignores swap space (since if your machine starts swapping you&#8217;re lost anyway) and caches (it&#8217;s nice to have memory available for caches but this isn&#8217;t really required). That way only the real memory consumption is checked and if that passes a certain threshold you can rest assured that you&#8217;re in for trouble.</p>
<p><span id="more-63"></span>Get the file here: <a href="http://blog.vergiss-blackjack.de/wp-uploads/2010/04/check_memory.txt">check_memory</a> (it&#8217;s got an .txt ending due to WordPress restrictions; rename to .sh or just remove the ending altogether).</p>
<p>The default warning and critical thresholds are triggered when more than 90% / 95% of the memory are in use. You can change these thresholds by passing in the well known -w and -c arguments.</p>
<p>The plugin was developed in cooperation with <a href="http://findologic.com" target="_blank">FINDOLOGIC GmbH</a>.</p>
<p class="wp-flattr-button"></p> <p><a href="http://blog.vergiss-blackjack.de/?flattrss_redirect&amp;id=63&amp;md5=5ef8be77de0a619da20837213f264cea" title="Flattr" target="_blank"><img src="http://blog.vergiss-blackjack.de/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.vergiss-blackjack.de/2010/04/nagios-plugin-to-check-memory-consumption/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
