<?xml version="1.0" encoding="utf-8"?>
			
			<rss version="2.0">
			<channel>
			<title>Lynch Consulting Blog - Software Architecture</title>
			<link>http://www.lynchconsulting.com.au/blog/index.cfm</link>
			<description>A blog about ColdFusion, PHP, Flash, Flex, Web Standards and a mish mash of other technologies</description>
			<language>en-us</language>
			<pubDate>Tue, 07 Sep 2010 12:55:07 --1000</pubDate>
			<lastBuildDate>Thu, 07 Jan 2010 10:25:00 --1000</lastBuildDate>
			<generator>BlogCFC</generator>
			<docs>http://blogs.law.harvard.edu/tech/rss</docs>
			<managingEditor>mark@lynchconsulting.com.au</managingEditor>
			<webMaster>mark@lynchconsulting.com.au</webMaster>
			
			
			
			
			
			<item>
				<title>Jmeter over SSH Socks proxy</title>
				<link>http://www.lynchconsulting.com.au/blog/index.cfm/2010/1/7/Jmeter-over-SSH-Socks-proxy</link>
				<description>
				
				I&apos;ve been doing some testing recently where I need to connect via SSH server to a remote network to run some load testing.

To do this I used a &lt;a href=&quot;http://www.lynchconsulting.com.au/blog/index.cfm/2009/7/1/SSH-SOCK-Proxying-and-preventing-it&quot;&gt;SSH sock proxy like I have previously blogged about&lt;/a&gt;.

So I fired this up so that I could review the site I wanted to look at.  It worked a charm through firefox but there is no where to set up the proxy in jmeter.

To make it work you need to let the JVM know what proxy to use like so:
&lt;code&gt;
java -DsocksProxyHost=localhost -DsocksProxyPort=8080 -jar ApacheJMeter.jar 
&lt;/code&gt;

No jmeter will use the socks proxy on port 8080 on my local machine.  Nice.
				
				</description>
				
				<category>Software Architecture</category>
				
				<category>Open Source</category>
				
				<category>Linux</category>
				
				<category>HOWTO</category>
				
				<category>General</category>
				
				<pubDate>Thu, 07 Jan 2010 10:25:00 --1000</pubDate>
				<guid>http://www.lynchconsulting.com.au/blog/index.cfm/2010/1/7/Jmeter-over-SSH-Socks-proxy</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>CFMX - SOAP vs REST benchmarks</title>
				<link>http://www.lynchconsulting.com.au/blog/index.cfm/2008/3/13/CFMX--SOAP-vs-REST-benchmarks</link>
				<description>
				
				One of the applications that we have developed relies quite heavily on web services and I&apos;ve been doing some benchmarking to figure out how we can improve the performance of it. 

Currently the application consists of a AIR/Flex frontend and a CF backend which is using SOAP web services to communicate.  I wanted to understand the level of overhead that the SOAP layer added to each coldfusion request and understand if it would be beneficial to move away from using SOAP to using a REST type direct XML format.


&lt;h2&gt;Test 1: SOAP CFC vs REST CFM&lt;/h2&gt;

Initally I created two files which were a very simple hello world example to test each scenario.

&lt;h3&gt;soapservice.cfc:&lt;/h3&gt;
&lt;code&gt;
&lt;cfcomponent&gt;
&lt;cffunction name=&quot;hello&quot; access=&quot;remote&quot; returntype=&quot;string&quot;&gt;
	&lt;cfreturn &apos;hello world&apos;&gt;
&lt;/cffunction&gt;
&lt;/cfcomponent&gt;
&lt;/code&gt;

and the CFM/REST version
&lt;h3&gt;xmlservice.cfm:&lt;/h3&gt;
&lt;code&gt;
&lt;cfsetting enablecfoutputonly=&quot;true&quot;&gt;
&lt;cfcontent  reset=&quot;true&quot; type=&quot;text/xml&quot;&gt;
&lt;cfparam name=&quot;url.method&quot; default=&quot;&quot;&gt;
&lt;cfswitch expression=&quot;#url.method#&quot;&gt;
	&lt;cfcase value=&quot;hello&quot;&gt;
		&lt;cfoutput&gt;&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;str&gt;Hello World&lt;/str&gt;&lt;/cfoutput&gt;
	&lt;/cfcase&gt;
	&lt;cfdefaultcase&gt;
		&lt;cfoutput&gt;&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;str&gt;Unknown Method&lt;/str&gt;&lt;/cfoutput&gt;
	&lt;/cfdefaultcase&gt;
&lt;/cfswitch&gt;
&lt;/code&gt;

The results of the load tests were striking

The rest version of the code was 4 to 5 times faster, which meant 1000 second per minute instead 200 requests per second.

