<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.appistry.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.appistry.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0" xml:base="http://www.appistry.com/blogs">
<channel>
 <title>self.organize()</title>
 <link>http://www.appistry.com/blogs/guerry</link>
 <description>Distributed Computing On Purpose</description>
 <language>en</language>
<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.appistry.com/AppistryBlogs-Guerry" type="application/rss+xml" /><item>
 <title>Parallelism : Is your code cloud-ready and multi-core friendly? (part 5)</title>
 <link>http://www.appistry.com/blogs/guerry/parallelism-your-code-cloud-ready-and-multi-core-friendly-part-5</link>
 <description>&lt;p&gt;As part of an &lt;a href="http://www.appistry.com/blogs/guerry/is-your-code-cloud-ready-and-multi-core-friendly-part-1-introduction"&gt;ongoing series&lt;/a&gt;, we are discussing design principles that influence how ready our code is for distributed&amp;#160; computing in the cloud, as well as for multi-core utilization. Today, we talk about&amp;#8230;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;&lt;i&gt;&lt;a href="http://en.wikipedia.org/wiki/Image:Caf%C3%A9_wall.svg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 10px 0px 0px; border-right-width: 0px" height="140" alt="800px-Caf&amp;#233;_wall.svg" src="http://www.appistry.com/blogs/files/appcom/guerry/2008/11/800px-Caf%C3%A9_wall.svg_3.png" width="207" align="left" border="0" /&gt;&lt;/a&gt;&lt;/i&gt;&lt;/b&gt;Parallelism &lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&amp;quot;Parallel code?&amp;quot; you ask, &amp;quot;I don't need no stinkin' parallel code!&amp;quot; In the past, writing parallel code was an area of specialization, and most of us did not have a parallel processing computer with specialized hardware in our basements.&lt;/p&gt;
&lt;p&gt;However, most new workstations, servers and laptops today have multi-core CPUs. However, even If you &lt;i&gt;do&lt;/i&gt; have a dual core, quad core (or more) setup and your software doesn't utilize it, then you are leaving computing power lying, literally, on your desk, your rack, or your lap.&lt;/p&gt;
&lt;p&gt; &lt;!--break--&gt;
&lt;p&gt;The industry is quickly moving to tools and languages that make writing and running code in parallel across multiple cores easier, if not brain-dead simple. Languages are getting new constructs to aid multi-core development, some as simple as looping directives that execute loops in parallel instead of serially. Functional languages in particular, like Erlang, Scala, and F#, are looked upon favorably because they lend themselves to parallel logic. For example, such languages have immutable objects by default, which enforces data safety across threads. Functional languages encourage the other base principles that we have discussed earlier: &lt;a href="http://www.appistry.com/blogs/guerry/is-your-code-cloud-ready-and-multi-core-friendly-part-2-atomicity"&gt;atomicity&lt;/a&gt;, &lt;a href="http://www.appistry.com/blogs/guerry/is-your-code-cloud-ready-and-multi-core-friendly-pt-3-statelessness"&gt;statelessness&lt;/a&gt;, and &lt;a href="http://www.appistry.com/blogs/guerry/your-code-cloud-ready-and-multi-core-friendly-pt-4-idempotence"&gt;idempotence&lt;/a&gt;. Similar constructs are appearing in languages and frameworks that make parallel execution across distributed environments simpler too.&lt;/p&gt;
&lt;p&gt;That said, most if not all distributed cloud-based environments allow you to run code in parallel today without waiting for special language constructs in Java, .NET or your language du jour. Indeed, due to their underlying execution models, some of these distributed environments also automatically take advantage of multiple cores on each compute node in an efficient way. And, you don't have to adapt your code to get these benefits. This allows you to take your Plain Old Java and .NET objects (POJOs and PONOs) and enable parallel execution across distributed computers while utilizing multiple cores.&lt;/p&gt;
&lt;p&gt;Perhaps the largest challenge some face is choosing what code can be run in parallel. Again, tools are coming that will help in this respect. Some just identify the code sections for you, others will try to do it all automatically. However, tools or not, the code design principles we have been discussing become more powerful when utilized together, and go a long way toward making your code a good candidate for being good parallel-ready code.&lt;/p&gt;
&lt;p&gt;As we've discussed the design principles to use in our code to make it cloud ready and multi-core friendly, we've also touched on the benefits that cloud computing platforms can bring that code. Next time in part six, we'll conclude this series by discussing what a cloud computing platform is, and how such a platform can bring scalability, reliability, and availability to your code with minimal or no intrusion. &lt;/p&gt;
&lt;p&gt;In the meantime, if you'd like to learn about what cloud computing is and what parts make up cloud computing technology stack, download our white paper &amp;quot;&lt;a href="http://www.appistry.com/resource-library/index.html#"&gt;Unlocking the Promise of Cloud Computing for the Enterprise&lt;/a&gt;.&amp;quot;&lt;/p&gt;
&lt;p&gt;Is your company considering using cloud computing? On premise as a private cloud? Or, off premise in the public cloud?&lt;/p&gt;
</description>
 <comments>http://www.appistry.com/blogs/guerry/parallelism-your-code-cloud-ready-and-multi-core-friendly-part-5#comments</comments>
 <pubDate>Mon, 10 Nov 2008 17:41:19 +0000</pubDate>
 <dc:creator>guerry</dc:creator>
 <guid isPermaLink="false">459 at http://www.appistry.com/blogs</guid>
</item>
<item>
 <title>Is your code cloud-ready and multi-core friendly? (pt 4): Idempotence</title>
 <link>http://www.appistry.com/blogs/guerry/your-code-cloud-ready-and-multi-core-friendly-pt-4-idempotence</link>
 <description>&lt;p&gt;As part of an &lt;a href="http://www.appistry.com/blogs/guerry/is-your-code-cloud-ready-and-multi-core-friendly-part-1-introduction"&gt;ongoing series&lt;/a&gt;, we are discussing design principles that influence how ready our code is for distributed computing in the cloud, as well as for multi-core utilization.&amp;#160; &lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.appistry.com/blogs/files/appcom/guerry/2008/10/OpticalIllusionStJohnLateran1_2.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 5px 5px 5px 0px; border-right-width: 0px" height="201" alt="OpticalIllusionStJohnLateran1" src="http://www.appistry.com/blogs/files/appcom/guerry/2008/10/OpticalIllusionStJohnLateran1_thumb.jpg" width="260" align="left" border="0" /&gt;&lt;/a&gt;Today we'll talk about idempotence&amp;#8230;today we'll talk about idempotence&amp;#8230;today we'll talk about idempotence&amp;#8230;. Ya, all this and cheap humor too. If you don't get the lame humor, no problem, just read on.... :-)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;Idempotence&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;If code is &lt;a href="http://www.appistry.com/blogs/guerry/is-your-code-cloud-ready-and-multi-core-friendly-part-2-atomicity"&gt;atomic&lt;/a&gt; and &lt;a href="http://www.appistry.com/blogs/guerry/is-your-code-cloud-ready-and-multi-core-friendly-pt-3-statelessness"&gt;stateless&lt;/a&gt; (as we discussed in &lt;a href="http://www.appistry.com/blogs/guerry/is-your-code-cloud-ready-and-multi-core-friendly-part-2-atomicity"&gt;part 2&lt;/a&gt; and &lt;a href="http://www.appistry.com/blogs/guerry/is-your-code-cloud-ready-and-multi-core-friendly-pt-3-statelessness"&gt;part 3&lt;/a&gt;) it may take on other attributes like idempotence. &lt;i&gt;Idempotence says I can execute the same method repeatedly and get the same outcome without adversely affecting anything else, like state.&lt;/i&gt;&lt;/p&gt;
