<?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>Aidan&#039;s blog</title>
	<atom:link href="http://confabulate.aidans-place.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://confabulate.aidans-place.com</link>
	<description>Confabulation, discombobulation and the occasional colloquy</description>
	<lastBuildDate>Mon, 15 Apr 2013 17:36:06 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Not such a small VPS now..</title>
		<link>http://confabulate.aidans-place.com/not-such-a-small-vps-now/</link>
		<comments>http://confabulate.aidans-place.com/not-such-a-small-vps-now/#comments</comments>
		<pubDate>Sat, 13 Apr 2013 18:27:59 +0000</pubDate>
		<dc:creator>Aidan Whiteley</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[JVM]]></category>
		<category><![CDATA[Linode]]></category>
		<category><![CDATA[memory]]></category>

		<guid isPermaLink="false">http://confabulate.aidans-place.com/?p=176</guid>
		<description><![CDATA[So having posted about optimising a small VPS to run a couple of JVMs, a MySQL instance and a bunch of PHP stuff, I go on holiday for a week. When I get back, my hosting company have wasted all&#8230; ]]></description>
				<content:encoded><![CDATA[<p>So having <a title="Small VPS" href="java-play-client-on-a-small-vps/">posted</a> about optimising a small VPS to run a couple of JVMs, a MySQL instance and a bunch of PHP stuff, I go on holiday for a week.</p>
<p>When I get back, my hosting company have wasted all my hard work! How have they done this &#8211; by offering me a free* upgrade from 512Mb of RAM to 1024Mb. I now have oodles of capacity meaning that</p>
<ul>
<li><span style="line-height: 13px;">my various websites zip along really rather speedily at the moment &#8211; there&#8217;s little to no current swap file usage</span></li>
<li>I&#8217;m going to have to spend time installing / writing more software to use the available capacity (assuming current traffic levels don&#8217;t suddenly change <img src='http://confabulate.aidans-place.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  )</li>
</ul>
<p>Here&#8217;s the current memory usage to compare with the <a title="Smaller RAM" href="/wp-content/uploads/2013/03/jvm_large.jpg">screen grabs</a> in the previous post.</p>
<div id="attachment_185" class="wp-caption alignnone" style="width: 772px"><a href="http://confabulate.aidans-place.com/wp-content/uploads/2013/04/htop_1001.jpg"><img class="size-full wp-image-185" alt="Memory usage" src="http://confabulate.aidans-place.com/wp-content/uploads/2013/04/htop_1001.jpg" width="762" height="303" /></a><p class="wp-caption-text">Memory usage</p></div>
<p>To say that I am chuffed with this update from the hosting provider is an understatement. In recent months they have</p>
<ul>
<li>doubled the RAM available in the plan</li>
<li>increased the available disk space</li>
<li>moved to newer hardware with recent CPUs</li>
</ul>
<p>And the price has remained the same*. Which would all be so-so if the level of service hadn&#8217;t continued to be excellent!</p>
<p>So, if you are looking for good VPS supplier, I&#8217;d suggest you include <a title="Linode" href="http://www.linode.com/" target="_blank">Linode</a> in the list that you look at. I have no connection with Linode other than being that rare thing &#8211; <a title="Basil!!!" href="http://www.great-quotes.com/quote/49984" target="_blank">a satisfied customer</a>!</p>
<p><em>* the upgrade for doubling your RAM actually costs an extra 5 cents but you can stay on your old plan at the previous price&#8230;</em></p>
]]></content:encoded>
			<wfw:commentRss>http://confabulate.aidans-place.com/not-such-a-small-vps-now/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HDR photos</title>
		<link>http://confabulate.aidans-place.com/hdr-photos/</link>
		<comments>http://confabulate.aidans-place.com/hdr-photos/#comments</comments>
		<pubDate>Fri, 05 Apr 2013 21:11:10 +0000</pubDate>
		<dc:creator>Aidan Whiteley</dc:creator>
				<category><![CDATA[Dogs]]></category>
		<category><![CDATA[HDR]]></category>
		<category><![CDATA[Lympstone]]></category>
		<category><![CDATA[Scooby]]></category>

		<guid isPermaLink="false">http://confabulate.aidans-place.com/?p=165</guid>
		<description><![CDATA[No idea how they are produced but thanks to Julian P for the HDR photos used for two of the home page photos.]]></description>
				<content:encoded><![CDATA[<p>No idea how they are produced but thanks to Julian P for the <a title="HDR photos" href="http://en.wikipedia.org/wiki/High-dynamic-range_imaging" target="_blank">HDR</a> photos used for two of the <a title="Home page" href="http://confabulate.aidans-place.com/" target="_blank">home page</a> photos.</p>
<div id="attachment_164" class="wp-caption alignnone" style="width: 310px"><a href="http://confabulate.aidans-place.com/wp-content/uploads/2013/04/scooby_dartmoor.jpg"><img class="size-medium wp-image-164" alt="Scooby in HDR" src="http://confabulate.aidans-place.com/wp-content/uploads/2013/04/scooby_dartmoor-300x124.jpg" width="300" height="124" /></a><p class="wp-caption-text">Scooby in HDR</p></div>
<div id="attachment_13" class="wp-caption alignnone" style="width: 310px"><a href="http://confabulate.aidans-place.com/wp-content/uploads/2013/03/exe_1.jpg"><img class="size-medium wp-image-13" alt="Lympstone in HDR" src="http://confabulate.aidans-place.com/wp-content/uploads/2013/03/exe_1-300x124.jpg" width="300" height="124" /></a><p class="wp-caption-text">Lympstone in HDR</p></div>
]]></content:encoded>
			<wfw:commentRss>http://confabulate.aidans-place.com/hdr-photos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java -client versus -server and Play on a small VPS</title>
		<link>http://confabulate.aidans-place.com/java-play-client-on-a-small-vps/</link>
		<comments>http://confabulate.aidans-place.com/java-play-client-on-a-small-vps/#comments</comments>
		<pubDate>Sun, 31 Mar 2013 16:01:48 +0000</pubDate>
		<dc:creator>Aidan Whiteley</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[-server]]></category>
		<category><![CDATA[JVM]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[Play]]></category>

		<guid isPermaLink="false">http://confabulate.aidans-place.com/?p=35</guid>
		<description><![CDATA[I suspect that I am not the only person sad enough to be running a  small VPS mainly for trying out various software frameworks? Since my home server died a death a little while ago, I have been using a&#8230; ]]></description>
				<content:encoded><![CDATA[<p>I suspect that I am not the only person sad enough to be running a  small VPS mainly for trying out various software frameworks? Since my home server died a death a little while ago, I have been using a small VPS with 512Mb of memory.</p>
<p>Just because it is ickle in size, doesn&#8217;t mean that I don&#8217;t want to run several different frameworks! There&#8217;s a couple of Java JVMs (one for a <a title="OutAndAbout" href="http://outandabout.aidans-place.com/" target="_blank">Play framework app</a> and one for a <a title="Hangman" href="http://www.aidans-place.com/main/hangman.jsp" target="_blank">Tomcat app</a>), a MySQL database and an Apache web server with several PHP apps (a restored backup of  a <a title="SYC backup restore" href="http://playpen.aidans-place.com/syc1/" target="_blank">Joomla site</a>, this WordPress bloggy thing and a tiddly <a title="Boat Hire app" href="http://playpen.aidans-place.com/syc1/index.php?option=com_wrapper&amp;view=wrapper&amp;Itemid=223" target="_blank">PHP development</a>).</p>
<p>The Apache / PHP and MySQL were tuned for a small deployment &#8211; there are several good <a title="php mysql tuning" href="http://library.linode.com/hosting-website" target="_blank">guides for this</a>. None of the applications gets that much traffic so I&#8217;m happy to trade throughput for considerate resource usage.</p>
<p>Java is, of course, quite a memory hog by comparison with some frameworks and running two JVM is perhaps a little ambitious for a small VPS. However, all was fine for quite a while until a combination of adding yet more running software and peaky traffic from a badly behaved crawler started problems. Every Friday morning, I started getting notifications from the server monitoring tools about high CPU levels. This was something of a surprise as, while there might be a lot of software, none of it actually does very much!</p>
<p>However, after a little digging, something called kswapd0 seemed to be the culprit. When Google told me that this is involved in managing swap space the reason for the problem became clearer (even if the reason for kswapd0 to continue to fret when there was no traffic was not).</p>
<p>Of the two JVMs on the VPS, the one running the Play application was using a lot more memory than the Tomcat one. Sure &#8211; the Play app creates a few more objects than the Tomcat one and loads a few more libraries so the heap and permgen it requires was expected to be a little higher than the Tomcat JVM. Still &#8211; I thought there was room for a little tweaking to claw back some available memory.</p>
<p>As a first guess at the maximum required heap space and permgen I added<br />
-Xmx128m -XX:MaxPermSize=60m<br />
to the JVM startup. However, as far as I could tell, this made no difference to actual memory usage <img src='http://confabulate.aidans-place.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </p>
<p>I&#8217;d added the above JVM settings through the Play 1.2.x application.conf setting of<br />
%&lt;play_instance_id&gt;.jvm.memory=-XX:MaxPermSize=60m -Xmx128m<br />
but the Java command line also included a -server parameter. This seemed logical given that I was running Play in production mode but I had to admit I had no real idea what this setting actually affected.</p>
<p><a title="Stackoverflow" href="http://stackoverflow.com/questions/198577/real-differences-between-java-server-and-java-client" target="_blank">Stackoverflow</a> seemed to point at a less capacious memory usage in -client mode so I decided to give it a go. Some <a title="Oracle docs" href="http://docs.oracle.com/javase/7/docs/technotes/guides/vm/server-class.html" target="_blank">Oracle docs</a> said when -server will be assumed and gave <a title="JVM details" href="http://www.oracle.com/technetwork/java/hotspotfaq-138619.html#compiler_types" target="_blank">very brief details</a> of the -client versus -server trade off .</p>
<p>The question then became one of how to control the -server setting. I couldn&#8217;t find any way to change this through Play configuration so eventually edited &lt;PLAY_HOME&gt;/framework/pym/play/application.py</p>
<pre class="brush: python; title: ; notranslate">

application_mode = self.read('application.mode').lower()

#if application_mode == 'prod':
#    java_args.append('-server')

</pre>
<p>While this seems less than ideal, it seemed to work in terms of the JVM start up args (and I learnt that Python is sensitive to indentation levels <img src='http://confabulate.aidans-place.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> ). Does anyone know a better way of controlling this?</p>
<p>So did it all do any good? Well &#8211; here a couple of htop snapshots (the Tomcat JVM is the 2nd line in each output). The first is with -server after a few calls to the various apps. The second is without -server a few calls to the apps. It seems as though it is making quite a difference. The Play application&#8217;s appetite for memory now seems quite similar to the Tomcat one.</p>
<div id="attachment_62" class="wp-caption alignnone" style="width: 835px"><a href="http://confabulate.aidans-place.com/wp-content/uploads/2013/03/jvm_large.jpg"><img class="size-full wp-image-62" alt="-server" src="http://confabulate.aidans-place.com/wp-content/uploads/2013/03/jvm_large.jpg" width="825" height="309" /></a><p class="wp-caption-text">JVM with -server</p></div>
<div id="attachment_63" class="wp-caption alignnone" style="width: 844px"><a href="http://confabulate.aidans-place.com/wp-content/uploads/2013/03/jvm_small.jpg"><img class="size-full wp-image-63" alt="JVM -client" src="http://confabulate.aidans-place.com/wp-content/uploads/2013/03/jvm_small.jpg" width="834" height="310" /></a><p class="wp-caption-text">JVM -client</p></div>
<p>Of course, only time will tell if this makes a real difference when the applications have been running for while. On the plus side, my VPS didn&#8217;t go into a swap driven melt down this Friday morning!</p>
<p>If anyone knows how to control the Play 1.2.x framework&#8217;s setting of -server in production mode without tweaking the framework code please do let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://confabulate.aidans-place.com/java-play-client-on-a-small-vps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