However, looking at the code I thought it was an unfair comparison as the SOAP one was using OO-style code which was more maintainable.  I&apos;m very much an OO person so I didn&apos;t want to have to live with horribly unmaintainable code just to get performance.


&lt;h2&gt;Test 2: SOAP CFC vs REST CFM with CFC&lt;/h2&gt;

I created a new version of the CFM file which this time leveraged the soapservice.cfc which meant I could use the same code but bypass the seemingly very slow SOAP layer in Coldfusion.

&lt;h3&gt;xmlservicewithcfc.cfm:&lt;/h3&gt;
&lt;code&gt;
&lt;cfsetting enablecfoutputonly=&quot;true&quot;&gt;
&lt;cfcontent  reset=&quot;true&quot; type=&quot;text/xml&quot;&gt;
&lt;cfparam name=&quot;url.method&quot; default=&quot;&quot;&gt;
&lt;cfswitch expression=&quot;#url.method#&quot;&gt;
	&lt;cfcase value=&quot;hello&quot;&gt;
		&lt;cfset oSS = createObject(&quot;component&quot;,&quot;soapservice&quot;)&gt;
		&lt;cfoutput&gt;&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;str&gt;#oSS.hello()#&lt;/str&gt;&lt;/cfoutput&gt;
	&lt;/cfcase&gt;
	&lt;cfdefaultcase&gt;
		&lt;cfoutput&gt;&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;str&gt;Unknown Method&lt;/str&gt;&lt;/cfoutput&gt;
	&lt;/cfdefaultcase&gt;
&lt;/cfswitch&gt;
&lt;/code&gt;

So this version now uses a REST type request but leverages the CFC code for the functionality of &quot;hello world&quot;.

This was not quite as good performance as the pure CFM code with only 3 to 4 times the performance of the SOAP version - but still not bad at all.


&lt;h2&gt;Test 3: SOAP CFC vs REST CFM with CFC with caching&lt;/h2&gt;

One thing that is known to be reasonably costly in CF is the instantiation of CFC objects.  A typical way to avoid this is to instantiate the objects once and then store them in the persistent application scope.  This technique will work for lots of the code I am looking to optimise so I wanted to see how much impact it would have.



&lt;h3&gt;xmlservicewithcfccached.cfm:&lt;/h3&gt;
&lt;code&gt;
&lt;cfsetting enablecfoutputonly=&quot;true&quot;&gt;
&lt;cfcontent  reset=&quot;true&quot; type=&quot;text/xml&quot;&gt;

&lt;cfapplication name=&quot;xmlservicewithcfcached&quot; sessionmanagement=&quot;false&quot; clientmanagement=&quot;false&quot;&gt;

&lt;cfparam name=&quot;url.method&quot; default=&quot;&quot;&gt;
&lt;cfswitch expression=&quot;#url.method#&quot;&gt;
	&lt;cfcase value=&quot;hello&quot;&gt;	
		&lt;cfif NOT structKeyExists(application,&apos;oSS&apos;)&gt;
			&lt;cfset application.oSS = createObject(&quot;component&quot;,&quot;soapservice&quot;)&gt;
		&lt;/cfif&gt;
		&lt;cfoutput&gt;&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;str&gt;#application.oSS.hello()#&lt;/str&gt;&lt;/cfoutput&gt;
	&lt;/cfcase&gt;
	&lt;cfdefaultcase&gt;
		&lt;cfoutput&gt;&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;str&gt;Unknown Method&lt;/str&gt;&lt;/cfoutput&gt;
	&lt;/cfdefaultcase&gt;
&lt;/cfswitch&gt;
&lt;/code&gt;

The performance of this version of the code was almost identical to the 1st version - i.e. 4 to 5 times faster than using the SOAP version but it more easily maintainable.

&lt;h2&gt;Is this a valid benchmark?&lt;/h2&gt;

In a word no - in the strict sense of a reproducible benchmark. It was done on my development laptop as I don&apos;t have lots of spare machines lying around.  

The specs of the machine are as follows:
&lt;ul&gt;
&lt;li&gt;Intel Core 2 Duo T7200 @ 2GHz&lt;/li&gt;
&lt;li&gt;3GB Ram&lt;/li&gt;
&lt;li&gt;Ubuntu 7.10 (gutsy) with standard 2.6.22-14-generic kernel&lt;/li&gt;
&lt;li&gt;Coldfusion 7.0.2 - Multiserver install - default config&lt;/li&gt;
&lt;li&gt;Apache JMeter 2.3.1 for load testing&lt;/li&gt;
&lt;/ul&gt;

Each thread in the tests ran 10,000 loops - so for example the tests where I ran 50 threads would be 10,000 x 50 = 500,000 requests.