&lt;p&gt; &lt;!--break--&gt;
&lt;p&gt;Wikipedia defines &lt;a href="http://en.wikipedia.org/wiki/Idempotence"&gt;idempotence in computing&lt;/a&gt; thus:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&amp;quot;In &lt;a href="http://en.wikipedia.org/wiki/Computer_science"&gt;computer science&lt;/a&gt;, the term idempotent is used to describe &lt;a href="http://en.wikipedia.org/wiki/Method_%28computer_science%29"&gt;methods&lt;/a&gt; or &lt;a href="http://en.wikipedia.org/wiki/Subroutine"&gt;subroutine&lt;/a&gt; calls that can safely be called multiple times, as invoking the procedure a single time or multiple times results in the system maintaining the same state; i.e., after the method call all variables have the same value as they did before.&lt;/p&gt;
&lt;p&gt;&amp;quot;Example: Looking up some customer's name and address in a &lt;a href="http://en.wikipedia.org/wiki/Database"&gt;database&lt;/a&gt; are typically idempotent, since this will not cause the database to change. Placing an order for a car for the customer is not idempotent, since running the method/call several times will lead to several orders being placed, and therefore the state of the database being changed to reflect this.&lt;/p&gt;
&lt;p&gt;&amp;quot;In &lt;a href="http://en.wikipedia.org/wiki/Event_Stream_Processing"&gt;Event Stream Processing&lt;/a&gt;, idempotence refers to the ability of a system to produce the same outcome, even if an event or message is received more than once.&amp;quot;&lt;/p&gt;
&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Idempotence in a method or function is not always possible, while some logic lends itself naturally to idempotence. Other logic may require safeguards in its design to assure safe repeatability. &lt;/p&gt;
&lt;p&gt;When idempotence is possible, extreme flexibility is gained for executing that code across a distributed environment like the cloud. By their natures, some distributed environments &lt;i&gt;expect &lt;/i&gt;failure and are designed to work around it. Consider how the internet routes around failure. If I request a web page through my browser, and the request fails due to a backhoe in Des Moines, and I hit reload, my second request will likely take a different route to get the page. Most likely, I could request that page repeatedly and not affect anything except maybe irritating the web master. That&amp;#8217;s idempotence in action in a distributed environment where failure happens, and the environment deals with it.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;Benefits&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Many of the arguments for the value of idempotence are the same as those we've previously discussed for &lt;a href="http://www.appistry.com/blogs/guerry/is-your-code-cloud-ready-and-multi-core-friendly-part-2-atomicity"&gt;atomic&lt;/a&gt;, cohesive, and &lt;a href="http://www.appistry.com/blogs/guerry/is-your-code-cloud-ready-and-multi-core-friendly-pt-3-statelessness"&gt;stateless&lt;/a&gt; code running in distributed environments and multi-threaded, multi-core designs. So instead of rehash those discussions, I'll just summarize here. &lt;/p&gt;
&lt;p&gt;Availability and load-balancing like idempotent code's repeatable and non-destructive nature. I can run the code on any thread or any node and not worry about side effects. &lt;/p&gt;
&lt;p&gt;Reliability in a distributed computing environment like the cloud sometimes means that an execution step may be interrupted by hardware failure. In that event, the distributed environment may decide to repeat the execution step elsewhere. The repeatability of idempotent code is ideal in these circumstances because the method call can be repeated without worry and without dependencies. &lt;/p&gt;
&lt;p&gt;Next time in part four, we'll conclude this section by talking about the attribute of parallelizability.&lt;/p&gt;
</description>
 <comments>http://www.appistry.com/blogs/guerry/your-code-cloud-ready-and-multi-core-friendly-pt-4-idempotence#comments</comments>
 <pubDate>Wed, 15 Oct 2008 23:08:52 +0000</pubDate>
 <dc:creator>guerry</dc:creator>
 <guid isPermaLink="false">457 at http://www.appistry.com/blogs</guid>
</item>
<item>
 <title>Is your code cloud-ready and multi-core friendly? (pt 3): Statelessness</title>
 <link>http://www.appistry.com/blogs/guerry/is-your-code-cloud-ready-and-multi-core-friendly-pt-3-statelessness</link>
 <description>&lt;p&gt;&lt;a href="http://www.appistry.com/blogs/files/appcom/guerry/2008/10/Fullerene_c540_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 5px 10px 5px 5px; border-right-width: 0px" height="130" alt="Fullerene_c540" src="http://www.appistry.com/blogs/files/appcom/guerry/2008/10/Fullerene_c540_thumb.png" width="121" align="left" border="0" /&gt;&lt;/a&gt;As part of an &lt;a href="http://www.appistry.com/blogs/guerry/is-your-code-cloud-ready-and-multi-core-friendly-part-1-introduction"&gt;ongoing series&lt;/a&gt;, we are discussing design principles that influence how ready our code is for distributed&amp;#160; computing in the cloud, as well as for multi-core utilization. &lt;/p&gt;
