<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><!-- generator="wordpress/2.3.1" --><rss 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/" version="2.0">

<channel>
	<title>Rajith's Column</title>
	<link>http://rajith.2rlabs.com</link>
	<description>Freeman, Hacker, Artist</description>
	<pubDate>Fri, 07 Nov 2008 22:48:08 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/rajith" type="application/rss+xml" /><item>
		<title>Microsoft joining Apache Qpid and the AMQP working group</title>
		<link>http://rajith.2rlabs.com/2008/11/07/microsoft-joining-apache-qpid-and-the-amqp-working-group/</link>
		<comments>http://rajith.2rlabs.com/2008/11/07/microsoft-joining-apache-qpid-and-the-amqp-working-group/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 22:42:03 +0000</pubDate>
		<dc:creator>rajith</dc:creator>
		
		<category><![CDATA[AMQP]]></category>

		<category><![CDATA[Open Source]]></category>

		<category><![CDATA[Qpid]]></category>

		<guid isPermaLink="false">http://rajith.2rlabs.com/2008/11/07/microsoft-joining-apache-qpid-and-the-amqp-working-group/</guid>
		<description><![CDATA[I guess by now many have heard that Microsoft is joining the Apache Qpid project and the AMQP Working Group. Sam Ramji mentioned this during his key note at the Apache Con US 2008. This is indeed great news for both the AMQP working group as well as the Apache Qpid community.
One of the engineers [...]]]></description>
			<content:encoded><![CDATA[<p>I guess by now many have heard that Microsoft is joining the <a href="http://cwiki.apache.org/qpid/index.html">Apache Qpid project</a> and the <a href="http://www.amqp.org">AMQP Working Group</a>. <a href="http://apacheconus2008.crowdvine.com/talks/show/2775">Sam Ramji</a> mentioned this during his key note at the <a href="http://www.us.apachecon.com/c/acus2008/">Apache Con US 2008</a>. This is indeed great news for both the AMQP working group as well as the Apache Qpid community.</p>
<p>One of the engineers from Microsoft <a href="http://port25.technet.com/members/anandeep.aspx">Anandeep Pannu</a>, has <a href="http://port25.technet.com/archive/2008/11/07/finally-dive-into-the-deep-participation.aspx">written very excitedly</a> about participating in Qpid. </p>
<p>In July Sam Ramji <a href="http://port25.technet.com/archive/2008/07/25/oscon2008.aspx">announced a sponsorship</a> for the Apache Software Foundation. It kind of signaled about their intent to get their feet wet with playing an active role in open source. It seems that most large vendors have realized the importance of participating and promoting open source on one hand and also harnessing the power of open source on the other hand. IBM for instance played this strategy very well over the last decade or so. This is very good PR for the Qpid project and hopefully attract more participants and end users to the project. Definitely looking forward to working them in Qpid and the AMQP working group.</p>
]]></content:encoded>
			<wfw:commentRss>http://rajith.2rlabs.com/2008/11/07/microsoft-joining-apache-qpid-and-the-amqp-working-group/feed/</wfw:commentRss>
		</item>
		<item>
		<title>AMQP in 10 mins - update</title>
		<link>http://rajith.2rlabs.com/2008/11/07/amqp-in-10-mins-update/</link>
		<comments>http://rajith.2rlabs.com/2008/11/07/amqp-in-10-mins-update/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 16:32:17 +0000</pubDate>
		<dc:creator>rajith</dc:creator>
		
		<category><![CDATA[AMQP]]></category>

		<guid isPermaLink="false">http://rajith.2rlabs.com/2008/11/07/amqp-in-10-mins-update/</guid>
		<description><![CDATA[A lot of folks have asked me as to why I have not written the next part in the series after Oct,2007. So I think I owe an explanation.
I guess I started the series a bit early, and at that time the protocol was going through a phase of rapid changes. So I decided to [...]]]></description>
			<content:encoded><![CDATA[<p>A lot of folks have asked me as to why I have not written the next part in the series after Oct,2007. So I think I owe an explanation.<br />
I guess I started the series a bit early, and at that time the protocol was going through a phase of rapid changes. So I decided to wait until the dust has settled, as there is no point in writing about something that may change within a short time. However it took the working group a bit longer than expected to thrash out the 0-10 version.<br />
Now the AMQP working group is working towards a 1.0 release. So I think it would be worthwhile to wait until we have firmed up the 1.0 spec as it makes sense to write about a final 1.0 release than an interim version. I don&#8217;t expect a lot to change between 0-10 and 1.0, and most changes would be to remove certain unnecessary complexity in the 0-10 version and also to incorporate any feedback from the folks who worked on implementing the 0-10 version.</p>
]]></content:encoded>
			<wfw:commentRss>http://rajith.2rlabs.com/2008/11/07/amqp-in-10-mins-update/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Gartner Hype Cycle</title>
		<link>http://rajith.2rlabs.com/2008/10/21/gartner-hype-cycle/</link>
		<comments>http://rajith.2rlabs.com/2008/10/21/gartner-hype-cycle/#comments</comments>
		<pubDate>Tue, 21 Oct 2008 14:08:35 +0000</pubDate>
		<dc:creator>rajith</dc:creator>
		
		<category><![CDATA[cartoon]]></category>

		<guid isPermaLink="false">http://rajith.2rlabs.com/2008/10/21/gartner-hype-cycle/</guid>
		<description><![CDATA[

Art work is licensed under Creative Commons Attribution-NonCommercial 2.5 License.
]]></description>
			<content:encoded><![CDATA[<p><img width="550" height="504" src='http://2rlabs.com/rajith/blog/wp-content/uploads/2008/10/gartner_hype_cycle_cartooon.jpg'' alt='Gartner Hype Cycle' /><br />
<br />
Art work is licensed under <a href="http://creativecommons.org/licenses/by-nc/2.5/">Creative Commons Attribution-NonCommercial 2.5 License</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://rajith.2rlabs.com/2008/10/21/gartner-hype-cycle/feed/</wfw:commentRss>
		</item>
		<item>
		<title>5 reasons why Distributed Systems are hard to program</title>
		<link>http://rajith.2rlabs.com/2008/07/23/5-reasons-why-distributed-systems-are-hard-to-develop/</link>
		<comments>http://rajith.2rlabs.com/2008/07/23/5-reasons-why-distributed-systems-are-hard-to-develop/#comments</comments>
		<pubDate>Wed, 23 Jul 2008 21:14:58 +0000</pubDate>
		<dc:creator>rajith</dc:creator>
		
		<category><![CDATA[Architecture]]></category>

		<category><![CDATA[Distributed Systems]]></category>

		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://rajith.2rlabs.com/2008/07/23/5-reasons-why-distributed-systems-are-hard-to-develop/</guid>
		<description><![CDATA[Here are 5 reasons why I found distributed system are hard to program. This is not some sort of thorough analysis, but merely my observations in dealing with such systems. For completeness, here is the definition of &#8220;Distributed System&#8221; I used.
A distributed system contains of more than one process that runs as a single system. [...]]]></description>
			<content:encoded><![CDATA[<p>Here are 5 reasons why I found distributed system are hard to program. This is not some sort of thorough analysis, but merely my observations in dealing with such systems. For completeness, here is the definition of &#8220;Distributed System&#8221; I used.<br />
<em>A distributed system contains of more than one process that runs as a single system. These processes can be on the same computer or multiple computers that are on a local area network or geographically distributed over a wide area network.</em></p>
<p>Without any further do here are the reasons in no particular order.</p>
<p>
<strong>1. Difficulty in identifying and dealing with failures.</strong><br />
When communicating between processes failures can happen at many levels. Dealing with them is not trivial. Of course you rely on frameworks based on technologies like RMI, CORBA, COM, SOAP, AMQP, REST(is an architectural style not a standard) etc to handle these. But the fact remains that you still need to clearly think about these cases and handle these situations properly.</p>
<p>For example if we consider a simple interaction between two processes on different computers, the following failures can happen.</p>
<ul>
<li>Failures that occur within the process that initiates the communication (sending the message or invoking the RPC call). </li>
<li>Failures between the time the process hands over the request to the OS and the OS writing it to the network.</li>
<li>Network failures between the time it takes to transmit the packets from one computer to the other.</li>
<li>Failures between the time the OS on the receiving end receives the packets and then handing it over to the  recipient process.</li>
<li>Failures that occur when the recipient process tried to <em>process</em> the request/message. </li>
</ul>
<p>Sometimes the framework you use, is unable to/may not report all these error cases. Sometimes when the error is reported, it may not contain enough information to figure out at which level the error occurred.<br />
<em>Did it reach the remote computer? if so how far up the stack did it go?. If the receiving process got the request or message did the error occur before or after the request/message was processed?</em><br />
In some cases where idempotency is built into the the receiving application or the framework/protocol (ex a message client that detects duplicate messages, or doing an HTTP GET) a simple retry maybe ok. In some cases Idempotency and retrying maybe expensive or difficult to implement. In such cases careful thought needs to be given on how these different errors are identified and handled.
</p>
<p>
<strong>2. Achieving consistency in data across processes.</strong><br />
One of the hardest problems in programming distributed systems is achieving a consistent view of data across the processes. When one processes updates some data, you need to replicate them across the other processes, so if any other process decides to operate on the same set of data, then it is doing so on the most current copy.<br />
Lets look at two examples.</p>
<p><em>Assume a global banking application for ABC bank. A customer goes to a branch in New York, US and deposits money to an account. A few moments later his relative in London, UK does a withdraw on that account. Due to latency there is obviously a time lag before the process in London, UK sees the updated amount in the account.</em></p>
<p><em>In an online trading system, a user in NY places an item for sale. The transaction is updated on the closest data center which is in Boston. A few moments later another user in LA is searching for the exact same item and is served off a data center in Phoenix. The user in LA may or may not see the item due to the latency involved in replicating the data across</em></p>
<p>For example 1 <em>strong consistency</em> is required, while for example 2, you could get away with <em>weak consistency</em>, for example by setting an SLA that says data is valid within a 5 min time window.<br />
This is not an easy problem to solve and this area itself is a subject on its own. Wener Vogels wrote a nice peice on this called <a href="http://www.allthingsdistributed.com/2007/12/eventually_consistent.html">Eventually Consistent</a> which is worth reading.<br />
Of course there are specialized frameworks/libraries that can handle this for you. But still there is no escape for you and you pretty much need to have an understanding of the pros and cons of various approaches, failure modes etc.
</p>
<p>
<strong>3. Heterogeneous nature of the components involved in the system.</strong><br />
A distributed system may contain components written in a variety of languages deployed across machines with different architectures and operating systems. Needless to say that this poses certain challenges (especially integration, interoperability issues) when implementing the system. A whole range of standards/technologies were presented to solve these issues, including but not limited to CORBA, SOAP, AMQP, REST (is an architectural style not a standard) and RPC based frameworks like ICE, Thrift, Etch etc. Anyone who has worked with these technologies knows that neither of these are trivial to use nor provide a complete solution in every situation.</p>
<p>If anybody has read the <a href="http://steve.vinoski.net/blog/2008/07/01/convenience-over-correctness/">recent posts</a> by <a href="http://steve.vinoski.net/blog">Steve Vinoski</a> and the discussions around it would realize the issues/challenges surrounding RPC. The following <a href="http://www.hpl.hp.com/techreports/2005/HPL-2005-83.pdf">paper</a> discuss the impedance mismatch problems when working with IDL based systems. The issues with type systems and data formats are not limited to RPC only. When using a message oriented approach like SOAP (doc lit style) or AMQP you will end up tunneling data thats not supported by the protocol as a string or a sequence of bytes. When using REST you would need to represent your resource in a format the requesting application understands/supports, which maybe quite different from the native format.</p>
<p>Again not an easy issue to deal with no matter what technology or framework is used. As an architect/developer you need to understand these issues and deal with them accordingly. </p>
<p>
<strong>4. Testing a distributed system is quite difficult.</strong><br />
This is arguably one of the hardest aspects of developing a distributed system. Verification of the behavior and impact of your code in the system is not easy.<br />
There are many aspects that needs to be tested, and doing so before every checkin is not a fun task at all. Running some of these tests before every checkin is not practical. But its a good idea to run them nightly and some tests during the weekend. Here are some of the areas that needs to be tested (I plan to write another blog entry elaborating on the testing aspects).</p>
<ul>
<li>Functionality testing (can be covered with well written unit testing) </li>
<li>Integration testing - you need to test the distributed system as a whole with all the components involved </li>
<li>Interoperability testing - this is crucial when heterogeneous components (different languages, OS) are involved, and is quite different from integration testing</li>
<li>TCK compliance - If your system is based on standards/specifications, then you need to ensure that you haven&#8217;t broken anything w.r.t compliance </li>
<li>Performance testing - to ensure that your changes haven&#8217;t accidentally caused a degradation in performance</li>
<li>Stress testing  - to ensure that your checkin hasn&#8217;t accidentally caused any stability issues - ex increased chance of deadlocks when the load increases</li>
<li>Soak testing - to ensure that your checkin hasn&#8217;t caused any longevity issues - ex a memory leak thats manifested after a couple hours, days</li>
</ul>
<p>Most often than not developers cut corners in their testing as running these tests are tedious and time consuming. Also these tests need to be run regularly to catch issues in a timely manner and the best way to tackle this issue is to automate as much testing as possible. There many options with continuous build systems like cruisecontrol or using a plain old cron job.<br />
Functionality testing, TCK compliance, certain types of integration and interoperability tests can be run periodically.<br />
In most organizations test machines are just lying around doing nothing during the night (unless around the clock testing is done with development centers in different time zones.). Instead of wasting computing cycles, you could automate test suites to run during the night. More time consuming integration and interoperability tests, performance, stress and soak testing can be done nightly, while more longer duration soak testing can be scheduled to run during the weekends.</p>
<p>While testing is a tough issue for any type of system, distributed systems have a lot more failure points which adds to the complexity.<br />
Getting these tests right to cover these failure points and executing them needs a lot of careful thought and planning.
</p>
<p>
<strong>5. The technologies involved in distributed systems are not easy to understand .</strong><br />
Distributed system are not easy to understand. Neither are the myriad of technologies used in developing these systems.<br />
Most folks find it difficult to grasp the concepts behind these technologies. If you look into the discussions and misconceptions surrounding REST you can understand what I am trying to get at. CORBA  was not an easy spec to understand, so is WS-* or AMQP. While it is true that you don&#8217;t need to understand everything to develop using them, you still need at least a reasonable understanding to figure how to tackle some of the above mentioned issues. Frameworks based on these technologies are touted as the cure for these problems. Sure they could help, but it still does not shift the burden away from you.<br />
To compound the issue all sorts of vendors keep touting their technology/framework as the next silver bullet.  No matter what vendor you use, at the end of the day <a href="http://rajith.2rlabs.com/2007/10/29/architecture-is-your-responsibility/">you are still responsible for getting it right</a>. And it is not an easy task. You need to face the reality that distributed systems are hard and that you cannot hide every complexity behind some framework.</p>
]]></content:encoded>
			<wfw:commentRss>http://rajith.2rlabs.com/2008/07/23/5-reasons-why-distributed-systems-are-hard-to-develop/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Axis2/C has AMQP support via Apache Qpid</title>
		<link>http://rajith.2rlabs.com/2008/06/16/axis2c-has-amqp-support-via-apache-qpid/</link>
		<comments>http://rajith.2rlabs.com/2008/06/16/axis2c-has-amqp-support-via-apache-qpid/#comments</comments>
		<pubDate>Mon, 16 Jun 2008 13:40:24 +0000</pubDate>
		<dc:creator>rajith</dc:creator>
		
		<category><![CDATA[AMQP]]></category>

		<category><![CDATA[Axis2]]></category>

		<category><![CDATA[Qpid]]></category>

		<guid isPermaLink="false">http://rajith.2rlabs.com/2008/06/16/axis2c-has-amqp-support-via-apache-qpid/</guid>
		<description><![CDATA[Danushka Menikkumbura has got AMQP support going for Axis2/C via the Apache Qpid project.
This will only work on Linux as the Qpid c++ client so far has only a Linux implementation. Currently there is ongoing work from two contributors trying to port the code base to support Windows and Solaris. This is scoped for the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://wso2.com/about/engineers/danushka/">Danushka Menikkumbura</a> has got AMQP support going for Axis2/C via the Apache Qpid project.<br />
This will only work on Linux as the Qpid c++ client so far has only a Linux implementation. Currently there is ongoing work from two contributors trying to port the code base to support Windows and Solaris. This is scoped for the M3 release.</p>
<p>Watch the WSO2 blog space or the Axis2/C website for a tutorial/blog post from Danushka.</p>
]]></content:encoded>
			<wfw:commentRss>http://rajith.2rlabs.com/2008/06/16/axis2c-has-amqp-support-via-apache-qpid/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Restructuring Code</title>
		<link>http://rajith.2rlabs.com/2008/06/09/restructuring-code/</link>
		<comments>http://rajith.2rlabs.com/2008/06/09/restructuring-code/#comments</comments>
		<pubDate>Mon, 09 Jun 2008 13:46:41 +0000</pubDate>
		<dc:creator>rajith</dc:creator>
		
		<category><![CDATA[Architecture]]></category>

		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://rajith.2rlabs.com/2008/06/09/restructuring-code/</guid>
		<description><![CDATA[Most programmers need to deal with restructuring the code they work on due to a variety of reasons.  While most of the time it is driven by demand, sometimes it is also done for personal reasons. Here are some of the reasons I have had or seen within the teams that I have worked [...]]]></description>
			<content:encoded><![CDATA[<p>Most programmers need to deal with restructuring the code they work on due to a variety of reasons.  While most of the time it is driven by demand, sometimes it is also done for personal reasons. Here are some of the reasons I have had or seen within the teams that I have worked over the years.</p>
<ol>
<li>The current code would have reached a stage where it is impossible to do any more modifications without breaking something else</li>
<li>The requirements have changed so much that the current architecture/design cannot handle it without a redesign</li>
<li>The current application doesn&#8217;t/will not scale, perform well enough as it wasn&#8217;t designed to handle the current load/anticipated growth</li>
<li>The folks who worked on the code are no longer there and nobody knows what the code really does (or what it was supposed to do)</li>
<li>You don&#8217;t really like the current way it is implemented and think that there is a better way to do it using framework X or library Y</li>
</ol>
<p>While sometimes restructuring could be done easily, but 90% of the time it is not a trivial task. When the frustration gets to you, you may have even entertained the idea of rewriting an application/module/section from scratch. Is this really a good idea? Sometimes this maybe the only option, but most of the time this may end up being a bad idea due to a variety of reasons.</p>
<ul>
<li>One of the biggest mistakes is to throw away the old code without any due consideration simply based on the assumption that the old code is bad and we are going to write much better code.
<p>Throwing away the old code (especially if it was in production) means, you are throwing away months (or years) of tested, battle hardned code that may have had fixes for bugs that you aren&#8217;t even aware of. If you don&#8217;t take this into account, the new code you write may end up showing the same bugs that are already fixed in the old code. This will waste a lot of time ,effort, knowledge gained over the years</p>
</li>
<li>This method or class is ugly, lets throw it away and write again.
<p>That odd looking method or that badly written class may have some fix for a race condition or an optimization that one of your customers is depending upon. Discarding that code as crap without really understanding whats going on may end up with dire consequences for your team.</p>
</li>
</li>
<li>Not paying enough attention to the existing unit tests/ test frameworks when building the new system.
<p>These tests were added for a reason, possibly in response to a bug or some sort of intermittent failure that was reported on a production system. These failures/errors may have been reported way before you joined the company. Sometimes none of the current team members are aware of all the issues. So discarding the test code means you are throwing away years of hard work and knowledge</p>
</li>
<li>The current code is way behind all the cool technology we have today. The new framework X can do things a lot more elegantly, so lets re write.
<p>This is by far the worst mistake. If something is not broken then why try to fix it?. The code is ugly, or technology used is not cool are not good reasons. Simply bcos the style or structure of the code is not according to your personal preference is not a reason at all for unwanted restructuring .</p>
</ul>
<p>I have been guilty of doing most the of the above mentioned points and through hard lessons I have realized that,</p>
<ul>
<li> The best approach for restructuring starts with taking stock of the existing code base and tests written against that code. This will help you understand the strengths and weaknesses in the existing code, so you could ensure that you preserve the strong points while avoiding the mistakes.</li>
<li>It is best to reuse as much code as possible, bcos no matter how ugly the code is, it has been tested/reviewed etc. </li>
<li>Incremental changes are better than one massive code change. Incremental changes allows you to gauge the impact on the system more easily through feedback from tests etc. It is not fun to see 80 test failures after you make a change and can lead to frustration/preasure that will in turn result in more bad decesions . A couple of test failures is easy to deal with and provides a more managable approach. </li>
<li>After each iteration it is important to ensure that the existing tests pass. Analyze why the tests are failing, and make modifications/add new tests if nessacery if the existing tests are not sufficient enough to cover the changes you made. <b>Failure to do so can result in a lot of pain down the road.</b></li>
<li>Avoid the temptation to rewrite everything. Personal preferences and ego shouldn&#8217;t get in the way. If something works then don&#8217;t change it.</li>
<li>Remember that humans make mistakes and restructing will always not garuntee that it will be atleast as good as the previous attempt. I have seen and have been part of several failed restructuring attempts</li>
</ul>
<p>Having said all of that, sometimes you have no option but to rewrite from scratch.  But IMHO that should be your last resort.            </p>
]]></content:encoded>
			<wfw:commentRss>http://rajith.2rlabs.com/2008/06/09/restructuring-code/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Axis2/Synapse - AMQP support via JMS Transport using Apache Qpid</title>
		<link>http://rajith.2rlabs.com/2008/06/08/axis2synapse-amqp-support-via-jms-transport-using-apache-qpid/</link>
		<comments>http://rajith.2rlabs.com/2008/06/08/axis2synapse-amqp-support-via-jms-transport-using-apache-qpid/#comments</comments>
		<pubDate>Mon, 09 Jun 2008 03:09:34 +0000</pubDate>
		<dc:creator>rajith</dc:creator>
		
		<category><![CDATA[AMQP]]></category>

		<category><![CDATA[Axis2]]></category>

		<category><![CDATA[Qpid]]></category>

		<category><![CDATA[Synapse]]></category>

		<guid isPermaLink="false">http://rajith.2rlabs.com/2008/06/08/axis2synapse-amqp-support-via-jms-transport-using-apache-qpid/</guid>
		<description><![CDATA[I have tested the following with Axis2 1.4 release and the up comming Synapse 1.2 release.
Documentation is broken into two sections.
It is important to read and understand the pros and cons for each option.
If you have any questions/suggestions please post on qpid-users@incubator.apache.org
And/Or open a JIRA at http://issues.apache.org/jira/browse/qpid
Your feedback is most welcomed.

Configuring the JMS transport using [...]]]></description>
			<content:encoded><![CDATA[<p>I have tested the following with Axis2 1.4 release and the up comming Synapse 1.2 release.</p>
<p>Documentation is broken into two sections.<br />
It is important to read and understand the pros and cons for each option.</p>
<p>If you have any questions/suggestions please post on qpid-users@incubator.apache.org<br />
And/Or open a JIRA at http://issues.apache.org/jira/browse/qpid<br />
Your feedback is most welcomed.</p>
<ol>
<li><u>Configuring the JMS transport using Apache Qpid M2.1 release.</u>
<ul>
<li>This version is the latest stable release and supports the 0-9 version of the AMQP protocol.</li>
<li>You can download it from <a href="http://cwiki.apache.org/qpid/download.html">here</a></li>
<li>It is recomended that you use the Java broker.</li>
<li><strong><em>This is the recomended production version.</em></strong></li>
</ul>
</li>
<li><u>Configuring the JMS transport using Apache Qpid trunk. (with the usual caveat that it is a less stable and a moving target).</u>
<ul>
<li>The trunk supports the 0-10 version of the AMQP protocol and the next release is M3.</li>
<li>You can build it from source. https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid</li>
<li> <u> Has the following enchancements in the JMS client over M2.1</u>
<ol>
<li>You can specify multiple binding keys per destination. i.e you could bind a queue to a particular exchange using several binding keys there by allowing you to listen from multiple sources.</li>
<li>You can bind your queue to any exchange type using the binding URL.</li>
<li>You can set the following options per JMS connection.
<ul>
<li>maxprefetch - The maximum number of pre-fetched messages per destination</li>
<li>sync_persistence - When true, a sync command is sent after every persistent message to guarantee that it has been received by the broker.</li>
</ul>
</li>
<li>A new blocking transport (as an alternative to MINA) that gives much better latency, memory and increased throughput in many cases.</li>
<li> Currently only the c++ broker supports the 0-10 version and only works on linux.</li>
<li><u>In the pipeline</u>
<ul>
<li>Java Broker - expected to be in M3 release. Currently being refactored</li>
<li>C++ broker - solaris and windows port are in progress (likely to be in M3 release)</li>
</ul>
</ol>
</ul>
</li>
</ol>
<p><b><u>1.0 Configuring the JMS transport using Apache Qpid M2.1 release</u></b></p>
<ul>
<li>1.1 Qpid provides a convinient properties file based JNDI mechanism.
<ul>
<li>For provider URL please specify the location of the jndi.properties file.</li>
<li>The following link provides documentation for the jndi.properties file. <a href="http://cwiki.apache.org/qpid/how-to-use-jndi.html">JNDI How To</a> </li>
<li>The connection URL format is given here. <a href="http://cwiki.apache.org/qpid/connection-url-format.html">Connection URL format</a></li>
</ul>
<p><code><br />
&lt;parameter name="myTopicConnectionFactory"&gt;<br />
       &lt;parameter name="java.naming.factory.initial">org.apache.qpid.jndi.PropertiesFileInitialContextFactory&lt;/parameter&gt;<br />
       &lt;parameter name="java.naming.provider.url">file:///opt/workspace/sandbox/axis2-1.4&lt;/parameter&gt;<br />
       &lt;parameter name="transport.jms.ConnectionFactoryJNDIName">TopicConnectionFactory&lt;/parameter&gt;<br />
&lt;/parameter&gt;<br />
</code></p>
</li>
<li>1.2 If you didn&#8217;t specify a custom destination for your service via the <em>&#8220;transport.jms.Destination&#8221;</em> parameter then the JMS transport will create a queue with the service name as its name. In AMQP world the above translates as follows. <em>A queue will be created with service name as its name and will be bound to the amq.direct exchange with service name as the routing key</em>
        </li>
<li>1.3 If you specify a custom destination name via <em>transport.jms.Destination</em> in your services.xml then Qpid will look that up in the jndi.properties file and create queue based on the definition given in the file.<br />
             The binding URL format is given here. <a href="http://cwiki.apache.org/qpid/bindingurlformat.html">Binding URL format</a></li>
</ul>
<p>
<b><u>2.0 Configuring the JMS transport using Apache Qpid trunk</b></u><br />
In addition to whats described above you can do the following.</p>
<ul>
<li>2.1 Specifing multiple binding keys per destination<br />
        <br />
             <code>destination.wetherServiceQueue=topic://amq.topic/WeatherQueue?bindingkey='weather.us.*'&#038;bindingkey='weather.ca.*'</code><br />
       	 <br />
      The above will create a queue named WeatherQueue and will bind it to amq.topic with &#8216;weather.us.*&#8217; and &#8216;weather.ca.*&#8217; as the binding keys. The broker will then route any messages that matches the above patterns into WeatherQueue.</li>
<li>2.2 Binding your queue to any exchange type the broker supports by using the binding URL.<br />
        <code><br />
                   For example if you want to bind your queue to a fanout exchange<br />
                   destination.top10StockQueue=fanout://amq.fanout/WeatherQueue<br />
         </code><br />
         </li>
<li>2.3 Setting prefetch limit and sync_persistence per JMS connection<br />
        <br />
        <code>amqp://username:password@clientid/test?brokerlist='tcp://localhost:5672'&#038;maxprefetch=2000&#038;sync_persistence=true<br />
        </code><br />
        
        </li>
<li>2.4 Using the new transport<br />
       <br />
        <code>Set -Dtransport=io when starting Axis2 or Synapse.</code></li>
</ul>
<p> <a href="http://rajith.2rlabs.com/2008/06/08/axis2synapse-amqp-support-via-jms-transport-using-apache-qpid/#more-34" class="more-link">(more&#8230;)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://rajith.2rlabs.com/2008/06/08/axis2synapse-amqp-support-via-jms-transport-using-apache-qpid/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Synapse vs Camel</title>
		<link>http://rajith.2rlabs.com/2008/02/11/synapse-vs-camel/</link>
		<comments>http://rajith.2rlabs.com/2008/02/11/synapse-vs-camel/#comments</comments>
		<pubDate>Mon, 11 Feb 2008 20:33:25 +0000</pubDate>
		<dc:creator>rajith</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[Open Source]]></category>

		<category><![CDATA[Camel]]></category>

		<category><![CDATA[Synapse]]></category>

		<guid isPermaLink="false">http://rajith.2rlabs.com/2008/02/11/synapse-vs-camel/</guid>
		<description><![CDATA[I had the opportunity of listening to my friend Bruce Snyder talk about Apache Camel during his talks on ActiveMQ/ServiceMix at the Colorado Software Summit 07. There was also some discussion on Camel on the Apache Synapse mailing list recently. I thought of replying to the thread comparing the two based on it&#8217;s routing and [...]]]></description>
			<content:encoded><![CDATA[<p>I had the opportunity of listening to my friend <a href="http://bsnyderblog.blogspot.com/">Bruce Snyder</a> talk about <a href="http://activemq.apache.org/camel/">Apache Camel</a> during his talks on <a href="http://www.softwaresummit.com/2007/speakers/snyder.htm">ActiveMQ/ServiceMix</a> at the <a href="http://www.softwaresummit.com/2007/2007index.html">Colorado Software Summit 07</a>. There was also some discussion on Camel on the <a href="http://synapse.apache.org">Apache Synapse</a> mailing list recently. I thought of replying to the thread comparing the two based on it&#8217;s routing and mediation aspects. In the process I decided to write a blog post instead. If I have misunderstood any Camel feature/architectural detail, please let me know and I will post a correction. Note this is not an in depth analysis, neither a verdict on either project. Readers should do their own research and come to conclusions.</p>
<p><strong><u>Intent/Problem Space</u></strong></p>
<ul>
<li>Both Synapse and Camel have similar intents as Integration, Mediation and Routing Engines. </li>
<li>Synapse also positions itself as an ESB, treating your entire network as the bus. </li>
<li><a href="http://servicemix.apache.org/servicemix-camel.html">Camel/ServiceMix</a> is advertised as an ESB.</li>
<li>Both have routing,transformation,mediation,enrichment,validation, logging ..etc.</li>
<li>Initially Synapse was more focused on Web Services mediation. Since then, it has moved out of the Web Services umbrella and is trying to position itself as a general purpose integration/mediation/routing engine.</li>
<li> Synapse by design have a proper abstraction layer where you can adapt (implement) Synapse on top of any Environment. It is one of the least known aspects about Synapse. <strong>Most folks assume Synapse can only work on top of Axis2</strong>. I have implemented the Synapse environment interface inside the <a href="http://cwiki.apache.org/qpid/">Apache Qpid broker</a> to leverage its mediation/routing capabilities. </li>
<li>Camel on the other hand was designed to work on different environments from the begining. Camel can be used inside ServiceMix, ActiveMQ etc.</li>
</ul>
<p><strong><i>I haven&#8217;t experimented enough with Camel to compare performance, flexibility,extensibility or robustness with Synapse.</i></strong> Perhaps that would be an interesting topic to touch sometime later</p>
<p><strong><u>Messaging Model</u></strong></p>
<ul>
<li>The Synapse messaging model is based on SOAP. The current implementation of Synapse is powered by <a href="http://ws.apache.org/axis2/">Axis2</a> and takes any type of non SOAP message and creates a fictitious SOAP message and pumps it through the Synapse engine.</li>
<li>Camel has a neutral messaging model which I think is nice.</li>
<li>However you can implement your own Synapse MessageContext as well. I have created an AMQP based messaging model for Synapse for my work on embedding Synapse as an AMQP Exchange. </li>
<li>Synapse could also use generics to make it&#8217;s messaging model neutral. (I hope to make a proposal to this effect after my AMQP work).</li>
</ul>
<p><strong><u>Synapse Configuration vs Camel Context</u></strong></p>
<ul>
<li>Both use very similar models for representing a runtime instance of the rules/endpoints/registry ..etc.</li>
<li>Synapse has a XML based DSL for configuration. </li>
<li>Camel has a java and XML based DSL for configuration. You can use Spring to configure the Camel Context as well. </li>
<li>You can also use Synapse programatically all though we haven&#8217;t provided a clear API as such to the user community. I think such an API would be a valuable addition to Synapse. </li>
<li>There is support for configuring Axis2 with Spring, so I assume you can do the same for Synapse very soon (if not already).</li>
<li>Both supports the concept of a Registry. The registry mechanism is pluggable in both projects.</li>
</ul>
<p><strong><u>Synapse Mediators vs Camel Processors</u></strong></p>
<ul>
<li>A Synapse mediator, mediates a message as it passes through. It could be a transformation,validation, logging, audit ..etc.</li>
<li> You can chain mediators into sequences and combine different sequences to create a processing engine. </li>
<li>Camel processors does more or less the same.</li>
<li> In both Synapse and Camel you can write you own mediator by implementing the Mediator or Processor interfaces respectively.</li>
</ul>
<p><strong><u>Synapse Script Mediator vs Camel Predicates/Expressions</u></strong><br />
Again they both provide pluggable scripting support. Not much to be said there.</p>
<p><strong><u>Endpoints/Transports</u></strong></p>
<ul>
<li>Both represents endpoints via URIs.</li>
<li>Camel and Synapse supports more or less the same set of transports with the following exceptions.
<ul>
<li>Camel has additional support for JBI,MINA, XMPP.</li>
<li>Synapse supports Non blocking HTTP, AMQP (native not via JMS). <br /><a href="http://macstrac.blogspot.com/">James Strachen</a><em>answered : &#8220;Camel supports non blocking HTTP too&#8221;</em></li>
<li>In Synapse you could switch transport. Ex incoming is JMS and outgoing is HTTP (does Camel have similar support?). <br /> <a href="http://macstrac.blogspot.com/">James Strachen</a> <em>answered : &#8220;you can use Camel to do protocol switching from any protocol to any protocol with whatever EIP patterns in between (e.g. Message Translator etc).&#8221;</em></li>
<li><a href="http://ws.apache.org/axis2/">Axis2</a> has support for XMPP, so if you really want to you could leverage that in Synapse.</li>
</ul>
</li>
</ul>
<p><p><strong><u>Enterprise Integration Patterns</u></strong></p>
<ul>
<li>Camel has support/good documentation for <a href="http://www.enterpriseintegrationpatterns.com/">Enterprise Integration Patterns (based on Gregor Hopes book)</a>. </li>
<li>All though Synapse doesn&#8217;t directly say so, you can easily do the same. In fact it does have some <a href="http://synapse.apache.org/Synapse_Samples.html#Sample400">built in support</a> similar to Camel for some patterns while other patterns can be done with a little bit of work. I may in the future compile an article on how to do so with Synapse.</li>
</ul>
<p><strong><u>Embedability</u></strong></p>
<ul>
<li>Camel has a programmable API as described above and I quite like it. It would be nice if Synapse can do something similar.</li>
<li>Camel can be used inside ServiceMix, ActiveMQ ..etc. I have managed to embed Synapse inside an AMQP broker albeit with some code changes.</li>
<li>It would be nice if you could embed the mediation engine in Synapse in other projects in a trivial way and also provide some documentation on it.</li>
<li>One nice thing about Synapse is that it can be deployed as a module inside Axis2 or as war file inside Tomcat. Couldn&#8217;t find any documentation on easy Camel integration with <a href="http://incubator.apache.org/cxf/">Apache CFX</a><br /><a href="http://macstrac.blogspot.com/">James Strachen</a> <em>answered : &#8220;its trivial to deploy Camel inside any Spring or WAR application or as an OSGi bundle, working great with Spring Dynamic Modules&#8221;</em>
        </li>
</ul>
<p><strong><u>WS-* QoS Support</u></strong></p>
<ul>
<li>Synapse has Built in support for WS-* QoS features (adding/removing security, reliability ..etc) when running on top of Axis2.</li>
<li>Does Camel have a similar strategy with it&#8217;s <a href="http://incubator.apache.org/cxf/">Apache CXF</a> support? ( I couldn&#8217;t find any information in the Camel site about this)<br /> <a href="http://macstrac.blogspot.com/">James Strachen</a> <em>answered : yes Camel has a similar WS-* strategy; using CXF to support the SOAP/WS-* protocols on any endpoint</em></li>
</ul>
<p><strong><u>Throttling/Load balancing/Policy based access and failover support for endpoints</u></strong></p>
<ul>
<li>Synapse has good support for applying throttling , failover support and load balancing to endpoints.</li>
<li> Synapse also can apply policies to enforce restrictions for better manage your endpoints.</li>
<li> Not sure if Camel has any support for this area.<br />
        <a href="http://macstrac.blogspot.com/">James Strachen</a> <em>answered : &#8220;yes Camel has support for load balancing, throttling, resequencing etc. See http://activemq.apache.org/camel/enterprise-integration-patterns.html&#8221;</em></li>
</ul>
<p><strong><u>Clustering support</u></strong></p>
<ul>
<li>Synapse allows mediator state to be replicated across the cluster.This is based on the Axis2 clustering support.</li>
<li>This is nice when you want to implement stateful mediators, like a session mediator.</li>
<li> Again haven&#8217;t come across any documentation in Camel on this area. <br />
             <a href="http://macstrac.blogspot.com/">James Strachen</a> <em>answered : &#8220;for stateful replication, we rely on ActiveMQ’s Message Groups feature or using EJB3&#8243;</em>
        </li>
</ul>
<p><strong><u>Payload Conversion</u></strong></p>
<ul>
<li>Synapse can covert from one message format to another via built in support for POX, SOAP and JMS. </li>
<li>Camel provides a Type Converter interface (and some default implementations) to convert message payloads from one type to another when routing.</li>
<li> Similarly in Synapse, for other payload types you could write a custom mediator to do the job.</li>
<li> Also using the transport switching mechanism you can do some trivial things like converting a Qpid/AMQP message to an ActiveMQ message using the JMS transport. Sort of like a message bridge.</li>
</ul>
<p><strong><u>Summary</u></strong><br />
Both projects seems interesting and has some overlapping features, but different direction/focus and thought process behind them. IMHO it is nice to have choices in open source. Each community can learn from each other and strive to provide a better experience to the end user.</p>
]]></content:encoded>
			<wfw:commentRss>http://rajith.2rlabs.com/2008/02/11/synapse-vs-camel/feed/</wfw:commentRss>
		</item>
		<item>
		<title>MapReduce vs RDBMS</title>
		<link>http://rajith.2rlabs.com/2008/01/26/mapreduce-vs-rdbms/</link>
		<comments>http://rajith.2rlabs.com/2008/01/26/mapreduce-vs-rdbms/#comments</comments>
		<pubDate>Sat, 26 Jan 2008 17:26:55 +0000</pubDate>
		<dc:creator>rajith</dc:creator>
		
		<category><![CDATA[Architecture]]></category>

		<category><![CDATA[Parallel Computing]]></category>

		<guid isPermaLink="false">http://rajith.2rlabs.com/2008/01/26/mapreduce-vs-rdbms/</guid>
		<description><![CDATA[My friend Matt brought to my attention an article on why MapReduce is a step backward, written by David J. DeWitt and Michael Stonebraker. I also stumbled on this blog entry written by Mark CC from Google. It is sad to see that most people advocate a particular solution to every problem imaginable and then [...]]]></description>
			<content:encoded><![CDATA[<p>My friend Matt brought to my attention an <a href="http://www.databasecolumn.com/2008/01/mapreduce-a-major-step-back.html">article on why MapReduce is a step backward</a>, written by <a href="http://pages.cs.wisc.edu/~dewitt/">David J. DeWitt</a> and <a href="http://s2k-ftp.cs.berkeley.edu:8000/nasa_e2e/mike.html">Michael Stonebraker</a>. I also stumbled on this <a href="http://scienceblogs.com/goodmath/2008/01/databases_are_hammers_mapreduc.php">blog entry</a> written by Mark CC from Google. It is sad to see that most people advocate a particular solution to every problem imaginable and then refuse to look at anything else from a neutral pov. I let you draw your own conclusions.</p>
]]></content:encoded>
			<wfw:commentRss>http://rajith.2rlabs.com/2008/01/26/mapreduce-vs-rdbms/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Architecting for latency - What I learnt from Dan Pritchett’s (eBay) talk</title>
		<link>http://rajith.2rlabs.com/2008/01/21/architecting-for-latency-what-i-learnt-from-dan-pritchett%e2%80%99s-ebay-talk/</link>
		<comments>http://rajith.2rlabs.com/2008/01/21/architecting-for-latency-what-i-learnt-from-dan-pritchett%e2%80%99s-ebay-talk/#comments</comments>
		<pubDate>Mon, 21 Jan 2008 23:35:26 +0000</pubDate>
		<dc:creator>rajith</dc:creator>
		
		<category><![CDATA[Architecture]]></category>

		<guid isPermaLink="false">http://rajith.2rlabs.com/2008/01/21/architecting-for-latency-what-i-learnt-from-dan-pritchett%e2%80%99s-ebay-talk/</guid>
		<description><![CDATA[It&#8217;s been almost 3 months since I attended the Colorado Software Summit (2007), but due to studies and the Red Hat Messaging launch I never got around to blog about the notes I took during Dan&#8217;s talk on &#8220;Architecting for latency&#8221;. I managed to blog about his other talk on Scalability here. Well better late [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been almost 3 months since I attended the <a href="http://softwaresummit.com/">Colorado Software Summit (2007)</a>, but due to studies and the <a href="http://www.redhat.com/mrg/messaging/">Red Hat Messaging launch</a> I never got around to blog about the notes I took during Dan&#8217;s talk on &#8220;Architecting for latency&#8221;. I managed to blog about his other talk on Scalability <a href="http://rajith.2rlabs.com/2007/11/16/scaling-your-system-what-i-learnt-from-dan-pritchetts-ebay-talk/">here</a>. Well better late than never. So here it is.</p>
<p>One of the key points he mentioned was that people often ignored latency and tried to work around it instead of embracing the reality. Which is exactly the second <a href="http://www.rgoarchitects.com/Files/fallacies.pdf">fallacy of distributed computing</a> - Latency is zero. Understanding this reality is important especially if you are involved in systems that are distributed geographically. Here are some of the tips I noted down.</p>
<ul>
<li>Try to serve users from where they are located. <br />
             Move latency from users into your network. This will move the complexity into your system, but it will improve the user perceived performance<br />
             Ex: If you serve your European customers from a data center in US, your customers will experience some delays. If you add a data center in Europe then it will improve the customer experience, but now it will add more complexity into your system as you would need to deal with consistency between the data centers ..etc
        </li>
<li>Co-locating your services is a good strategy, but it may not be possible all the time. So always think about how you would architect your system or components so there are no issues if you move them apart from 10ms to 100ms.</li>
<li>Don&#8217;t couple your system to the hardware or network topology. Upgrading might be a nightmare</li>
<li>Trying to achieve global data consistency limits options<br />
             Think about what your business can tolerate when it comes to inconsistent state? Trying to achieve global consistency can make things very complicated.<br />
             Keep your users in one data center. Bouncing them between data centers will force your to maintain global consistency. Tell them that the data is valid within x secs.</li>
<li>Prioritize according to user needs<br />
             Here is a nice example given by Dan. SLA for seeing the payments due on an invoice is 5 mins and the customer never complains:)<br />
             SLA for seeing money in a sellers account is 10 secs, or else the users get a bit upset.
       </li>
<li>If you are recovering from a failure, reduce serviceability until your system gets back to normal state. This will prevent overloading the system and increasing latency.</li>
<li> Use distributed transactions carefully<br />
              Here is an example.<a href='http://2rlabs.com/rajith/blog/wp-content/uploads/2008/01/latency.jpg' title='dtx'><img src='http://2rlabs.com/rajith/blog/wp-content/uploads/2008/01/latency.jpg' alt='dtx' /></a></p>
<ul>
<li>Component C in the first configuration is complicated as it needs to ensure both data bases are updated. DB2 can be in a different geographical location and updating it can add a lot to latency.</li>
<li>In configuration two, C is smaller and simple. We can introduce other components to process the data without impacting the user perceived performance for the client.</li>
<li>Another advantage is that C can do a transaction even when DB2 is down.</li>
</ul>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://rajith.2rlabs.com/2008/01/21/architecting-for-latency-what-i-learnt-from-dan-pritchett%e2%80%99s-ebay-talk/feed/</wfw:commentRss>
		</item>
	<feedburner:awareness xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://api.feedburner.com/awareness/1.0/GetFeedData?uri=rajith</feedburner:awareness></channel>
</rss>