The entire test was conducted over the course of one day and there were no reboots during the tests.  Mostly the same programs were running but it was connected to the internet so minor variations in load and traffic could have affected the results.

&lt;h2&gt;What about CF8?&lt;/h2&gt;
After I finished the testing on CF7 (which is what we currently have on our Production servers) I tried it out on the CF8 Install to see how it compared - the details are detailed below.

&lt;h2&gt;Show me the stats&lt;/h2&gt;

So here are the pretty stats and charts that I created to understand all the data:

&lt;h3&gt;Graph 1:&lt;/h3&gt;
&lt;img src=&quot;http://www.lynchconsulting.com.au/blog/enclosures/cf_soap_vs_rest_performance.png&quot;&gt;

&lt;h3&gt;Table 1 - figures for Graph 1:&lt;/h3&gt;
&lt;img src=&quot;http://www.lynchconsulting.com.au/blog/enclosures/cf_soap_vs_rest_table.png&quot;&gt;



&lt;h3&gt;Graph 2:&lt;/h3&gt;
&lt;img src=&quot;http://www.lynchconsulting.com.au/blog/enclosures/cf7_vs_cf8_soap_vs_rest.png&quot;&gt;


&lt;h3&gt;Table 2 - figures for Graph 2:&lt;/h3&gt;
&lt;img src=&quot;http://www.lynchconsulting.com.au/blog/enclosures/cf7_vs_cf8_table.png&quot;&gt;

&lt;h3&gt;Need more stats?&lt;/h3&gt;

I have also uploaded the spreadsheet that I created to generate these stats in the original OpenDocument format and also as an Excel file.
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.lynchconsulting.com.au/blog/enclosures/soap_vs_rest.ods&quot;&gt;Soap vs rest stats (OpenOffice format - 35KB)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.lynchconsulting.com.au/blog/enclosures/soap_vs_rest.xls&quot;&gt;Soap vs rest stats (Excel format - 110KB)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

For me - I&apos;ll be definitely looking at using the REST methods further on any high traffic sites where I might previously have used SOAP.  

&lt;h3&gt;What are we gaining&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Lots of performance - a 5 fold performance increase can&apos;t be ignored.&lt;/li&gt;
&lt;li&gt;Smaller data being transferred as no SOAP envelope overhead&lt;/li&gt;
&lt;li&gt;More control over data transferred&lt;/li&gt;
&lt;li&gt;Ability to use conventional debugging and caching techniques&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;What are we giving up&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Automatic handling of complex objects&lt;/li&gt;
&lt;li&gt;Lots of overhead&lt;/li&gt;
&lt;/ul&gt;

I&apos;d love to hear your thoughts on this - what else am I giving up?

Cheers,
Mark
				
				</description>
				
				<category>Software Architecture</category>
				
				<category>Flex</category>
				
				<category>ColdFusion</category>
				
				<category>AIR</category>
				
				<category>Actionscript</category>
				
				<pubDate>Thu, 13 Mar 2008 20:40:00 --1000</pubDate>
				<guid>http://www.lynchconsulting.com.au/blog/index.cfm/2008/3/13/CFMX--SOAP-vs-REST-benchmarks</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Pretty network diagrams and flow charts with Open Source software.</title>
				<link>http://www.lynchconsulting.com.au/blog/index.cfm/2008/2/13/Pretty-network-diagrams-and-flow-charts-with-Open-Source-software</link>
				<description>
				
				I had been using &lt;a href=&quot;http://www.gnome.org/projects/dia/&quot;&gt;Dia&lt;/a&gt; for all my charts and diagrams, and it does a very good job.  The only downside is that it doesn&apos;t produce very pretty charts of the like of &lt;a href=&quot;http://www.omnigroup.com/applications/omnigraffle/&quot;&gt;Omnigraffle&lt;/a&gt;.

However, &lt;a href=&quot;http://www.ioncannon.net/utilities/123/10-tips-for-creating-good-looking-diagrams-using-inkscape/&quot;&gt;inspired by this article&lt;/a&gt;, I&apos;m starting to use a new solution, &lt;a href=&quot;http://www.inkscape.org/&quot;&gt;Inkscape&lt;/a&gt;, that fulfills my criteria that works on Linux, Mac and Windows.


&lt;table border=&quot;1&quot;&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;&lt;a href=&quot;http://www.gnome.org/projects/dia/&quot;&gt;Dia&lt;/a&gt;&lt;/th&gt;
&lt;th&gt;&lt;a href=&quot;http://www.omnigroup.com/applications/omnigraffle/&quot;&gt;Omnigraffle&lt;/a&gt;&lt;/th&gt;
&lt;th&gt;&lt;a href=&quot;http://www.inkscape.org/&quot;&gt;Inkscape&lt;/a&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Can create pretty pictures&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cross Platform (Linux, Mac, Windows)&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No - Mac only&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Open Source&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Open file format (to work with version control)&lt;/td&gt;
&lt;td&gt;No - Binary&lt;/td&gt;
&lt;td&gt;No - Binary&lt;/td&gt;
&lt;td&gt;Yes - SVG&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Export to PNG&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;