&lt;p&gt;A friend of mine used to say, &amp;quot;All generalizations are false, including this one.&amp;quot; Generally, the rule of thumb in distributed computing is that stateful objects are bad, and stateless is good. Today we'll explore the advantages of being stateless on the cloud and in concurrent programming.&lt;/p&gt;
&lt;p&gt; &lt;!--break--&gt;
&lt;p&gt;Last time, when we discussed &lt;a href="http://www.appistry.com/blogs/guerry/is-your-code-cloud-ready-and-multi-core-friendly-part-2-atomicity"&gt;Atomicity&lt;/a&gt;, I said this about distributed computing in the cloud:&lt;/p&gt;
&lt;p&gt;&amp;quot;For example, a general rule of thumb is that your code may execute anywhere in a distributed computing environment at a given time. If method A is called on an instance of object Foo on one server, and then if method B may be called on a different instance of object Foo on another server, then obviously any interdependency cannot be easily satisfied without additional overhead and effort. An example of such overhead falls under the topic of statefulness versus statelessness, which we'll discuss in part three of this series. Such overhead, if not handled correctly, can inhibit scalability and availability.&amp;quot;&lt;/p&gt;
&lt;p&gt;Today we'll examine scalability and availability in the context of stateless versus statefulness, and add to the discussion load balancing, reliability, and concurrency-safety.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;Statelessness&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;First, some definitions are in order. A stateless object does not hold information or context between calls on that object. In other words, each call on that object stands alone and does not have reliance on prior calls as part of an ongoing &amp;quot;conversation.&amp;quot; A caller could call a method on one instance of a stateless object, and then make a call on a different instance of the same object and not tell the difference. This does not mean that a stateless object does not deal with data or context, but rather it just does not hold it across multiple method calls, nor access it concurrent to other processes, be they distributed processes or local threads or processes.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;Statefulness&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Statefulness implies certain conditions. Take for example a stateful shopping cart object. Each instance of a stateful shopping cart object might represent an individual customer. Therefore, if we had a thousand customers shopping on a site, there would be, in theory, one thousand instances of the stateful shopping cart object. Therefore, to update the state of a given customer's shopping cart, we find the correct object for that customer, and make calls on it. This is the Neo the One version of statefulness. Only one object can do the job, and Morpheus must find it&amp;#8230;somewhere in the Matrix.&lt;/p&gt;
&lt;p&gt;Statefulness may also imply shared state. Shared state may be as simple as an object that is generally stateless in terms of member data (per instance values) and yet hold onto static data (per class values) that changes from method call to method call, and affects the outcome of subsequent method calls. The static data injects its importance into the conversation between callers and the object. Shared state gives rise to increased complexity whether shared across a cloud of computing resources, or across local threads or processes. &lt;/p&gt;
&lt;p&gt;Therefore, a general definition of statefulness is in order: a stateful object holds onto data, information or context that is important across the conversation of multiple calls on a given instance of that object, and multiple callers may need concurrent access to that state.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;Neo the One&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Stateless objects mean that the cloud or the multi-core environment is free to use any instance of an object to get the work done. Therefore, any instance of the called object can be Neo and we're good. From a design standpoint, this affects scalability, availability, load balancing, and reliability. Let's examine each.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;Statelessness and Scalability&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;In terms of scale in a distributed computing environment like the cloud, stateless objects mean that work can be load balanced onto the machine most suited to do it. With stateless objects, I do not have to worry about contention for a single instance of that object, a situation potentially leading to race conditions, dead lock, and starvation. I can just add more machines and let the work scale out horizontally onto them. If I am dependent on a single, golden instance of a stateful object, and it is getting all the attention from calling clients, then depending on the stateful model I'm using, I may or may not be creating a scalability bottleneck. But, no matter what stateful model I'm using, I do have more overhead than I likely would if I could have accomplished the same work without state.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;Statelessness and Availability&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;If my cloud environment is free to use any machine to get the work done, then I have very wide spread availability. In case of failure, the loss of any machine does not affect me, provided I have enough machines to continue. Again, if I am dependent on a single, golden instance of a stateful object, and the resources holding it goes down, now I have lost availability for that instance of that object, and have to reconstitute it, if possible, elsewhere, hopefully without loss of state. At a minimum, I have introduced complexity into my fabric application.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;Statelessness and Load Balancing&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;In terms of load balancing, if the cloud environment is free to use any machine to get the work done, then whatever machine has the least overhead can be given the work. If there is a single, golden instance of an object on a single machine, and it is getting all the attention from calling clients, then I may have both a load balance problem and a resource contention problem. The model of statefulness I am using will determine the severity and complexity of the problem, and determines whether I can spread the work to multiple machines sharing a cache of the same stateful instance of the object.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;Statelessness and Reliability&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The stateless model also bolsters a cousin of availability: reliability. Statelessness, coupled with a self-healing cloud environment affords us a lot of flexibility. In such an environment, if a machine goes down due to hardware failure then the work can continue with another instance of the object on another machine. I don't have to worry about loss of consistency or other complexity like I would if I depended on a now lost, stateful object.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;Statelessness and Concurrency Safety&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Stateful code in any form in a distributed or parallel environment requires being mindful of concurrency issues. Stateless code, on the other hand, is more likely (no guarantees of course) to be concurrency safe as you execute it across distributed nodes, multiple threads and cores. Stateless code also has more likelihood of being easier to execute across multiple processes instead of multiple threads, a model seen in Google's Chrome and Microsoft's IE 8 browsers where each tab is a process and not a thread.&lt;/p&gt;
&lt;p&gt;Concurrency&lt;b&gt;&lt;i&gt; &lt;/i&gt;&lt;/b&gt;safety is a complex topic, and I'm already running long on this post. So, rather than rambling on myself, I'll point you to a great article titled &amp;quot;&lt;a href="http://www.ibm.com/developerworks/library/j-jtp09238.html"&gt;Java theory and practice: Are all stateful Web applications broken? HttpSession and friends are trickier then they look&lt;/a&gt;,&amp;quot; by Brian Goetz. In his thesis, Goetz states &amp;quot;many web applications that use HttpSession for mutable data (such as JavaBeans classes) do so with insufficient coordination, exposing themselves to a host of potential concurrency hazards.&amp;quot;&lt;/p&gt;
&lt;p&gt;There's lots of that kind of code already out there, and it just gets more complex in distributed and multi-core parallel applications.&lt;/p&gt;
&lt;p&gt;See you next time for part four.&lt;/p&gt;
</description>
 <comments>http://www.appistry.com/blogs/guerry/is-your-code-cloud-ready-and-multi-core-friendly-pt-3-statelessness#comments</comments>
 <pubDate>Mon, 06 Oct 2008 21:18:29 +0000</pubDate>
 <dc:creator>guerry</dc:creator>
 <guid isPermaLink="false">455 at http://www.appistry.com/blogs</guid>
</item>
<item>
 <title>Is your code cloud-ready and multi-core friendly? (part 2): Atomicity</title>
 <link>http://www.appistry.com/blogs/guerry/is-your-code-cloud-ready-and-multi-core-friendly-part-2-atomicity</link>
 <description>&lt;p&gt;As part of an &lt;a href="http://www.appistry.com/blogs/guerry/is-your-code-cloud-ready-and-multi-core-friendly-part-1-introduction"&gt;ongoing series&lt;/a&gt;, we are discussing design principles that influence how ready our code is for distributed computing in the cloud, as well as for multi-core utilization. Today, we talk about...
