<?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>Timothy Creswick's Blog</title>
	<atom:link href="http://www.curiousmentality.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.curiousmentality.co.uk</link>
	<description>Yet another technical blog</description>
	<lastBuildDate>Thu, 19 Jan 2012 16:10:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Tuning JVM Memory Settings</title>
		<link>http://www.curiousmentality.co.uk/2011/11/tuning-jvm-memory-settings/</link>
		<comments>http://www.curiousmentality.co.uk/2011/11/tuning-jvm-memory-settings/#comments</comments>
		<pubDate>Wed, 30 Nov 2011 22:03:30 +0000</pubDate>
		<dc:creator>Timothy Creswick</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Systems Administration]]></category>
		<category><![CDATA[jvm]]></category>
		<category><![CDATA[tomcat]]></category>
		<category><![CDATA[visualvm]]></category>

		<guid isPermaLink="false">http://www.curiousmentality.co.uk/?p=259</guid>
		<description><![CDATA[Update: Andrew Wang&#8217;s blog post (http://www.umbrant.com/blog/2012/twitter_jvm_tuning.html) is a pretty nice quick guide, well worth reading in conjunction with this page. Sorting out sensible JVM memory settings in a production environment can be a tricky business. There are some great articles, blogs and lengthy white-papers out there explaining the details of how the JVM manages memory, [...]]]></description>
			<content:encoded><![CDATA[<p><em>Update: <a href="http://www.umbrant.com/blog/2012/twitter_jvm_tuning.html">Andrew Wang&#8217;s blog post</a> (http://www.umbrant.com/blog/2012/twitter_jvm_tuning.html) is a pretty nice quick guide, well worth reading in conjunction with this page.</em></p>
<p>Sorting out sensible JVM memory settings in a production environment can be a tricky business. There are some great articles, blogs and lengthy white-papers out there explaining the details of how the JVM manages memory, but I&#8217;ve yet to come across a simple guide that actually helps configure the key JVM startup parameters.</p>
<p><span style="color: #ff0000;">For the impatient: Right down at the bottom of this page I have included a simple tool for helping to set your JVM parameters.</span></p>
<p>For those who are new to this, I suggest doing some web searches around &#8220;java heap&#8221;. Other people have done a much better job of explaining the theory behind this.</p>
<p>Whilst the theory is <em>well worth</em> reading, I&#8217;m hoping this provides some more practically useful information for people running production Java applications. In this context, I&#8217;m dealing with a Tomcat 7 server running on the Oracle JVM with an IO intensive application that performs a lot of in-memory caching.</p>
<p>First up, fire up VisualVM (included with your JDK in the /bin folder) if you haven&#8217;t already. This will allow you to interrogate the memory of your running application. If you&#8217;re trying to interrogate a remote system, you&#8217;ll want to run jstatd in order to get a connection. There&#8217;s information elsewhere on the web about how to do this; I&#8217;ll probably summarise it in another post later.</p>
<p>That will give you a beautiful screen like this:</p>
<div id="attachment_339" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.curiousmentality.co.uk/wp-content/uploads/jvisualvm-screenshot.jpg"><img src="http://www.curiousmentality.co.uk/wp-content/uploads/jvisualvm-screenshot-300x168.jpg" alt="VisualVM Screenshot" title="jvisualvm-screenshot" width="300" height="168" class="size-medium wp-image-339" /></a><p class="wp-caption-text">The VisualVM Visual GC View</p></div>
<p>The server in this example has a 6GB heap allocation and 150MB PermGen allocation. The applicable JVM startup parameters are:</p>
<pre>-server
-Xms6g
-Xmx6g
-XX:MaxPermSize=150m
-XX:PermSize=150m
-XX:NewRatio=2
-XX:SurvivorRatio=10</pre>
<p>To run through these quickly; &#8216;server&#8217; tells the JVM to run in server mode. This mainly changes the behaviour of the HotSpot compiler. In general things will take a little longer to &#8216;warm up&#8217;, but long-running performance will be improved. There are other implications too, which are well documented elsewhere.</p>
<p>Setting the Xmx and Xms values to be the same, in this instance 6GB, we create a single (hopefully un-fragmented) heap allocation for the virtual machine. It&#8217;s this 6GB that then get&#8217;s carved up into the areas shown in the screenshot above.</p>
<p>The PermGen space is assigned with MaxPermSize and PermSize. In general you don&#8217;t need to allocate much here; this mostly relates to the number of classes that you have loaded; relatively simple applications without loads of library inclusions get away with very small values here. We&#8217;re using 150MB in this example, which is more than enough. Again, setting the values the same saves the JVM scaling up and down with usage.</p>
<p>Now for the interesting stuff. The heap is split into Eden Space, Survivor Space and Old Generation. Without going into excruciating detail, objects are created in the Eden space and then moved to the Survivor Space and finally Old Generation. The idea is that the majority of the objects that you create only need to last for a very short period of time (consider an Iterator for example; it only needs to exist for the duration of a single loop). By creating objects in the Eden space, the initial garbage collections on this space are very efficient, since they potentially scrub very large percentages of all objects. Anything which is still in use is promoted to one of the survivor spaces, and then eventually to the Old Generation.</p>
<p>Performing garbage collection on the Old Generation is usually more time consuming, so that&#8217;s what you ideally want to avoid when scaling the other spaces.</p>
<p>It&#8217;s worth noting that the Survivor Space is actually split into two parts, known as S0 and S1. Only one of these is active at a time, and it receives the objects being tenured from the Eden space.</p>
<p>The JVM settings that you use to define these spaces are the &#8216;NewRatio&#8217; and the &#8216;SurvivorRatio&#8217;.</p>
<p>The <strong>NewRatio</strong> is the ratio between the Old Generation and the sum of Survivor Space (both S0 and S1) and Eden Space (in this context, &#8216;New&#8217; means Survivor and Eden). For example, a NewRatio of 2 will create an Old Generation that is twice the size of Eden plus Survivor (or 2/3 of the heap).</p>
<p>The <strong>SurvivorRatio</strong> is the ratio of <em>one</em> of the Survivor Spaces and the Eden Space. For example, a Survivor Ratio of 10 will mean that the Eden space is 10 times the size of <em>each</em> of S0 and S1.</p>
<p>So clearly it&#8217;s not a simple task to visualise how the heap will be allocated when you&#8217;re setting these values.</p>
<p>To that end, I have created this little bit of javascript which you can use to plug in your Xmx (heap size), NewRatio and SurvivorRatio. The resultant heap split is then shown in the table below. All byte values are in MB. Don&#8217;t forget to multiple GB values by 1024 to get MB.</p>
<p>I have already put in values from my example above; that is a heap of 6GB with a NewRatio of 2 and a SurvivorRatio of 10. This is actually an unusually high survivor ratio, however having watched our application in production for a few weeks we&#8217;ve been able to tune it to our [rather unusual] workload.</p>
<p>Input Values</p>
<table>
<tbody>
<tr>
<td>Xmx / Xms</td>
<td>
<input id="jvmxmx" type="text" value="6144" size="6" /> MB</td>
</tr>
<tr>
<td>NewRatio</td>
<td>
<input id="jvmnewratio" type="text" value="2" size="6" /></td>
</tr>
<tr>
<td>SurvivorRatio</td>
<td>
<input id="jvmsurvivorratio" type="text" value="10" size="6" /></td>
</tr>
</tbody>
</table>
<p><script type="text/javascript">// <![CDATA[
function testFunc() {
var xmxF = document.getElementById('jvmxmx');          var xmx = parseInt(xmxF.value);
var nrF = document.getElementById('jvmnewratio');      var nr = parseInt(nrF.value);
var srF = document.getElementById('jvmsurvivorratio'); var sr = parseInt(srF.value);
var oldF = document.getElementById('jvmoldgen'); 
var surv0F = document.getElementById('jvmsurvivor0');
var surv1F = document.getElementById('jvmsurvivor1');
var edenF = document.getElementById('jvmeden');
oldF.value = Math.round(xmx - (xmx/(nr+1)));
surv0F.value = Math.round((xmx/(nr+1))/(sr+2));
surv1F.value = surv0F.value;
edenF.value = Math.round((xmx/(nr+1))*sr/(sr+2));
}
// ]]&gt;</script></p>
<input onclick="testFunc();" type="submit" value="Calculate" />
<p>Resultant Allocations</p>
<table>
<tbody>
<tr>
<td>Old Generation</td>
<td>
<input id="jvmoldgen" type="text" value="" disabled="disabled" size="6" /> MB</td>
</tr>
<tr>
<td>Eden Space</td>
<td>
<input id="jvmeden" type="text" value="" disabled="disabled" size="6" /> MB</td>
</tr>
<tr>
<td>Survivor Spaces</td>
<td>
<input id="jvmsurvivor0" type="text" value="" disabled="disabled" size="6" /> MB</p>
<input id="jvmsurvivor1" type="text" value="" disabled="disabled" size="6" /> MB</td>
</tr>
</tbody>
</table>
<p>Please leave a comment if you have any questions &#8211; I&#8217;d be really interested to hear if this helps to solve your problems.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.curiousmentality.co.uk/2011/11/tuning-jvm-memory-settings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter &#8230;finally</title>
		<link>http://www.curiousmentality.co.uk/2011/03/twitter-finally/</link>
		<comments>http://www.curiousmentality.co.uk/2011/03/twitter-finally/#comments</comments>
		<pubDate>Mon, 28 Mar 2011 21:32:18 +0000</pubDate>
		<dc:creator>Timothy Creswick</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.curiousmentality.co.uk/2011/03/twitter-finally/</guid>
		<description><![CDATA[So I&#8217;ve finally got my act together and opened a twitter account. For anyone interested, I&#8217;m http://twitter.com/TimCreswick (@TimCreswick)]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;ve finally got my act together and opened a twitter account. </p>
<p>For anyone interested, I&#8217;m <a href="http://twitter.com/TimCreswick">http://twitter.com/TimCreswick</a> (@TimCreswick)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.curiousmentality.co.uk/2011/03/twitter-finally/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Yubikey Glassfish Java Authentication Realm</title>
		<link>http://www.curiousmentality.co.uk/2009/09/yubikey-glassfish-java-authentication-realm/</link>
		<comments>http://www.curiousmentality.co.uk/2009/09/yubikey-glassfish-java-authentication-realm/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 15:09:05 +0000</pubDate>
		<dc:creator>Timothy Creswick</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Glassfish]]></category>
		<category><![CDATA[Yubikey]]></category>

		<guid isPermaLink="false">http://www.curiousmentality.co.uk/?p=189</guid>
		<description><![CDATA[Container-managed authentication is very useful in Java web applications; it saves writing a lot of back-end authentication and authorisation code into our applications, makes SSO (single sign-on) trivial between J2EE apps and also allows developers to hook into existing enterprise authorisation frameworks with relative ease. With our recent development work with the Yubikey, a one-time [...]]]></description>
			<content:encoded><![CDATA[<p>Container-managed authentication is very useful in Java web applications; it saves writing a lot of back-end authentication and authorisation code into our applications, makes SSO (single sign-on) trivial between J2EE apps and also allows developers to hook into existing enterprise authorisation frameworks with relative ease.</p>
<p>With our recent development work with the <a href="http://www.yubico.com/products/yubikey/">Yubikey</a>, a <a href="http://en.wikipedia.org/wiki/One-time_password">one-time password</a> (OTP) token from Yubico we decided that it would be useful to have a Yubikey authentication realm for the <a href="https://glassfish.dev.java.net/">Glassfish</a> application server.</p>
<p>A lot of our existing J2EE applications use the JDBC Realm that is included in the Glassfish distribution. The JDBC Realm allows you to configure the authentication of your application to any JDBC back-end accessible by your application server (i.e. enabled by an appropriate JDBC driver library). Typically this will take the form of a MySQL database table with a list of usernames and password <a href="http://en.wikipedia.org/wiki/Cryptographic_hash_function">hashes</a>.</p>
<p>Here&#8217;s an example of the Glassfish v2.1 JDBC Realm configuration template:</p>
<div id="attachment_219" class="wp-caption aligncenter" style="width: 475px"><img src="http://www.curiousmentality.co.uk/wp-content/uploads/jdbc_realm.png" alt="Glassfish v2.1 JDBC Realm Configuration" title="jdbc_realm" width="465" height="668" class="size-full wp-image-219" /><p class="wp-caption-text">Glassfish v2.1 JDBC Realm Configuration</p></div>
<p>Our custom Yubikey Realm is essentially an extension of the JDBC Realm (although not in the sense of a Java <em>&#8220;extends&#8221;</em>). The Yubikey Realm supports all the same functionality as the JDBC Realm, so you can drop it in-place with all the same settings and it&#8217;s totally backwards compatible.</p>
<p>We&#8217;ve added the functionality to specify an additional column in the users database table containing the Base 64 Yubikey Public Identifier (ID) of the Yubikey assigned to that user. This is configured via the <em>yubikey-column</em> property. By default, the Yubikey Realm will authenticate users as normal, unless the password length is >= 32 characters. In this instance, the password is assumed to be a Yubikey OTP, and the Realm authenticates accordingly.</p>
<p>We have the additional parameters <em>yubikey-force</em> and <em>yubikey-auth-url</em>, which respectively control whether <strong>all</strong> logins are treated as Yubikey OTPs, and which validation server you would like to use.</p>
<p>Here&#8217;s an example of the realm configuration screen:</p>
<div id="attachment_223" class="wp-caption aligncenter" style="width: 560px"><img src="http://www.curiousmentality.co.uk/wp-content/uploads/yubikey_realm.png" alt="Yubikey Authentication Realm Configuration" title="yubikey_realm" width="550" height="548" class="size-full wp-image-223" /><p class="wp-caption-text">Yubikey Authentication Realm Configuration</p></div>
<p>&#8230;and there we have it. Instant in-place implementation of Yubikey authenticated logins for all of our existing J2EE applications without changing <em>any</em> application code. Obviously it&#8217;s worth noting that in this context we&#8217;re using the Yubikey OTP as a convenient password <strong>replacement</strong>, not as a <a href="http://en.wikipedia.org/wiki/Two-factor_authentication">2<sup>nd</sup> authentication factor</a>.</p>
<p>Please feel free to contact me if you&#8217;re interested in using our authentication realm; we may consider publishing it online in due course, along with the installation instructions and a few enhancements that are pending.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.curiousmentality.co.uk/2009/09/yubikey-glassfish-java-authentication-realm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Yubikey Authentication with Outlook Web Access</title>
		<link>http://www.curiousmentality.co.uk/2009/09/yubikey-authentication-outlook-web-access/</link>
		<comments>http://www.curiousmentality.co.uk/2009/09/yubikey-authentication-outlook-web-access/#comments</comments>
		<pubDate>Sun, 13 Sep 2009 17:28:04 +0000</pubDate>
		<dc:creator>Timothy Creswick</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[ISA]]></category>
		<category><![CDATA[OWA]]></category>
		<category><![CDATA[RADIUS]]></category>
		<category><![CDATA[Yubikey]]></category>

		<guid isPermaLink="false">http://www.curiousmentality.co.uk/?p=145</guid>
		<description><![CDATA[I&#8217;ve recently been evaulating Two-factor Authentication (2F) implementations for one of our clients, including the excellent Yuibikey product from Yubico. The initial requirement for our client project is 2F protection of all remote-access to their systems, which presently only amounts to VPN connections and webmail access via Outlook Web Access (OWA) provided by Exchange 2007. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently been evaulating <a href="http://en.wikipedia.org/wiki/Two-factor_authentication">Two-factor Authentication</a> (2F) implementations for one of our clients, including the excellent <a href="http://www.yubico.com/products/yubikey/">Yuibikey</a> product from Yubico.</p>
<p>The initial requirement for our client project is 2F protection of all remote-access to their systems, which presently only amounts to VPN connections and webmail access via Outlook Web Access (OWA) provided by Exchange 2007.</p>
<p>We&#8217;ve now finished implementing this, and the diagram below shows how we protected the OWA service (I might cover VPN in a later post). Naturally there are a wide variety of ways to provide 2F authentication for OWA, but I think this presents the best end-user experience:</p>
<div id="attachment_165" class="wp-caption aligncenter" style="width: 590px"><img src="http://www.curiousmentality.co.uk/wp-content/uploads/isa-owa-freeradius.gif" alt="Authentication Process Overview" title="isa-owa-freeradius" width="580" height="630" class="size-full wp-image-165" /><p class="wp-caption-text">Authentication Process Overview</p></div>
<p>First, a quick overview of the highlights:</p>
<ul>
<li>We implemented a domain-joined ISA Server 2006 Standard.</li>
<li>We customised the default 2F ISA Server OWA login wrapper. By default it requests Username, OTP (one-time password) and finally the &#8220;internal&#8221; password (i.e. the domain password). We thought this was a little counter-intuitive for our users, since the OTP is the new credential being requested (in addition to the usal username/password combination) we thought it should be the last field on the form. Also, our Yubikeys are configured to emulate an &#8216;enter&#8217; keypress after populating the field, which means that the Yubikey OTP needs to be the last field filled out by the user since it causes the form to be submitted. Finally, the default ISA OWA login form contains an option to add a <em>second</em> username for internal use. We removed this since we don&#8217;t have different usernames for remote access.</li>
<li>We modified the Active Directory Schema to include a new field on the <em>User</em> object, contianing the user&#8217;s Yubikey Public Indentifier. In this way we are able to verify that the Yubikey used to generate the OTP matches the Yubikey assigned to the AD user. This appears to be a unique solution; all the other implementations that I&#8217;ve seen require a separate mapping table of user accounts to Yubikeys, usually on the RADIUS server. This is annoying, since it means that you&#8217;ve got <em>another</em> system to modify every time a new key is deployed.</li>
<li>All the FreeRADIUS modules that we used are entirely custom in-house code. Their function is described in detail below.</li>
</ul>
<p>Examining our final implementation step by step:</p>
<ol>
<li>We present our custom ISA / OWA login form to the user over a secure HTTPS connection, where we collect the AD username, AD password and their Yubikey OTP.</li>
<li>The ISA Server is configured to use RADIUS-backed OTP authentication for this service entry, which means that it sends the username and OTP to our FreeRADIUS server (note that the AD password isn&#8217;t sent, since we don&#8217;t need that).</li>
<li>On the FreeRADIUS Server we have a custom validation module that communicates with the Domain Controller via LDAPS (secure LDAP) in order to confirm that the user exists in the Active Directory (AD). The module allows us to specify particular CNs and OUs in the LDAP tree to search within.</li>
<li>Once the user has been located in the AD, the LDAP function retrieves the Yubikey Public ID of the Yubikey assigned to the user being authenticated. As mentioned earlier, we store this mapping in a custom AD field that we added to the schema. This Yubikey ID is compared with the ID of the key used to generate the OTP to ensure that the key is authorised for that user (for those unfamiliar with the Yubikey, the public ID can be trivially extracted from the OTP).</li>
<li>Next, the FreeRADIUS module communicates with our own Yubikey Validation Server running on Glassfish (we could easily switch this to another server) using the standard <a href="http://www.yubico.com/developers/api/">Yubikey validation API</a>. This ensures that the submitted OTP is valid.</li>
<li>Assuming all of the above was successful the RADIUS server sends an &#8216;Accept&#8217; response back to the ISA Server. To clarify, the following <em>must</em> be true:
<ol>
<li>The user must exist in one of the configured AD OUs or CNs.</li>
<li>The user must have a Yubikey ID assigned in their AD record.</li>
<li>The submitted Yubikey ID must match the ID stored in the AD.</li>
<li>The OTP must validate successfully against the validation service.</li>
</ol>
</li>
<li>Finally, if the RADIUS response was positive, the ISA server provides a delegated login to the OWA service. This means that the user doesn&#8217;t need to login a second time, so it&#8217;s essentially a form of SSO (single sign on). In order for this to work, the OWA service on your Exchange CAS server must be configured for NTLM (or basic) authentication as opposed to forms authentication.</li>
</ol>
<p>Hopefully I have provided a coherent overview of our solution. I will try and follow this up with more details on the custom ISA forms, the LDAP schema modifications and FreeRADIUS integration in future posts.</p>
<p>As always, feedback is welcome!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.curiousmentality.co.uk/2009/09/yubikey-authentication-outlook-web-access/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>The business case for NFS backing stores with VMware ESXi</title>
		<link>http://www.curiousmentality.co.uk/2009/09/the-business-case-for-nfs-backing-stores-with-vmware-esxi/</link>
		<comments>http://www.curiousmentality.co.uk/2009/09/the-business-case-for-nfs-backing-stores-with-vmware-esxi/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 13:33:14 +0000</pubDate>
		<dc:creator>Timothy Creswick</dc:creator>
				<category><![CDATA[Virtualisation]]></category>
		<category><![CDATA[esxi]]></category>
		<category><![CDATA[NFS]]></category>
		<category><![CDATA[Solaris]]></category>
		<category><![CDATA[vmware]]></category>
		<category><![CDATA[ZFS]]></category>

		<guid isPermaLink="false">http://www.curiousmentality.co.uk/?p=133</guid>
		<description><![CDATA[I mentioned in this post (relating to my Solaris ZFS / iSCSI management script) to the storage-discuss OpenSolaris mailing list that we were mostly using NFS as opposed to iSCSI for our ESXi backing stores, and was asked by Christoph Jahn to provide some background on this. Here&#8217;s my response as posted to the list: [...]]]></description>
			<content:encoded><![CDATA[<p>I mentioned in <a href="http://opensolaris.org/jive/thread.jspa?messageID=413931&#038;tstart=0">this post</a> (relating to <a href="http://www.curiousmentality.co.uk/2009/09/scripted-management-of-solaris-10-comstar-iscsi-targets/">my Solaris ZFS / iSCSI management script</a>) to the <a href="http://opensolaris.org/jive/forum.jspa?forumID=94&#038;start=0">storage-discuss OpenSolaris mailing list</a> that we were mostly using NFS as opposed to iSCSI for our ESXi backing stores, and was asked by Christoph Jahn to provide some background on this.</p>
<p>Here&#8217;s my response as posted to the list:</p>
<blockquote><p>Hi Christoph.</p>
<p>Several reasons, I&#8217;ll try and outline those that I can recall:</p>
<p>1. We found the performance of NFS to be far better than iSCSI, although we probably hadn&#8217;t spent sufficient time tweaking the iSCSI configuration. NB: we were exporting ZFS block devices as LUNs to virtual machines as RDMs (raw device mappings) as opposed to formatting them as VMFS, so the comparison isn&#8217;t perhaps completely fair.</p>
<p>2. Overall the administration of iSCSI was overcomplicated, and prone to human error. Training our people to administer and troubleshoot it was likely to be too costly, and the additional ongoing costs associated with the increased administration have to be considered.</p>
<p>3. Similar to point (2) above, we found that you had to be careful to keep track of IQNs and LUN Ids when mapping in VMware, it&#8217;s only possible to put names on targets, not LUNs, so when mapping multiple disks into a VM the process was potentially error-prone.</p>
<p>4. The provisioning of iSCSI storage between ESXi and COMSTAR *felt* a little bit unstable; we had numerous instances of lengthy HBA rescans, targets appearing and disappearing which although they were all explained within &#8216;expected behaviour&#8217; were either a little counter-intuitive or too time-consuming.</p>
<p>5. My understanding of the nature of ESX NFS connections is that less IO blocking takes place, which explains why so many people get better throughput when running multiple VMs against the same SAN connection.</p>
<p>6. The limit of 48 NFS mappings in ESX wasn&#8217;t going to be a constraint for us for the foreseeable future; we rarely load more than 15 VMs per node. The flexibility of creating a separate ZFS filesystem for each VM and exporting it separately over NFS was therefore possible.</p>
<p>7. Everyone understands files; when you login to the Solaris system you can navigate to the ZFS filesystem and see .vmx and .vmdk files &#8211; these are nice and simple to manage, clone, backup, export etc etc.</p>
<p>8. Related to point (7), when you use NFS in this way the virtual machine configuration is stored alongside the rest of the virtual machine data. This means that a snapshot of the ZFS filesystem for that VM gives us a true complete backup at that point in time.</p>
<p>I think that just about covers it. Essentially, although iSCSI feels like a more clever way of solving our problem, and certainly it poses as a more &#8216;enterprise&#8217; solution, it really was a case of overcomplicating the solution.</p>
<p>Several times in the last few years we&#8217;ve found that simple is better, even if it doesn&#8217;t satisfy one&#8217;s desire to implement the &#8216;technically perfect solution&#8217;. It&#8217;s more a question of balancing the economics (I&#8217;m running a business, after all) with the actual requirements. Oftentimes just because you *can* do something doesn&#8217;t mean you should, and I&#8217;ve often found that PERCEIVED requirements can out-grow ACTUAL requirements just because some technology exists to solve problems that you don&#8217;t have [yet].</p>
<p>In short, I like to keep it fit for purpose, even if it does feel like a more agricultural solution.</p>
<p>Finally, I should add that the one major shortcoming with our NFS solution is the lack of any equivalent to the iSCSI multipathing. If we had any machines that required true high availability or automated failover this would probably have negated all of the points above &#8211; iSCSI multipathing is a beautiful thing, and it creates some awesome possibilities for fault tolerance.</p>
<p>As it stands, we take care of link failure at the network level (as opposed to the iSCSI MPIO protocol level) and deal with ESX node or storage node failure by manually remapping NFS filesystems from elsewhere. This is actually preferable to automated recovery since sometimes we don&#8217;t want to take the &#8216;default&#8217; action during a failure scenario. By having a carefully documented failure plan I believe we have more flexibility, and can deal with recovery on a per-client basis, rather than a system-wide basis. </p>
<p>Ultimately we are a business dealing with multiple clients hosted on shared hardware, so it&#8217;s important to keep our implementations client-centric, rather than system-centric.</p>
<p>Finally, I should add that although we don&#8217;t have automated failover of these systems, our solution does still permit us to stay well within our contracted SLAs, which serves the business need.</p>
<p>Regards,</p>
<p>Timothy Creswick</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.curiousmentality.co.uk/2009/09/the-business-case-for-nfs-backing-stores-with-vmware-esxi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Normal PDF viewing with Sony Reader PRS-505</title>
		<link>http://www.curiousmentality.co.uk/2009/09/normal-pdf-viewing-with-sony-reader-prs-505/</link>
		<comments>http://www.curiousmentality.co.uk/2009/09/normal-pdf-viewing-with-sony-reader-prs-505/#comments</comments>
		<pubDate>Sun, 06 Sep 2009 13:27:57 +0000</pubDate>
		<dc:creator>Timothy Creswick</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.curiousmentality.co.uk/?p=107</guid>
		<description><![CDATA[My primary reason for buying an eBook Reader was for the large number of technical PDFs, white papers and carefully formatted user guides that I read for work. I found it very hard to find how well these pre-formatted PDFs would display on the device, with a lot of people saying that they were barely [...]]]></description>
			<content:encoded><![CDATA[<p>My primary reason for buying an eBook Reader was for the large number of technical PDFs, white papers and carefully formatted user guides that I read for work.</p>
<p>I found it very hard to find how well these pre-formatted PDFs would display on the device, with a lot of people saying that they were barely legible. Obviously with most of these documents you don&#8217;t want to spend time reformatting them for the Reader&#8217;s screen, and zooming is cumbersome and often breaks the formatting.</p>
<p>Other people&#8217;s posts notwithstanding I went ahead and bought one.</p>
<p>The good news is that I find it perfectly usable, and although the rendered font size ends up being rather smaller than you might choose, text and diagrams are rendered very clearly. In case it helps anyone else deciding to buy one of these devices for this kind of work, I&#8217;ve included some photos below.</p>
<p>First, a regular eBook page rendered in &#8220;Small&#8221; (click for hi-res):</p>
<p><a href="http://www.curiousmentality.co.uk/wp-content/uploads/prs-505-normal.jpg"><div id="attachment_109" class="wp-caption aligncenter" style="width: 229px"><img src="http://www.curiousmentality.co.uk/wp-content/uploads/prs-505-normal-small.jpg" alt="An eBook" title="prs-505-normal-small" width="219" height="164" class="size-full wp-image-109" /><p class="wp-caption-text">An eBook</p></div></a></p>
<p>Then a page from a Sun technical manual (click for hi-res):</p>
<p><a href="http://www.curiousmentality.co.uk/wp-content/uploads/prs-505-pdf.jpg"><div id="attachment_111" class="wp-caption aligncenter" style="width: 229px"><img src="http://www.curiousmentality.co.uk/wp-content/uploads/prs-505-pdf-small.jpg" alt="A regular PDF" title="prs-505-pdf-small" width="219" height="164" class="size-full wp-image-111" /><p class="wp-caption-text">A regular PDF</p></div></a></p>
<p>Finally, here&#8217;s a close up including some <em>very</em> small text, all of which I find perfectly fine for my purposes. Again, click for a larger version, and apologies for the <a href="http://www.digitalimagemagazine.com/blog/featured/tutorial-correcting-lens-distortion-in-your-reference-photos/">lens distortion</a> which I haven&#8217;t bothered to correct:</p>
<p><a href="http://www.curiousmentality.co.uk/wp-content/uploads/prs-505-pdfclose.jpg"><div id="attachment_123" class="wp-caption aligncenter" style="width: 215px"><img src="http://www.curiousmentality.co.uk/wp-content/uploads/prs-505-pdfclose-small.jpg" alt="Regular PDF Close-up" title="prs-505-pdfclose-small" width="205" height="256" class="size-full wp-image-123" /><p class="wp-caption-text">Regular PDF Close-up</p></div></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.curiousmentality.co.uk/2009/09/normal-pdf-viewing-with-sony-reader-prs-505/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A more sensible PowerShell prompt</title>
		<link>http://www.curiousmentality.co.uk/2009/09/a-more-sensible-powershell-prompt/</link>
		<comments>http://www.curiousmentality.co.uk/2009/09/a-more-sensible-powershell-prompt/#comments</comments>
		<pubDate>Sat, 05 Sep 2009 18:07:49 +0000</pubDate>
		<dc:creator>Timothy Creswick</dc:creator>
				<category><![CDATA[Systems Administration]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.curiousmentality.co.uk/?p=93</guid>
		<description><![CDATA[The default PowerShell prompt is long and irritating. I switch my default to the following: In order to achieve this, I have the following script: function prompt { Write-Host("%") -nonewline -foregroundcolor Yellow; return " "; } c: cd Scripts " "; You&#8217;ll also note that I change the default working directory to C:\Scripts, which is [...]]]></description>
			<content:encoded><![CDATA[<p>The default PowerShell prompt is long and irritating. I switch my default to the following:</p>
<div id="attachment_91" class="wp-caption aligncenter" style="width: 405px"><img src="http://www.curiousmentality.co.uk/wp-content/uploads/powershell-prompt.jpg" alt="A better PowerShell prompt" title="powershell-prompt" width="395" height="150" class="size-full wp-image-91" /><p class="wp-caption-text">A better PowerShell prompt</p></div>
<p>In order to achieve this, I have the following script:</p>
<pre>
function prompt { Write-Host("%") -nonewline -foregroundcolor Yellow; return " "; }
c:
cd Scripts
" ";
</pre>
<p>You&#8217;ll also note that I change the default working directory to <code>C:\Scripts</code>, which is where I keep all my PowerShell scripts and saves me a little extra time.</p>
<p>In order to implement this, you&#8217;ll need to create the folder <code>C:\Users\{USERNAME}\Documents\WindowsPowerShell</code> and save the file as <code>profile.ps1</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.curiousmentality.co.uk/2009/09/a-more-sensible-powershell-prompt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scripted management of Solaris 10 COMSTAR iSCSI targets</title>
		<link>http://www.curiousmentality.co.uk/2009/09/scripted-management-of-solaris-10-comstar-iscsi-targets/</link>
		<comments>http://www.curiousmentality.co.uk/2009/09/scripted-management-of-solaris-10-comstar-iscsi-targets/#comments</comments>
		<pubDate>Sat, 05 Sep 2009 17:40:10 +0000</pubDate>
		<dc:creator>Timothy Creswick</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[COMSTAR]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[Solaris]]></category>
		<category><![CDATA[ZFS]]></category>

		<guid isPermaLink="false">http://www.curiousmentality.co.uk/?p=83</guid>
		<description><![CDATA[We&#8217;re using one of our Solaris machines to publish iSCSI targets to some VMware ESXi hosts (initiators) for client virtual machines. To make provisioning new LUNs as simple as possible I&#8217;ve written an interactive script that first creates a ZFS backing store, then creates the LU for STMF, gives you the option of creating a [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;re using one of our Solaris machines to publish iSCSI targets to some VMware ESXi hosts (initiators) for client virtual machines.</p>
<p>To make provisioning new LUNs as simple as possible I&#8217;ve written an interactive script that first creates a ZFS backing store, then creates the LU for STMF, gives you the option of creating a new iSCSI target or using an existing one, and finally attaches the LU to the selected target.</p>
<p>Here&#8217;s a sample output from the script:</p>
<pre>
-----------------------------------------------------------------
ZFS / iSCSI / COMSTAR Simple Management Toolset
(c)Copyright 2009 Thoughtspace Ltd. Developed by Timothy Creswick
-----------------------------------------------------------------

Please specify the name for the new ZFS backing store.
Your new store will be created inside mpool/clients/iscsi

Existing backing stores are:
NAME                                 USED  AVAIL  REFER  MOUNTPOINT
mpool/clients/iscsi                  271G   973G    19K  /mpool/clients/iscsi
mpool/clients/iscsi/testing           24K   973G    24K  -
mpool/clients/iscsi/testing-three     24K   973G    24K  -
mpool/clients/iscsi/testing-two       24K   973G    24K  -

New backing store: mpool/clients/iscsi/test

Should the backing store be created as a sparse volume? [Yes/No] no

Please enter the size of the backing store: 10GB

Will create a ZFS store with the following details:
  Name:    mpool/clients/iscsi/test
  Size:    10GB
  Sparse:  No

Proceed? [Yes/No] y

Creating ZFS backing store... OK

Creating the STMF LU... OK (GUID is 600144f094ab000000004aa29327000b)

You can either attach this LU / device to an existing iSCSI target as a new LUN,
or you can create a new iSCSI target and STMF target group for this ZFS backing
store.

In general, you want to have a single iSCSI target per Virtual Machine, so if the
virtual machine requires multiple disks, then you should attach each additional
disk as a new LUN on an existing target.

If this is the first disk that you are attaching via iSCSI to the Virtual Machine
you should create a new iSCSI / STMF target.

Create a new iSCSI target? [Yes/No] y

Creating iSCSI target... OK (iqn.1986-03.com.sun:02:2fff96a8-63b2-48bd-b447-bda2a1fc9ead)

Creating STMF target group... OK

Assigning new iSCSI target to target group:
  Waiting for STMF service to terminate.... OK
  Adding TG member... OK
  Starting STMF service.... OK

Adding LU view to target group... OK

All done. Your ZFS device should be available on target iqn.1986-03.com.sun:02:2fff96a8-63b2-48bd-b447-bda2a1fc9ead.
</pre>
<p>You can get a copy of the script <a href="http://www.curiousmentality.co.uk/wp-content/uploads/create-iscsi-target.sh">here</a>. Please feel free to use and modify &#8211; I&#8217;d be interested in any feedback.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.curiousmentality.co.uk/2009/09/scripted-management-of-solaris-10-comstar-iscsi-targets/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Use nmap to locate ProCurve switches on your network</title>
		<link>http://www.curiousmentality.co.uk/2009/09/use-nmap-to-locate-procurve-switches-on-your-network/</link>
		<comments>http://www.curiousmentality.co.uk/2009/09/use-nmap-to-locate-procurve-switches-on-your-network/#comments</comments>
		<pubDate>Sat, 05 Sep 2009 17:25:42 +0000</pubDate>
		<dc:creator>Timothy Creswick</dc:creator>
				<category><![CDATA[Systems Administration]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[procurve]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://www.curiousmentality.co.uk/?p=79</guid>
		<description><![CDATA[Nmap is a great tool; utterly indispensable for network administrators. If you haven&#8217;t got it yet goto http://nmap.org or install via your favourite package manager. Here&#8217;s one of my frequently used nmap commands &#8211; very simple, but gives you a quick list of IP addresses for all of the ProCurve switches on your network. nmap [...]]]></description>
			<content:encoded><![CDATA[<p>Nmap is a great tool; utterly indispensable for network administrators. If you haven&#8217;t got it yet goto  <a href="http://nmap.org">http://nmap.org</a> or install via your favourite package manager.</p>
<p>Here&#8217;s one of my frequently used nmap commands &#8211; very simple, but gives you a quick list of IP addresses for all of the ProCurve switches on your network.</p>
<pre>
nmap -n -sP 10.0.0.0/24 | grep --before-context=1 "ProCurve Networking by HP" | grep "Host" | cut -f2 -d' '
</pre>
<p>Just change the subnet range to match your network. Note: this relies on doing <a href="http://standards.ieee.org/regauth/oui/index.shtml">vendor OUI lookups</a> on device MAC addresses, which means that the scanning node needs to be on the same Layer 2 network segment for this to work.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.curiousmentality.co.uk/2009/09/use-nmap-to-locate-procurve-switches-on-your-network/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using the Dell Latitude E6400 Built-in GPS</title>
		<link>http://www.curiousmentality.co.uk/2009/06/using-the-dell-latitude-e6400-built-in-gps/</link>
		<comments>http://www.curiousmentality.co.uk/2009/06/using-the-dell-latitude-e6400-built-in-gps/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 19:29:07 +0000</pubDate>
		<dc:creator>Timothy Creswick</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[dell]]></category>
		<category><![CDATA[E6400]]></category>
		<category><![CDATA[gps]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[latitude]]></category>

		<guid isPermaLink="false">http://www.curiousmentality.co.uk/?p=67</guid>
		<description><![CDATA[I recently took delivery of a new Dell Latitude E6400 laptop to use as primary workstation. All things considered it&#8217;s turning out to be an excellent choice. One of the things that surprised me was the presence of a GPS transciever built into the laptop as part of the HSPA 3G wireless card. Viewing in [...]]]></description>
			<content:encoded><![CDATA[<p>I recently took delivery of a new Dell Latitude E6400 laptop to use as primary workstation. All things considered it&#8217;s turning out to be an excellent choice.</p>
<p>One of the things that surprised me was the presence of a GPS transciever built into the laptop as part of the HSPA 3G wireless card. Viewing in Windows Device Manager it appears as a component connected to the USB sub-interface on the card:</p>
<div id="attachment_63" class="wp-caption aligncenter" style="width: 498px"><img src="http://www.curiousmentality.co.uk/wp-content/uploads/gps-devmgr-screenshot.jpg" alt="Device Manager Screenshot" title="gps-devmgr-screenshot" width="488" height="144" class="size-full wp-image-63" /><p class="wp-caption-text">Device Manager Screenshot</p></div>
<p>The interface to the GPS unit is simple <a href="http://en.wikipedia.org/wiki/NMEA_0183">NMEA</a> over the virtual COM port 7. By default there&#8217;s not much you can do with this &#8211; Google Earth will interface pretty much out of the box, but not much else.</p>
<p>I decided it would be fun to write a little Java application to map the current position of the laptop, as given by the GPS unit.</p>
<p>I looked around a bit and found JXMapKit, which is part of the <a href="https://swingx.dev.java.net/">swingx</a> project. Using some of <a href="http://today.java.net/lpt/a/450">this tutorial</a> to get me started, I had a basic mapping application up and running in about 20 minutes.</p>
<p>The next step was to interface with the GPS unit. This is where Java falls down a little, espcially on Windows machines. In the end I settled for the <a href="http://rxtx.qbang.org/wiki/index.php/Main_Page">RXTX</a> library which uses native implementation (JNI) to provide access to serial devices from within a Java app.</p>
<p>The Latitude&#8217;s GPS unit spews out location information on the COM port as it becomes available, so all you need to do is &#8216;listen&#8217;, and then handle the stream in an event-driven manner.</p>
<p>A sample GGA &#8216;fix&#8217; sentence looks like this:</p>
<pre>$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47</pre>
<p>I couldn&#8217;t find any NMEA parsing libraries for Java online, so another 2 hours and I&#8217;d written my own. There&#8217;s a core class which validates the NMEA sentence and then invokes a specific handler class depending on the NMEA sentence type. For example, GGA (fix) sentences are handled by NmeaLocationMessage, GSA (overall satellite data) sentences are handled by NmeaSatelliteGeneralDataMessage, GSV (detailed satellite data) sentences are handled by NmeaSatelliteDetailMessage and so on.</p>
<p>Each of these &#8216;handler&#8217; classes contains the logic to further parse the specific sentence type. Just to get up and running I only implemented handlers for GGA, GSA, RMC and GSV messages, which were more than enough to get a fix on the map.</p>
<p>Finally I wrote the code to invoke the NMEA parser on serial port events. The core event handling code looks like this:</p>
<pre>
NmeaMessage message = new NmeaParser().parseSentence(line);

if (NmeaLocationMessage.class.isInstance(message)) {
	NmeaLocationMessage location = (NmeaLocationMessage) message;

	if (location.getLatitude() != lastLat || location.getLongitude() != lastLon) {

		lastLat = location.getLatitude();
		lastLon = location.getLongitude();

		map.setAddressLocation(
				new GeoPosition(
				location.getLatitude(),
				location.getLongitude()));

	}
}
</pre>
<p>Nice and simple!</p>
<p>The net result is that everytime the GPS reports a new Latitude or Longitude, the map is re-centered accordingly.</p>
<p>So finally, here&#8217;s a location plot as I&#8217;m sitting on a train at London Paddington Station waiting to depart:</p>
<div id="attachment_65" class="wp-caption aligncenter" style="width: 622px"><img src="http://www.curiousmentality.co.uk/wp-content/uploads/gps-tracker-screenshot.jpg" alt="GPS Tracker Screenshot" title="gps-tracker-screenshot" width="612" height="450" class="size-full wp-image-65" /><p class="wp-caption-text">GPS Tracker Screenshot</p></div>
<p>I wrote this really for a bit of fun, since clearly it&#8217;s not massively practical. If you have an E6400 with GPS, or a similar notebook and would like to play around with it please let me know and I&#8217;ll gladly send you the app and/or sourcecode.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.curiousmentality.co.uk/2009/06/using-the-dell-latitude-e6400-built-in-gps/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
	</channel>
</rss>