Now you may argue that Inkscape is not a diagraming tool but a generic drawing tool.  This is true, but with the addition of a few templates of pre-drawn items it become a very good diagramming tool.

I&apos;ve created a few simple flow chart elements which I use and also scoured the net for some SVG icons for network based diagrams which were sourced from &lt;a href=&quot;http://packages.ubuntu.com/gutsy/gnome/gnome-icon-theme&quot;&gt;Gnome (via Ubuntu)&lt;/a&gt; and from &lt;a href=&quot;http://www.quantum-bits.org/?p=57&quot;&gt;Quantum Bits&lt;/a&gt;.

&lt;h3&gt;Templates Previews&lt;/h3&gt;


&lt;img src=&quot;http://www.lynchconsulting.com.au/blog/enclosures/Diagram-Template.png&quot;
alt=&quot;Flow chart diagram preview&quot;  style=&quot;float:left&quot;&gt;

&lt;img src=&quot;http://www.lynchconsulting.com.au/blog/enclosures/Device-Template.png&quot;
alt=&quot;Computing devices preview&quot; style=&quot;float:left&quot;&gt;


&lt;h3 style=&quot;clear:left&quot;&gt;Download&lt;/h3&gt;
Download the svg templates (right click - Save As):
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.lynchconsulting.com.au/blog/enclosures/Diagram-Template.svg&quot;&gt;Flowchart  Template (SVG) (10k)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.lynchconsulting.com.au/blog/enclosures/Device-Template.svg&quot;&gt;Network Devices Template (SVG) (1.6M)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

Give it a try - it&apos;s very easy.
				
				</description>
				
				<category>Windows</category>
				
				<category>Ubuntu</category>
				
				<category>Software Architecture</category>
				
				<category>Open Source</category>
				
				<category>Mac OSX</category>
				
				<category>Linux</category>
				
				<pubDate>Wed, 13 Feb 2008 07:31:00 --1000</pubDate>
				<guid>http://www.lynchconsulting.com.au/blog/index.cfm/2008/2/13/Pretty-network-diagrams-and-flow-charts-with-Open-Source-software</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>JMeter load testing - Regex problem solved</title>
				<link>http://www.lynchconsulting.com.au/blog/index.cfm/2007/10/9/JMeter-load-testing--Regex-problem-solved</link>
				<description>
				
				I&apos;ve been having fun playing with JMeter to do some load testing on some of our applications recently and I came across this problem which had me stumped.  Eventually my friendly sysadmins put me out of my misery.  So to prevent other people from the same issues - here is the problem and the solution.

&lt;img src=&quot;http://www.lynchconsulting.com.au/blog/enclosures/jmeter-bad.png&quot; align=&quot;right&quot; alt=&quot;Jmeter screenshot - not working&quot; /&gt;

&lt;a href=&quot;http://jakarta.apache.org/jmeter/&quot;&gt;JMeter is a great load testing application&lt;/a&gt; but it can be a bit tricky to when you are learning it.

For the particular testing I needed to get it to do the following:
&lt;ul&gt;
&lt;li&gt;Login in as a user&lt;/li&gt;
&lt;li&gt;Retrieve the valid userid&lt;/li&gt;
&lt;li&gt;Create a new test for the user&lt;/li&gt;
&lt;li&gt;Get the testid back&lt;/li&gt;
&lt;li&gt;Load the test details&lt;/li&gt;
&lt;li&gt;Submit the test&lt;/li&gt;
&lt;/ul&gt;

I pretty quickly got everything working with some regex&apos;s to extract the userid and testid as required and my test case looked like the picture above.

Everything was working except the final submission of the test, which was failing as the regex variable was always using the default value, despite the fact that is was working for the previous step.

&lt;img src=&quot;http://www.lynchconsulting.com.au/blog/enclosures/jmeter-good.png&quot; align=&quot;right&quot; alt=&quot;Jmeter screenshot - working!!&quot; /&gt;

It turns out that the regex needed to be nested inside the request it was referring to or it would be called after every request, which in most cases would return the default value as the regex wouldn&apos;t match.

Once I put the regex&apos;s inside the requests the were not constantly being reset and everything worked a treat.

Hope it helps.