&lt;p&gt;&lt;b&gt;&lt;i&gt;Atomicity&lt;a href="http://www.appistry.com/blogs/files/appcom/guerry/2008/09/558px-Electron_shell_079_Gold.svg_2.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; margin: 5px 0px 5px 5px; border-left: 0px; border-bottom: 0px" height="162" alt="558px-Electron_shell_079_Gold.svg" src="http://www.appistry.com/blogs/files/appcom/guerry/2008/09/558px-Electron_shell_079_Gold.svg_thumb.png" width="151" align="right" border="0" /&gt;&lt;/a&gt; &lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;An atomic piece of code is code with a specific, clearly defined purpose. In object-oriented terminology, it has &amp;quot;cohesion.&amp;quot; It's the pepperoni pizza and not the garbage pizza with everything. Likewise, atomic code can stand alone from the order of execution of other code. We&amp;#8217;ll explore different aspects of atomic code below.&lt;/p&gt;
&lt;p&gt; &lt;!--break--&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;Don't Lean on Me&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;First, though atomic code may require other libraries, its execution is self-contained. In other words, there are no call-level interdependencies. For example, if a call on method A must precede a call on method B and method B can&amp;#8217;t be called unless method A is called first, then A and B are not atomic separately. If there is interdependency across individual method calls, then your individual methods are not atomic, though they may form an atomic operation all together. &lt;/p&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;It&amp;#8217;s Simple, My Dear Watson&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Second, atomic code is concise by its nature, and, as stated above, has a specific, clearly defined purpose. Fat, hairy, do-multiple-things methods are not atomic. If a method serves multiple purposes, then the general rule is to break those purposes up into separate atomic methods.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;The Long and Winding Code&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The same holds true for long running methods. Long-running methods are not usually atomic. Perhaps the long running code has a single purpose, but if the long running method can be broken down into more atomic steps, then your gain flexibility when running that code in cloud environments or when utilizing multiple cores. &lt;/p&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;Flexibility and Control&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The choice to break our code down into more atomic steps is all about flexibility and control. Whether our code is executing across multiple cores on multiple threads or processes, or across multiple servers in a distributed computing environment, the choice to break our code down into atomic steps is about flexibility and control in terms of how our code can execute in these environments.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;Advantages of Atomic Code in Distributed Computing&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;For example, a general rule of thumb is that your code may execute anywhere in a distributed computing environment at a given time. If method A is called on an instance of object Foo on one server, and then if method B may be called on a different instance of object Foo on another server, then obviously any interdependency cannot be easily satisfied without additional overhead and effort. An example of such overhead falls under the topic of statefulness versus statelessness, which we&amp;#8217;ll discuss in part three of this series. Such overhead, if not handled correctly, can inhibit scalability and availability.&lt;/p&gt;
&lt;p&gt;In addition, some distributed computing environments plan for failure, indeed, expects there to be failure at any time when code is executing. When a power supply takes down a server in the middle of a method that does multiple things, and your distributed environment allows for automatic retries, what are the implications? How far did the method get in its work? Which steps were satisfied, and what was left undone? Atomic steps allow more fine grained levels of reliability and problem resolution.&lt;/p&gt;
&lt;p&gt;Long running code only makes this situation worse. Perhaps the long running code has a single purpose, but if it runs for a long time to achieve a single end, and the server running it dies ninety percent through, do you retry it from the beginning? Starting over is fine for some purposes, while in time critical work, it would be unacceptable. If the long running method can be broken down into more atomic steps, then your distributed application can perhaps snapshot progress along the way, and retry from failure mid-process more efficiently.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;Essential Value of Atomicity in Parallelism and Multi-core&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;In terms of parallelism and multi-core, Daniel Spiewak wrote an excellent entry on this very topic just this week on his &lt;a href="http://www.codecommit.com/"&gt;Code Commit&lt;/a&gt; blog (our friend &lt;a href="http://tech.puredanger.com/"&gt;Alex Miller&lt;/a&gt; twittered about the article). Daniel makes the argument that &lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&amp;#8220;there is actually a deeper question underlying concurrency: what operations do &lt;em&gt;not&lt;/em&gt; depend upon each other in a sequential fashion?&amp;#160; As soon as we identify these critical operations, we&amp;#8217;re one step closer to being able to effectively optimize a particular algorithm with respect to asynchronous processing.&amp;#8221;&lt;/p&gt;
&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Later in the article he states:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&amp;#8220;This is truly the defining factor of atomic computations: it may be possible to reorder a series of atomic computations, but such a reordering cannot affect the internals of these computations.&amp;#160; Within the &amp;#8220;atom&amp;#8221;, the order is fixed.&lt;/p&gt;
&lt;p&gt;&amp;#8220;So what does reordering have to do with concurrency?&amp;#160; Everything, as it turns out.&amp;#160; In order to implement an asynchronous algorithm, it is necessary to identify the parts of the algorithm which can be executed in parallel.&amp;#160; In order for one computation to be executed concurrently with another, neither must rely upon the other being at any particular stage in its evaluation.&amp;#8221;&lt;/p&gt;
&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;All of that should sound familiar at this point, and that serves as a good stopping point for now on the topic of atomicity. Here&amp;#8217;s the link to Daniel&amp;#8217;s whole article, which I &lt;i&gt;highly&lt;/i&gt; recommend: &lt;a href="http://www.codecommit.com/blog/scala/higher-order-fork-join-operators"&gt;http://www.codecommit.com/blog/scala/higher-order-fork-join-operators&lt;/a&gt;&lt;/p&gt;
</description>
 <comments>http://www.appistry.com/blogs/guerry/is-your-code-cloud-ready-and-multi-core-friendly-part-2-atomicity#comments</comments>
 <pubDate>Wed, 24 Sep 2008 17:25:46 +0000</pubDate>
 <dc:creator>guerry</dc:creator>
 <guid isPermaLink="false">451 at http://www.appistry.com/blogs</guid>
</item>
<item>
 <title>Stack Overflow, web 2.0 done right or How I've become an addicted stackhead</title>
 <link>http://www.appistry.com/blogs/guerry/stack-overflow-web-20-done-right-or-how-ive-become-addicted-stackhead</link>
 <description>&lt;p&gt;There are plenty of technical Q&amp;amp;A web sites out there.&amp;#160; We've all used them at one time or another, if not daily. Most often, I &lt;a href="http://stackoverflow.com/"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="67" alt="stackoverflow-logo-250" src="http://www.appistry.com/blogs/files/appcom/guerry/2008/09/stackoverflow-logo-250_5.png" width="240" align="right" border="0" /&gt;&lt;/a&gt;used sites, mailing lists and forums set up specifically for some tool I'm currently working with. In the past year, I've spent time on the &lt;a href="http://www.apache.org/foundation/mailinglists.html"&gt;Apache mailing lists&lt;/a&gt;, &lt;a href="http://codehaus.org/"&gt;the Codehaus&lt;/a&gt; support forums for some open source projects, and of course on our own &lt;a href="http://www.appistry.com/developers/"&gt;Peer2Peer developer community&lt;/a&gt;. Sites specific to a toolset or product like Peer2Peer tend to be focused and valuable.&amp;#160; However, generalist Q&amp;amp;A sites tend to devolve due under the Usenet effect and experience a &lt;a href="http://www.appistry.com/developers/"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px; border-right-width: 0px" height="26" alt="peer2peer_logo" src="http://www.appistry.com/blogs/files/appcom/guerry/2008/09/peer2peer_logo_5.gif" width="182" align="left" border="0" /&gt;&lt;/a&gt;high noise to signal ratio. Doesn't it drive you crazy to have to wade through piles of junk to find the golden nugget? I've been&amp;#160; tooling about on the &amp;quot;Internet&amp;quot; since the early 1980's, and I shudder to think how much time I've spent being the physical embodiment of a regular expression filter, looking for the right answer among the non-matches. &lt;/p&gt;
&lt;p&gt;Recently I found out about &lt;a href="http://stackoverflow.com/"&gt;Stack Overflow&lt;/a&gt;, a generalist programming Q&amp;amp;A site that gets it right. &lt;/p&gt;
&lt;p&gt; &lt;!--break--&gt;
&lt;p&gt;A while back I stumbled on the news that &lt;a href="http://www.codinghorror.com/blog/"&gt;Jeff Atwood (of Coding Horror fame)&lt;/a&gt;, and &lt;a href="http://www.joelonsoftware.com/"&gt;Joel Spolsky (yep, Joel on Software)&lt;/a&gt;, and &lt;a href="http://stackoverflow.com/about"&gt;friends&lt;/a&gt; (the gang is further down the &amp;quot;about&amp;quot; page), were teaming up to create a technical Q&amp;amp;A site for developers. They revealed that it would be a free site, and the more I learned about it via their podcast, and other sources, the more excited I got. I began watching for them to go live. &lt;/p&gt;
&lt;p&gt;I'm now a week into my beta membership, and I'm not excited anymore. I'm addicted. Why so?&lt;/p&gt;
&lt;p&gt;It's free, it's fast, and it doesn't require registration (see more below). &lt;/p&gt;
&lt;p&gt;And, I don't have to filter out the noise to find good answers. Why? Because Stack Overflow is a great example of Web 2.0 done right by delivering community driven content and value. &lt;/p&gt;
&lt;p&gt;On Stack Overflow, you don't just post questions and reply with answers. If you do choose to register (again free), you get to participate by voting questions and answers up and down in relevance. Also, you get to categorize them into topics, as well a flagging them as too subjective and non-specific. Subjective? Yep. Stack Overflow &lt;em&gt;cares&lt;/em&gt; about the relevance of the questions and value of the answers, and polices them via the community. As answers get voted up in relevance, they float to the top of the thread, right next to the question. Huzzah! No more reading long, irrelevant threads. &lt;/p&gt;
&lt;p&gt;Gee, that sounds like...work. Not really, they make it fun. You build karma with just about every action, and gain badges of recognition for your efforts. Their meritocracy approach seems to be dead on. You don't get a vote in the community until you have participated enough to gain fifteen karma points. However, that's not hard to achieve. One answer considered relevant by one other person, gains you around eleven points, so it's not hard to get involved. &lt;/p&gt;
&lt;p&gt;The Stack Overflow creators describe it as a synthesis of Wiki, Blog, Forum, and Digg/Reddit.&lt;/p&gt;
&lt;p&gt;Okay, enough! If you want to know more, and I've barely touched on the details, go to the Stack Overflow &lt;a href="http://stackoverflow.com/about"&gt;About page&lt;/a&gt;, and the &lt;a href="http://stackoverflow.com/faq"&gt;FAQ page&lt;/a&gt; to learn more. Several of us techie folks here at Appistry are becoming stackheads, so when you don't find us on &lt;a href="http://www.appistry.com/developers/"&gt;Peer2Peer&lt;/a&gt;, perhaps we'll see you over &lt;a href="http://stackoverflow.com/"&gt;there&lt;/a&gt;.&lt;/p&gt;
</description>
 <comments>http://www.appistry.com/blogs/guerry/stack-overflow-web-20-done-right-or-how-ive-become-addicted-stackhead#comments</comments>
 <category domain="http://www.appistry.com/blogs/taxonomy/term/180">community</category>
 <pubDate>Tue, 23 Sep 2008 18:36:49 +0000</pubDate>
 <dc:creator>guerry</dc:creator>
 <guid isPermaLink="false">450 at http://www.appistry.com/blogs</guid>