Mark
				
				</description>
				
				<category>ColdFusion</category>
				
				<category>Java</category>
				
				<category>Open Source</category>
				
				<category>Software Architecture</category>
				
				<category>Systems admin</category>
				
				<pubDate>Tue, 09 Oct 2007 08:19:00 --1000</pubDate>
				<guid>http://www.lynchconsulting.com.au/blog/index.cfm/2007/10/9/JMeter-load-testing--Regex-problem-solved</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Cairngorm for CF developer series by Joe Rinehart</title>
				<link>http://www.lynchconsulting.com.au/blog/index.cfm/2007/7/4/Cairngorm-for-CF-developer-series-by-Joe-Rinehart</link>
				<description>
				
				I just came across this series of posts, which is very helpful for CF people getting started with Flex and CairnGorm.

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.firemoss.com/blog/index.cfm?mode=entry&amp;entry=BB4775B4-3048-55C9-43F43353AEA85A39&quot;&gt;Cairngorm for ColdFusion/MG Developers (Part 1)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.firemoss.com/blog/index.cfm?mode=entry&amp;entry=C0994A6D-3048-55C9-43A0DFDAA3E55478&quot;&gt;Cairngorm for ColdFusion/MG Developers (Part 2, Model Locator)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.firemoss.com/blog/index.cfm?mode=entry&amp;entry=5979D458-3048-55C9-435231FE55116562&quot;&gt;Cairngorm for MG/ColdFusion Developers (Part 3, getInstance)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.firemoss.com/blog/index.cfm?mode=entry&amp;entry=724F0E5B-3048-55C9-4395B7CA2FE887DC&quot;&gt;Cairngorm for MG/ColdFusion Developers (Part 4, Value Objects)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.firemoss.com/blog/index.cfm?mode=entry&amp;entry=7C39CA5F-3048-55C9-436CB7AA35ADE072&quot;&gt;Cairngorm for MG/ColdFusion Developers (Part 5, Commands and Events)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

The other really good reference for people starting with Flex is the series of articles from Steven Webster.  These articles refer to earlier versions of Cairngorm but all the core concepts are very well explained.

&lt;ul&gt;&lt;li&gt; &lt;a href=&quot;http://www.adobe.com/devnet/flex/articles/cairngorm_pt1.html&quot;&gt;Part I - Introducing Cairngorm&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.adobe.com/devnet/flex/articles/cairngorm_pt2.html&quot;&gt;Part II - Keeping State on the Client&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.adobe.com/devnet/flex/articles/cairngorm_pt3.html&quot;&gt;Part III - Architecting the View&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.adobe.com/devnet/flex/articles/cairngorm_pt4.html&quot;&gt;Part IV - Feature-driven Development&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.adobe.com/devnet/flex/articles/cairngorm_pt5.html&quot;&gt;Part V - Server-side Integration&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.adobe.com/devnet/flex/articles/cairngorm_pt6.html&quot;&gt;Part VI - Rapid and Consistent Development with Cairngorm and Flex&lt;/a&gt;
&lt;/li&gt;&lt;/ul&gt;

Cheers,
Mark
				
				</description>
				
				<category>Software Architecture</category>
				
				<category>Flex</category>
				
				<category>ColdFusion</category>
				
				<pubDate>Wed, 04 Jul 2007 09:51:00 --1000</pubDate>
				<guid>http://www.lynchconsulting.com.au/blog/index.cfm/2007/7/4/Cairngorm-for-CF-developer-series-by-Joe-Rinehart</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>MemCached Client for CFMX - alpha version</title>
				<link>http://www.lynchconsulting.com.au/blog/index.cfm/2007/5/2/MemCached-Client-for-CFMX--alpha-version</link>
				<description>
				
				I&apos;ve been looking at using &lt;a href=&quot;http://www.danga.com/memcached/&quot;&gt;memcached&lt;/a&gt; in order to speed up a few sites that I&apos;ve been working on.

&lt;h3&gt;What does it do?&lt;/h3&gt;
Memcached is basically a large RAM cache that is distributed across a network and can be shared between many machines.  Many CF applications use the application scope to cache information - including the &lt;a href=&quot;http://www.bpurcell.org/blog/index.cfm?entry=963&amp;mode=entry&quot;&gt;wonderful CF_Accelerate tag&lt;/a&gt;.  This works great for single servers (and instances) but once you need to scale beyond this you end up with each server having duplicate copies of the cached data.

Memcache gives you a central place to store this info and allows you to move it out of the ColdFusion memory space which uses as much memory on the network as you have available.  Plenty &lt;a href=&quot;http://www.danga.com/memcached/&quot;&gt;more info on the memcache site.&lt;/a&gt;