</item>
<item>
 <title>Dr. Podcast or How I Learned to Keep Commuting and Enjoy the Time, episode 2</title>
 <link>http://www.appistry.com/blogs/guerry/dr-podcast-or-how-i-learned-keep-commuting-and-enjoy-time-episode-2</link>
 <description>&lt;p&gt;This weeks audio picks features episodes from &lt;a href="http://twit.tv/FIB"&gt;Futures in Biotech with Marc Pelletier&lt;/a&gt;, one of several shows featured on the &lt;a href="http://www.appistry.com/blogs/files/appcom/guerry/2008/09/earth-rise-apollo8_2.jpg"&gt;&lt;img style="border-right: 0px; border-top: 0px; margin: 5px 0px 5px 5px; border-left: 0px; border-bottom: 0px" height="149" alt="earth-rise-apollo8" src="http://www.appistry.com/blogs/files/appcom/guerry/2008/09/earth-rise-apollo8_thumb.jpg" width="163" align="right" border="0" /&gt;&lt;/a&gt;&lt;a href="http://twit.tv/"&gt;TWiT.tv Netcast Network with Leo Laporte&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;TWiT.tv's history is pretty extensive, so I'll point you over to them to see &lt;a href="http://twit.tv/huh"&gt;what it's all about&lt;/a&gt;. These guys have a number of podcasts going on a regular basis. Besides Futures in Biotech, a random sampling of other topics are MacBreak Weekly, Daily Giz Wiz, Security Now, and Jumping Monkeys. I found TWiT.tv when I was reading up on &lt;a href="https://launchpad.net/drizzle"&gt;Drizzle&lt;/a&gt;, the current work coming from Brian Aker and other folks from the MySQL project. Brian was interviewed for &lt;a href="http://twit.tv/floss35"&gt;FLOSS Weekly 35&lt;/a&gt;, the weekly open source-oriented podcast at TWiT.tv.&lt;/p&gt;
&lt;p&gt; &lt;!--break--&gt;&lt;br /&gt;
&lt;h3&gt;AUDIO DU JOUR&lt;/h3&gt;
&lt;p&gt;Now on to this week's podcast picks from &lt;a href="http://twit.tv/FIB"&gt;Futures in Biotech&lt;/a&gt;. Marc Pelletier is a biotechnologist, and host of the podcast. The byline for Futures in Biotech is found on the &lt;a href="http://www.futuresinbiotech.com/"&gt;FiB site&lt;/a&gt;: &lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&amp;quot;This netcast explores the rapidly changing world of biotech, with a penchant towards getting a better understanding of who we are and where we are going. The living world will soon be a true substrate for engineering. Our world will change, and so will we.      &lt;br /&gt;We bring a first hand account from the scientists that are moving us into this new technological era - the era of biotech.&amp;quot;&lt;/p&gt;
&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;In prior blog posts here at Appistry, I've talked about my interest in the &lt;a href="http://www.appistry.com/blogs/guerry/cross-pollination-beehives-game-life-and-you"&gt;synthesis and cross-pollination of ideas between disciplines&lt;/a&gt;. Besides strictly&amp;#160; biotechnological topics, Marc has been interviewing folks from the space industry, another of my interests. He does this with the hope of exploring the cross-pollination between biotechnology and space sciences. For example, in &lt;a href="http://twit.tv/fib23"&gt;episode 23, he interviews Dr. Buzz Aldrin&lt;/a&gt;, one of the first to walk on the moon, and in &lt;a href="http://twit.tv/fib26"&gt;episode 26, he speaks with Dr. Harrison Schmitt&lt;/a&gt;, the last man to walk on the moon. Both men are still very active in mankind's reach into space. I'm a firm believer in the value that comes from space exploration, both in terms of knowledge gained, and the technological advances we all subsequently benefit from. Both interviews are excellent, and a great listen, and there are other space-related interviews that I've not gotten too yet.&lt;/p&gt;
&lt;p&gt;See you next week with more. Meanwhile, keep learning!&lt;/p&gt;
</description>
 <comments>http://www.appistry.com/blogs/guerry/dr-podcast-or-how-i-learned-keep-commuting-and-enjoy-time-episode-2#comments</comments>
 <category domain="http://www.appistry.com/blogs/sam/category/miscellany">miscellany</category>
 <category domain="http://www.appistry.com/blogs/bob/category/off+topic">off topic</category>
 <pubDate>Fri, 19 Sep 2008 17:05:38 +0000</pubDate>
 <dc:creator>guerry</dc:creator>
 <guid isPermaLink="false">449 at http://www.appistry.com/blogs</guid>
</item>
<item>
 <title>Is your code cloud-ready and multi-core friendly? (part 1): Introduction</title>
 <link>http://www.appistry.com/blogs/guerry/is-your-code-cloud-ready-and-multi-core-friendly-part-1-introduction</link>
 <description>&lt;p&gt;With the advent of cloud computing, the explosion in mobile devices and the growing availability of multi-core CPUs, there &lt;a href="http://www.appistry.com/blogs/files/appcom/guerry/2008/09/GotCray_2.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; margin: 5px 0px 5px 5px; border-left: 0px; border-bottom: 0px" height="120" alt="GotCray" src="http://www.appistry.com/blogs/files/appcom/guerry/2008/09/GotCray_thumb.png" width="123" align="right" border="0" /&gt;&lt;/a&gt; is a drive toward new models of how we design and develop code. Well, they&amp;#8217;re not &lt;em&gt;new&lt;/em&gt; really. Some of the models have been&amp;#160; around, and in use, but they are not typically practiced by mainstream developers...&lt;i&gt;yet&lt;/i&gt;.&lt;/p&gt;
&lt;p&gt; &lt;!--break--&gt;
&lt;p&gt;&lt;a href="http://www.appistry.com/blogs/michael"&gt;Michael&lt;/a&gt; blogged about this trend in his blog post &lt;a href="http://www.appistry.com/blogs/michael/microsoft-says-you-need-change-how-your-are-building-your-applications"&gt;&amp;#8220;Microsoft says you need to change how you are building your applications.&amp;#8221;&lt;/a&gt; You should pop over and read the whole post, but here is part of what he said: &lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&amp;#8220;I was surprised how many speakers [at Microsoft TechEd 2008] were conveying the same message:&amp;#160; &lt;/p&gt;
&lt;p&gt;&amp;#8216;CPU speeds are topping out.&amp;#160; If you want your applications to run faster and better you are going to have to build your applications in a new way.&amp;#160; The solution isn't just to learn how to multi-thread your applications.&amp;#160; The solution lies in building your applications into smaller units of code called tasks that can be moved around to the different cores of a multi-core machine.&amp;#8217;&lt;/p&gt;
&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Following that up, Michael quoted Bill Gates' keynote speech and added his own comment:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;The... &amp;#8216;need to take programs and break them down into parallel execution units now becomes absolutely necessary.&amp;#8217;&lt;/p&gt;
&lt;p&gt;This statement was music to my ears.&amp;#160; Why?&amp;#160; It is the same model that we have been using for fabric computing since our beginnings in 2001.&amp;#160; Now we are starting to see this message more and more as cloud computing is gaining acceptance.&amp;#8221;&lt;/p&gt;
&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;For our code to meet the demands of computing in a cloud-based, multi-core world, we'll need to design our code with the following attributes in mind:&lt;/p&gt;
&lt;p&gt;&amp;#183; &lt;a href="http://www.appistry.com/blogs/guerry/is-your-code-cloud-ready-and-multi-core-friendly-part-2-atomicity"&gt;Atomicity&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;#183; &lt;a href="http://www.appistry.com/blogs/guerry/is-your-code-cloud-ready-and-multi-core-friendly-pt-3-statelessness"&gt;Statelessness&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;#183; &lt;a href="http://www.appistry.com/blogs/guerry/your-code-cloud-ready-and-multi-core-friendly-pt-4-idempotence"&gt;Idempotence&lt;/p&gt;
&lt;p&gt;&lt;/a&gt;
&lt;p&gt;&amp;#183; &lt;a href="http://www.appistry.com/blogs/guerry/parallelism-your-code-cloud-ready-and-multi-core-friendly-part-5"&gt;Parallelism&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;That's a mouthful. In a continuing series, we will examine what each means and what it gets us.&lt;/p&gt;
</description>
 <comments>http://www.appistry.com/blogs/guerry/is-your-code-cloud-ready-and-multi-core-friendly-part-1-introduction#comments</comments>
 <pubDate>Fri, 19 Sep 2008 15:46:26 +0000</pubDate>
 <dc:creator>guerry</dc:creator>
 <guid isPermaLink="false">448 at http://www.appistry.com/blogs</guid>
</item>
<item>
 <title>Dr. Podcast or How I Learned to Keep Commuting and Enjoy the Time, episode I</title>
 <link>http://www.appistry.com/blogs/guerry/dr-podcast-or-how-i-learned-keep-commuting-and-enjoy-time-episode-i</link>
 <description>&lt;p&gt;I commute daily. Many of my coworkers joke that I live on the other side of the state. It probably feels that way when many of them live five&amp;#160; &lt;a href="http://www.appistry.com/blogs/files/appcom/guerry/2008/09/Treasure-island01_2.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; margin: 5px; border-left: 0px; border-bottom: 0px" height="184" alt="Treasure-island01" src="http://www.appistry.com/blogs/files/appcom/guerry/2008/09/Treasure-island01_thumb.png" width="139" align="right" border="0" /&gt;&lt;/a&gt;minutes from work. However, for our family, its a lifestyle choice, and so I spend at least two hours a day on the road (I can hear the &lt;em&gt;real &lt;/em&gt;commuters out there going, &amp;quot;Wuss! Two hours?&amp;quot;). That's when I discovered the world of free (and legal) audio on the Internet.&lt;/p&gt;
&lt;p&gt; &lt;!--break--&gt;
&lt;p&gt;Back in 2005, &lt;a href="http://www.pbs.org/cringely/"&gt;Robert X. Cringely&lt;/a&gt; and friends introduced &lt;a href="http://www.pbs.org/cringely/nerdtv/"&gt;NerdTV&lt;/a&gt;, a great series of interviews with technology industry luminaries. NerdTV made the interviews available under a creative commons license, and in all sorts of formats. I began burning CDs of the weekly interviews, and listening to them on the commute. &lt;/p&gt;
&lt;p&gt;I guess it was a revelation for me. What a great idea! I expanded from there, listening to all sorts of stuff, though still burning it to CD (the iPod-toting expert commuters are shaking their heads in shame). Also about that time, my sister-in-law and her family gave us a CD-based set of college lectures about &lt;a href="http://www.teach12.com/ttcx/CourseDescLong2.aspx?cid=3317"&gt;Greek history&lt;/a&gt; from &lt;a href="http://www.teach12.com/teach12.aspx"&gt;The Teaching Company&lt;/a&gt;. It was awesome, and I was firmly hooked. But, the CD burning thing was getting tiresome. &lt;/p&gt;
&lt;p&gt;Ultimately, my wife saved me from myself, and got my son and I SanDisk Sansa MP3 players. She also got me one of those handy FM transmitters that let you listen to the player via the in-car sound system. Since then, I've been using the daily commute to explore all sorts of topics, current events, and catch up on a lot of fiction reading. And my son and I have been exchanging all sorts of free audio treasures that we find on the Internet.&lt;/p&gt;
&lt;p&gt;There's a lot of free, public domain stuff out there, in addition to the multitudes of free podcasts. So, I thought, why not share around our discoveries. Each Friday, I'll post about free audio and audio sites we've found on the Internet. I hope you get the kick out of it that I have.&lt;/p&gt;
&lt;h3&gt;&lt;a href="http://www.appistry.com/blogs/files/appcom/guerry/2008/09/Treasure-Island-map_4.jpg"&gt;&lt;img style="border-right: 0px; border-top: 0px; margin: 5px; border-left: 0px; border-bottom: 0px" height="219" alt="Treasure-Island-map" src="http://www.appistry.com/blogs/files/appcom/guerry/2008/09/Treasure-Island-map_thumb_1.jpg" width="142" align="left" border="0" /&gt;&lt;/a&gt;Audio du Jour&lt;/h3&gt;
&lt;p&gt;&amp;#160; Speaking of treasures reminded me of one of the first things my son recommended to me: &amp;quot;&lt;a href="http://librivox.org/treasure-island-by-robert-louis-stevenson-2/"&gt;Treasure Island&lt;/a&gt;&amp;quot; by &lt;a href="http://librivox.org/newcatalog/search.php?title=&amp;amp;author=Robert+Louis+Stevenson&amp;amp;action=Search"&gt;Robert Louis Stevenson&lt;/a&gt;, and read by &lt;a href="http://www.sonoma.edu/asc/"&gt;Adrian Praetzellis&lt;/a&gt;. I'd never taken time to read the book, and had always wanted to (now my English teachers are shaking their heads). It's a great treat! Also, Adrian Praetzellis is &lt;em&gt;incredible&lt;/em&gt; as a voice actor. Every voice of every character is distinct and you know darn well who is speaking at any point. I highly recommend this one.&lt;/p&gt;
&lt;p&gt;This free audio book is found, as you notice if you click through, on &lt;a href="http://librivox.org/"&gt;LibriVox.org&lt;/a&gt;. LibriVox utilizes volunteers to record materials in the public domain. If bits had weight, then LibriVox would have tons of audio. Yeah. Anyway, it's an awesome site, and in subsequent weeks, we'll delve for other treasures to be found there.&lt;/p&gt;
&lt;p&gt;See you next Friday with more. &lt;/p&gt;
</description>
 <comments>http://www.appistry.com/blogs/guerry/dr-podcast-or-how-i-learned-keep-commuting-and-enjoy-time-episode-i#comments</comments>
 <category domain="http://www.appistry.com/blogs/sam/category/miscellany">miscellany</category>
 <category domain="http://www.appistry.com/blogs/bob/category/off+topic">off topic</category>
 <pubDate>Fri, 12 Sep 2008 18:47:14 +0000</pubDate>
 <dc:creator>guerry</dc:creator>
 <guid isPermaLink="false">447 at http://www.appistry.com/blogs</guid>