&lt;h3&gt;How do I use it?&lt;/h3&gt;
Install memcached on a machine (using apt on ubuntu is the following)
&lt;code&gt;
sudo apt-get install memcached
&lt;/code&gt;
Then run it (the -vv gives extra debugging info):
&lt;code&gt;
memcached -vv
&lt;/code&gt;

&lt;a href=&quot;http://www.whalin.com/memcached/#download&quot;&gt;Download the java api for memcached&lt;/a&gt; (for CF7 you need the 1.3.2 version unless you have upgraded your VM)

Copy it into the lib folder for CF and restart CF eg:
&lt;code&gt;
sudo cp java_memcached-release_1.3.2.jar /opt/jrun/lib
&lt;/code&gt;


Get the CFC:
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://developer.lynchconsulting.com.au/svn/opensource/lc_cflib/trunk/cfc/utility/MemCached.cfc&quot;&gt;Download the MemCached.cfc from SVN&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;It can also &lt;a href=&quot;http://developer.lynchconsulting.com.au/trac/opensource/lc_cflib/browser/trunk/cfc/utility/MemCached.cfc&quot;&gt;view in the friendlier trac&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;



Then try the following test code:
&lt;code&gt;
&lt;cfscript&gt;
	oMemCached = createObject(&quot;component&quot;,&quot;MemCached&quot;).getPoolInstance();
	oMemCached.shutdown();
	
	//List of server:ports to use

	serverList = &apos;127.0.0.1:11211&apos;;
	
	//Create a new memcached object - this could be stored in application
	
	oMemCached = createObject(&quot;component&quot;,&quot;MemCached&quot;).init(serverList=serverList);
		
	//Create some data to store
	
	aTemp = ArrayNew(1);
	aTemp[1] = &apos;34343&apos;;
	aTemp[2] = &apos;134343&apos;;
	aTemp[3] = &apos;234343&apos;;
	aTemp[4] = &apos;334343&apos;;
	aTemp[5] = &apos;434343&apos;;

	//Save to keys (one add and one set)

	oMemCached.add(&apos;key&apos;,aTemp);
	oMemCached.set(&apos;key2&apos;,aTemp);		
&lt;/cfscript&gt;

&lt;!--- Output the data from cache ---&gt;
&lt;cfdump var=&quot;#oMemCached.get(&apos;key&apos;)#&quot;&gt;
&lt;cfdump var=&quot;#oMemCached.get(&apos;key2&apos;)#&quot;&gt;

&lt;/code&gt;

The cfc is not production ready - but is working in some basic tests.  One area that is not working (as far as I can tell) is the failover of servers.

Have a play, and all comments welcome.
				
				</description>
				
				<category>Software Architecture</category>
				
				<category>Open Source</category>
				
				<category>Linux</category>
				
				<category>Java</category>
				
				<category>ColdFusion</category>
				
				<pubDate>Wed, 02 May 2007 07:10:00 --1000</pubDate>
				<guid>http://www.lynchconsulting.com.au/blog/index.cfm/2007/5/2/MemCached-Client-for-CFMX--alpha-version</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>OO Part 1: From code libraries to instances</title>
				<link>http://www.lynchconsulting.com.au/blog/index.cfm/2007/1/15/OO-Part-1-From-code-libraries-to-instances</link>
				<description>
				
				&lt;h3&gt;Code libraries&lt;/h3&gt;
When people first start using CFC&apos;s they often use them as a handy way to group related functions together. For example, if you could put all the functions that deal with users into the same cfc and you may have something like the following pseudocode:
&lt;code&gt;
User.cfc
 function getUserName(id)
 function getFirstName(id)
 function getLastName(id)
 function authenticate(username,password)
 function getAllUsers()
 function getUserCount()
 function createUser(username,password,firstname,lastname)
 function updateUser(id,username,password,firstname,lastname)
&lt;/code&gt;

While this is a useful and valid way to use CFC&apos;s it isn&apos;t using them to their full potential.  

&lt;h3&gt;Dealing with a single user&lt;/h3&gt;

When working in object oriented way we try to discern what the different objects in a system would be.  In this case User would be an object - and the user would know certain things about itself (name, username, password, date created) and just as importantly it would not know certain things (eg: total number of users in system)

&lt;code&gt;
User.cfc
 var id  //We store the user id in the cfc

 function init(id)
 function getUserName() //id is not required as it is already in the instance
 function getFirstName() 
 function getLastName()
 function updateUser(username,password,firstname,lastname) //also no id required here
&lt;/code&gt;

This &quot;instance&quot; of a user gives us access to all the properties that a user knows about but shields us from many of the functions that are not relevant.

We now have a user that we can easily conceptualise and work with without having all of the other methods such as getAllUsers() or getUserCount() getting in our way.  It also allows a team of programmers to have a set of guidelines as to where code should live.  If it deals with a single user it will be in the user CFC