</item>
<item>
 <title>Forecast: Cloudy Today, Cloudier Tomorrow</title>
 <link>http://www.appistry.com/blogs/guerry/forecast-cloudy-today-cloudier-tomorrow</link>
 <description>&lt;p&gt;Way back in my first &lt;a href="http://www.appistry.com/blogs/"&gt;Appistry blog&lt;/a&gt; post, &lt;a href="http://www.appistry.com/blogs/guerry/cross-pollination-beehives-game-life-and-you"&gt;&amp;quot;Cross-pollination, Beehives, the Game of Life, &lt;a href="http://groups.google.com/group/cloud-computing"&gt;&lt;img style="border-right: 0px; border-top: 0px; margin: 10px; border-left: 0px; border-bottom: 0px" height="102" alt="Cloud Computing at Google Groups" src="http://www.appistry.com/blogs/files/appcom/guerry/2008/09/icon_3_1.png" width="102" align="right" border="0" /&gt;&lt;/a&gt;and You,&lt;/a&gt;&amp;quot; I wrote about synthesis. I always find it fascinating how ideas morph, migrate across disciplines, and concepts either over time, or in a single, &amp;quot;eureka&amp;quot; instant. Cloud computing is an excellent example. Cloud computing is the new &amp;quot;next&amp;quot;&amp;#160;&amp;#160; thing coming tomorrow. However, much of the technology behind the cloud is mature and ready &lt;em&gt;today&lt;/em&gt;.&lt;!--break--&gt; &lt;/p&gt;
&lt;p&gt;I was catching up on discussion threads over in the &lt;a href="http://groups.google.com/group/cloud-computing"&gt;cloud-computing Google group&lt;/a&gt;&amp;#160; (an almost impossible task, it's a &lt;em&gt;very&lt;/em&gt; active group). Reuven Cohen posted a thread titled &amp;quot;Cloudbursting.&amp;quot; Cloudburst is a great term that several have applied to the problem of spikes in demand on systems. Cloudbursting is just one of many SLAs that cloud computing looks to solve. &lt;/p&gt;
&lt;p&gt;Now, cloudbursting is a great topic, but what really caught my attention was a fork in Reuven's thread that began with this statement by Bill Barr: &lt;/p&gt;
&lt;p&gt;&amp;quot;I&amp;#8217;m feeling really old &amp;#8230; these problems were solved and solutions built, last century. Most of these products and tools have pretty much been sitting on the shelf for over a decade, waiting for the industry to catch up.&amp;quot;&lt;/p&gt;
&lt;p&gt;The discussion that followed elicited a number of comments about the state of cloud computing technologies, and reflecting on the fact that some key cloud computing technologies have been around for years, but had not really taken off until the cloud synthesis occurred. Several posts from folks from different companies echoed the same sentiment, but this pithy comment from Reuven captures the point nicely:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.appistry.com/blogs/files/appcom/guerry/2008/09/Red_Color_in_Gray_Clouds_4.jpg"&gt;&lt;img style="border-right: 0px; border-top: 0px; margin: 10px; border-left: 0px; border-bottom: 0px" height="224" alt="Cloudy Today, Not Just Tomorrow" src="http://www.appistry.com/blogs/files/appcom/guerry/2008/09/Red_Color_in_Gray_Clouds_thumb.jpg" width="294" align="left" border="0" /&gt;&lt;/a&gt;&amp;quot;The answer is they [technologies on the leading edge] were too early. I first came up with elastic computing 5 years ago, nobody cared. Now the phone rings off the hook. What's changed?&amp;quot; &lt;/p&gt;
&lt;p&gt;Of course what has changed is that the synthesis of ideas behind cloud computing is communicating the importance of practices and technologies for all the players. Many of us involved in defining what cloud computing is or isn't, recognize that a number of technologies and disciplines are coming together. There is no &amp;quot;one-stop&amp;quot; shop &lt;em&gt;yet&lt;/em&gt; for implementing a complete cloud computing architecture, either on the public cloud or in private clouds. However, many of the technologies needed have indeed been around for a few years, and have been touting their message for some time, a message that now resonates with the synthesis that is cloud computing. &lt;/p&gt;
&lt;p&gt;Savvy shops don't have to wait until &amp;quot;tomorrow&amp;quot; for cloud computing technologies to mature. Many of the underlying technologies are here, and ready, today.&amp;#160; &lt;/p&gt;
&lt;p&gt;We founded Tsunami Research (the company that&amp;#160; Appistry) seven years ago today on September 10, 2001. The second day of our company was 9/11, a fact that solemnly influenced a lot of our design decisions and thoughts. &lt;a href="http://www.appistry.com/products/eaf/index.html"&gt;Appistry EAF&lt;/a&gt; was designed from the beginning to address the issues that are the bread and butter of cloud computing discussions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Commodity-computing &lt;/li&gt;
&lt;li&gt;Distributed architectures &lt;/li&gt;
&lt;li&gt;Application virtualization &lt;/li&gt;
&lt;li&gt;Virtualized management &lt;/li&gt;
&lt;li&gt;Automated software deployment and versioning &lt;/li&gt;
&lt;li&gt;Reliability and Availability &lt;/li&gt;
&lt;li&gt;Scaling out horizontally and linearly &lt;/li&gt;
&lt;li&gt;Scaling up to maximize use of CPU cores &lt;/li&gt;
&lt;li&gt;Self-organizing and self-healing design that expects problems and deals with it &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To name just a few....&lt;/p&gt;
&lt;p&gt;So, cloud computing may be the new, next big thing of tomorrow, but &lt;a href="http://www.appistry.com/products/eaf-community-edition/index.html"&gt;go give it a spin today&lt;/a&gt;.&lt;/p&gt;
</description>
 <comments>http://www.appistry.com/blogs/guerry/forecast-cloudy-today-cloudier-tomorrow#comments</comments>
 <category domain="http://www.appistry.com/blogs/sam/category/appistry">Appistry</category>
 <category domain="http://www.appistry.com/blogs/sam/category/cloud-computing">cloud computing</category>
 <category domain="http://www.appistry.com/blogs/sam/category/distributed-computing">distributed computing</category>
 <pubDate>Wed, 10 Sep 2008 22:51:53 +0000</pubDate>
 <dc:creator>guerry</dc:creator>
 <guid isPermaLink="false">446 at http://www.appistry.com/blogs</guid>
</item>
<item>
 <title>A Stroll with Groovy (part II) : Groovy Has Class</title>
 <link>http://www.appistry.com/blogs/guerry/a-stroll-with-groovy-part-ii-groovy-has-class</link>
 <description>&lt;p&gt;In part I we explored Groovy by writing a simple script that approximated the value of PI using the Monte Carlo method. In&amp;#160; &lt;a href="http://www.appistry.com/blogs/files/appcom/guerry/2008/08/groovy_medium_2.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="70" alt="groovy_medium" src="http://www.appistry.com/blogs/files/appcom/guerry/2008/08/groovy_medium_thumb.png" width="142" align="right" border="0" /&gt;&lt;/a&gt;this installment I want to explore creating classes in Groovy. We'll refactor our script and move some of the logic that lends itself to parallel processing into a simple Groovy class.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt; Here's our original groovy script:   &lt;/p&gt;
&lt;pre&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-text"&gt;package com.appistry.demo.groovy 
&amp;nbsp;
totalPoints = 500000 
generator = new Random(System.currentTimeMillis()) 
pointsInCircle = 0 
&amp;nbsp;
&amp;lt;font color=&amp;quot;#ff0000&amp;quot;&amp;gt;totalPoints.times { 
  double x = generator.nextDouble() 
  double y = generator.nextDouble() 
  if (Math.sqrt(x * x + y * y) &amp;amp;lt;= 1) 
    pointsInCircle++ 
}&amp;lt;/font&amp;gt; 
&amp;nbsp;
pi = 4.0 * pointsInCircle / totalPoints 
&amp;nbsp;
println &amp;amp;quot;\nApproximating PI using Monte Carlo Method&amp;amp;quot; 
println &amp;amp;quot;Points Attempted : &amp;amp;quot; + totalPoints 
println &amp;amp;quot;Points in Circle : &amp;amp;quot; + pointsInCircle 
println &amp;amp;quot;  Approximate PI : &amp;amp;quot; + pi&lt;/pre&gt;&lt;/div&gt;&lt;/pre&gt;&lt;p&gt;The point generation loop (marked in &lt;font color="#ff0000"&gt;red&lt;/font&gt;) is the target of our refactoring. We can dole that logic out to multiple cores and/or multiple machines to efficiently generate a &lt;em&gt;lot&lt;/em&gt;&amp;#160; of points in parallel if we want to. So we'll start simply and pull that loop out into a Groovy class. We'll have to bring along some variables also. Here's our new PointGenerator class: &lt;/p&gt;
&lt;pre&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-text"&gt;package com.appistry.demo.groovy
&amp;nbsp;
class PointGenerator {
&amp;nbsp;
  static computePoints(totalPoints)
  {
    def x, y
    def pointsInCircle = 0
    def generator = 
      new Random(System.currentTimeMillis())
&amp;nbsp;
    totalPoints.times {
      x = generator.nextDouble()
      y = generator.nextDouble()
      if (Math.sqrt(x * x + y * y) &amp;amp;lt;= 1)
        pointsInCircle++
    }
    return pointsInCircle 
  }
}&lt;/pre&gt;&lt;/div&gt;&lt;/pre&gt;&lt;p&gt;So what did we learn? &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;As mentioned last time, Groovy maps to Java's package scheme, and I'm choosing to use it here. &lt;/li&gt;
&lt;li&gt;We define a public class PointGenerator. It has no constructor. This simple class doesn't need one, so we'll get off into Groovy's constructors at a later time. &lt;/li&gt;
&lt;li&gt;We define a static method computePoints which takes totalPoints. Groovy classes also support non-static methods and member variables of course, but we don't have any interesting ones yet. &lt;/li&gt;
&lt;li&gt;Groovy supports both &lt;a href="http://en.wikipedia.org/wiki/Duck_typing#In_Groovy"&gt;duck typing&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Strong_typing"&gt;strong typing&lt;/a&gt; of data. Throughout our new method, I've not specified datatypes explicitly. Groovy gives you the flexibility of stating a type if you wish. I could have restricted x and y down to doubles. Indeed, if you look back at my original script, I did just that. In the case of the class, I used the &amp;quot;def&amp;quot; directive to declare x and y. Nominally, to a Java developer, &amp;quot;def&amp;quot; is like declaring &amp;quot;Object&amp;quot; to declare a variable, and this is where Groovy's duck typing support comes in.&amp;#160; &lt;/li&gt;
&lt;li&gt;One last note on &amp;quot;def,&amp;quot; you may have noticed that in the script, totalPoints is initialized without using def, whereas in my class method I used it. That's because in the class definition, def is required. &lt;/li&gt;
&lt;li&gt;Like Ruby and other dynamic languages, a Groovy method returns the last evaluated expression as its return value, unless there is an explicit return statement. In our case, the last evaluated expression, I believe, is totalPoints.times which returns null. So, we explicitly return pointsInCircle. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now that we've moved that logic into a class, here's our reworked script (with the changed line in &lt;font color="#ff0000"&gt;red&lt;/font&gt;) using the new Groovy class. &lt;/p&gt;
&lt;pre&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-text"&gt;package com.appistry.demo.groovy
&amp;nbsp;
totalPoints = 500000
&amp;lt;font color=&amp;quot;#ff0000&amp;quot;&amp;gt;pointsInCircle = PointGenerator.computePoints(totalPoints)&amp;lt;/font&amp;gt;
pi = 4.0 * pointsInCircle / totalPoints
&amp;nbsp;
println &amp;amp;quot;\nComputing PI using Monte Carlo Method&amp;amp;quot;
println &amp;amp;quot;Points Attempted : &amp;amp;quot; + totalPoints
println &amp;amp;quot;Points in Circle : &amp;amp;quot; + pointsInCircle
println &amp;amp;quot;  Approximate PI : &amp;amp;quot; + pi&lt;/pre&gt;&lt;/div&gt;&lt;/pre&gt;&lt;p&gt;We'll save the modified script off to compute_pi2.groovy and give it a spin. &lt;/p&gt;
&lt;pre&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-text"&gt;$ groovy compute_pi2.groovy
Caught: groovy.lang.MissingPropertyException: 
     No such property: PointGenerator for class: 
     com.appistry.demo.groovy.compute_pi2
     at com.appistry.demo.groovy.compute_pi2.main(compute_pi2.groovy)&lt;/pre&gt;&lt;/div&gt;&lt;/pre&gt;&lt;p&gt;Whoops, no joy. Groovy can't find our new PointGenerator class that the script uses. We need to compile our Groovy class first. &lt;/p&gt;
&lt;pre&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-text"&gt;$ groovyc PointGenerator.groovy
&amp;nbsp;
$&lt;/pre&gt;&lt;/div&gt;&lt;/pre&gt;&lt;p&gt;If you poke around now, you'll see a new package directory structured created in the current directory. You'll see two files down there: &lt;/p&gt;
&lt;pre&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-text"&gt;$ ls com/appistry/demo/groovy/
PointGenerator$_computePoints_closure1.class  PointGenerator.class&lt;/pre&gt;&lt;/div&gt;&lt;/pre&gt;&lt;p&gt;The PointGenerator.class is our Groovy class compiled down to a regular Java class file. The word &amp;quot;closure&amp;quot; imbedded in the name PointGenerator$_computePoints_closure1.class tells us a little bit about how closures are handled in Groovy. Incidently, the &lt;a href="http://groovy.codehaus.org/"&gt;Groovy homepage&lt;/a&gt; has lots of information about &lt;a href="http://groovy.codehaus.org/Closures+-+Formal+Definition"&gt;closures and the advantages they give over Java's anonymous inner classes&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Okay, let's try it again: &lt;/p&gt;
&lt;pre&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-text"&gt;$ groovy compute_pi2.groovy
&amp;nbsp;
Computing PI using Monte Carlo Method
Points Attempted : 500000
Points in Circle : 392558
  Approximate PI : 3.140464&lt;/pre&gt;&lt;/div&gt;&lt;/pre&gt;&lt;p&gt;Okay, so I've learned a bit about creating classes in Groovy. There's still a lot of unexplored territory around &lt;a href="http://groovy.codehaus.org/JN2525-Classes"&gt;Groovy classes, constructors, and scoping&lt;/a&gt;, and what not, all of which is covered by the excellent examples and docs on the &lt;a href="http://groovy.codehaus.org/"&gt;Groovy homepage&lt;/a&gt;. I'll leave that to those that want to dig further. &lt;/p&gt;
&lt;p&gt;Next time I'll hare off in a different direction with Groovy.&lt;/p&gt;
</description>
 <comments>http://www.appistry.com/blogs/guerry/a-stroll-with-groovy-part-ii-groovy-has-class#comments</comments>
 <pubDate>Mon, 25 Aug 2008 21:11:13 +0000</pubDate>
 <dc:creator>guerry</dc:creator>
 <guid isPermaLink="false">439 at http://www.appistry.com/blogs</guid>
</item>
</channel>
</rss>