&lt;h3&gt;But how do we create a new user&lt;/h3&gt;
You&apos;ll notice that the above code has no way of creating a user - this is because it doesn&apos;t make sense for a user to be able to create another user (we&apos;re not talking about giving birth here).  So how do we create a user.

We need a place to put the create user method that is outside of the User.cfc - and I have typically used something like UserManager.cfc.

UserManager is also responsible for all functions that deal with more than one user.

&lt;code&gt;
UserManager.cfc
 function authenticate(username,password)  // We don&apos;t have a valid user at this point
 
 function getAllUsers()
 function getUserCount()
 function createUser(username,password,firstname,lastname)
&lt;/code&gt;


This works really well in that there is now a logical place to put all of the code relating to Users and if all the people working on the application know where things should go.

&lt;h3&gt;Two CFC&apos;s for each object type?&lt;/h3&gt;
However having two CFC&apos;s for each object type can get really messy, espcially when you are drawing Class diagrams.  The java solution to this lies in the use of Static methods.

Static methods (or Class methods) are functions that are available on the Class as opposed to the Instance - i.e. when we are dealing with the concept of Users as opposed to a specific user Steve Bennett who works on level 5.

So now we are back to having the following:
&lt;code&gt;
User.cfc
 var id
// static methods

 function authenticate(username,password)
 function getAllUsers()
 function getUserCount()
 function createUser(username,password,firstname,lastname)
 function init(id)

//Instance methods

 function getUserName() //id is not required as it is already in the instance

 function getFirstName() 
 function getLastName()
 function updateUser(username,password,firstname,lastname) //also no id required here
&lt;/code&gt;


But aren&apos;t we back where we started with everything jumbled together?  Not really, we now have a obvious set methods that deal with a single instance and another set that deal with multiple users. 

In this example you only have half the number of methods to look through when you are dealing with a specific user (i.e. all the instance methods) and the same when you are dealing with multiple users.

&lt;h3&gt;Enforcing it in ColdFusion&lt;/h3&gt;

However Coldfusion doesn&apos;t naturally handle the differentiation of Static methods from Instance methods - however with a bit of ingenuity (aka hackery) we can enforce it in our CFC&apos;s.  I&apos;ve got a working prototype of this and I&apos;ll post some more on it shortly.


&lt;h3&gt;Further reading&lt;/h3&gt;
If you are interested in getting more aquainted with Object Oriented design I&apos;ve found the following books very helpful:
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.com%2FHead-First-Object-Oriented-Analysis-Design%2Fdp%2F0596008678%2Fsr%3D8-1%2Fqid%3D1168245207%3Fie%3DUTF8%26s%3Dbooks&amp;tag=lynchconsu-20&amp;linkCode=ur2&amp;camp=1789&amp;creative=9325&quot;&gt;Head First Object-Oriented Analysis &amp; Design&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=lynchconsu-20&amp;amp;l=ur2&amp;amp;o=1&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important;&quot; /&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.com%2FHead-First-Design-Patterns%2Fdp%2F0596007124%2Fsr%3D8-2%2Fqid%3D1168245207%3Fie%3DUTF8%26s%3Dbooks&amp;tag=lynchconsu-20&amp;linkCode=ur2&amp;camp=1789&amp;creative=9325&quot;&gt;Head First Design Patterns&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=lynchconsu-20&amp;amp;l=ur2&amp;amp;o=1&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important;&quot; /&gt;&lt;/li&gt;
&lt;/ul&gt;
				
				</description>
				
				<category>Software Architecture</category>
				
				<category>Java</category>
				
				<category>ColdFusion</category>
				
				<pubDate>Mon, 15 Jan 2007 05:49:00 --1000</pubDate>
				<guid>http://www.lynchconsulting.com.au/blog/index.cfm/2007/1/15/OO-Part-1-From-code-libraries-to-instances</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>CFC Component Instantiation overhead and dependencies</title>
				<link>http://www.lynchconsulting.com.au/blog/index.cfm/2006/9/15/Component-Instantiation-Overhead-and-dependiencies</link>
				<description>
				
				I&apos;ve been working on a ColdFusion application that makes really heavy use of application cached CFC components which are all inited in the application.cfc.  This makes for a very high performance application and the components currently have inter-relations based on the fact that each component knows that any dependencies will be available in the application scope.

This works well for the main application where performance is the critical measure, however it is not very flexible when it comes to creating an admin application that used the same core libraries but where having each component cached in the application is wasteful of resource.

I&apos;m currently exploring to see if it&apos;s possible to get the best of both worlds:
&lt;ul&gt;
&lt;li&gt;Runtime dependency handling (guaranteeing that components dependencies are available)&lt;/li&gt;
&lt;li&gt;Caching components to ensure we don&apos;t have the overhead of instantiating them multiple times.&lt;/li&gt;
&lt;/ul&gt;

To discover the what the overhead of instantiating a component is I ran the following tests.

&lt;table&gt;
&lt;caption&gt;10000 iterations&lt;/caption&gt;
&lt;tr&gt;
&lt;th&gt;Large component (45 functions)&lt;/th&gt;&lt;th&gt;T1&lt;/th&gt;&lt;th&gt;T2&lt;/th&gt;&lt;th&gt;T3&lt;/th&gt;&lt;th&gt;Average&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th&gt;Create component each time&lt;/th&gt;&lt;td&gt;17438&lt;/td&gt;&lt;td&gt;11766&lt;/td&gt;&lt;td&gt;12010&lt;/td&gt;&lt;td&gt;13738&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th&gt;Re use component&lt;/th&gt;&lt;td&gt;6952&lt;/td&gt;&lt;td&gt;7240&lt;/td&gt;&lt;td&gt;8440&lt;/td&gt;&lt;td&gt;7544&lt;/td&gt;
&lt;/tr&gt;


&lt;tr&gt;
&lt;th&gt;Small component (1 functions)&lt;/th&gt;&lt;th&gt;T1&lt;/th&gt;&lt;th&gt;T2&lt;/th&gt;&lt;th&gt;T3&lt;/th&gt;&lt;th&gt;Average&lt;/th&gt;
&lt;/tr&gt;
&lt;th&gt;Create component each time&lt;/th&gt;&lt;td&gt;9059&lt;/td&gt;&lt;td&gt;9557&lt;/td&gt;&lt;td&gt;8644&lt;/td&gt;&lt;td&gt;9087&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th&gt;Re use component&lt;/th&gt;&lt;td&gt;5950&lt;/td&gt;&lt;td&gt;7238&lt;/td&gt;&lt;td&gt;5873&lt;/td&gt;&lt;td&gt;6354&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;

 				
&lt;h3&gt;What do these numbers mean?&lt;/h3&gt;

For a large component up to 45%	of the time was spent creating instances	

For the small component 30% of the time was spent creating instances	

What this shows is that it is definitely worth minimising component instantiation in performance critical applications, as between 30 - 45% of time could be spend instantiating the component (if it not reused).

Stay tuned for a solution to instantiating and caching components.
				
				</description>
				
				<category>Software Architecture</category>
				
				<category>ColdFusion</category>
				
				<pubDate>Fri, 15 Sep 2006 07:10:00 --1000</pubDate>
				<guid>http://www.lynchconsulting.com.au/blog/index.cfm/2006/9/15/Component-Instantiation-Overhead-and-dependiencies</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Who what when of cfc&apos;s, custom tags and cfincludes</title>
				<link>http://www.lynchconsulting.com.au/blog/index.cfm/2006/8/31/Who-what-when-of-cfcs-custom-tags-and-cfincludes</link>
				<description>
				
				There are a lot of ways to reuse code in coldfusion, to the point that for new people it is becoming more difficult to understand where it is appropriate to use the different techniques.  There are CFC&apos;s, Custom tags, cfimported custom tags, includes and UDFs.

I&apos;ve developed these rough guidelines over the past few years:
				 [More]
				</description>
				
				<category>Software Architecture</category>
				
				<category>ColdFusion</category>
				
				<pubDate>Thu, 31 Aug 2006 16:16:00 --1000</pubDate>
				<guid>http://www.lynchconsulting.com.au/blog/index.cfm/2006/8/31/Who-what-when-of-cfcs-custom-tags-and-cfincludes</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Object Orientation for CF Developers</title>
				<link>http://www.lynchconsulting.com.au/blog/index.cfm/2006/8/28/Object-Orientation-for-CF-Developers</link>
				<description>
				
				&lt;h3&gt;Why?&lt;/h3&gt;
&lt;p&gt;Why is Object Oriented code worth learning:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;reliability - possible to test each component&lt;/li&gt;
&lt;li&gt;maintenance - it is easy to know where things should be&lt;/li&gt;
&lt;li&gt;encapsulation - knowing where the hard bits are&lt;/li&gt;
&lt;li&gt;reuse - all code is in libraries not pages of your site&lt;/li&gt;
&lt;/ul&gt;
				 [More]
				</description>
				
				<category>ColdFusion</category>
				
				<category>Software Architecture</category>
				
				<pubDate>Mon, 28 Aug 2006 16:22:00 --1000</pubDate>
				<guid>http://www.lynchconsulting.com.au/blog/index.cfm/2006/8/28/Object-Orientation-for-CF-Developers</guid>
				
			</item>
			
		 	
			</channel></rss>