<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4556017295143623721</id><updated>2012-01-07T02:11:42.479+05:30</updated><category term='linux'/><category term='clustering'/><category term='hibernate'/><category term='jxpath'/><category term='tech'/><category term='java'/><category term='erlang'/><category term='ajax'/><category term='josql'/><category term='nagios'/><category term='dilbert'/><category term='multicore'/><category term='youtube'/><category term='terracotta'/><category term='links'/><category term='office space'/><category term='flex'/><category term='samples'/><category term='oracle'/><category term='student'/><category term='android'/><category term='online TV'/><category term='administration'/><category term='performance monitoring'/><category term='sniper twins'/><category term='quaere'/><category term='performance'/><category term='fun'/><category term='ubuntu'/><category term='google'/><category term='jamon'/><title type='text'>Tushar Khairnar's Tech Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>44</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-145022029216475091</id><published>2010-10-19T23:16:00.003+05:30</published><updated>2010-10-19T23:24:22.105+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>lucene-bytebuffer</title><content type='html'>&lt;span style="font-weight:bold;"&gt;What is lucene-bytebuffer.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://code.google.com/p/lucene-bytebuffer/"&gt;lucene-bytebuffer&lt;/a&gt; is Lucene Directory implementation using Direct ByteBuffer. Directory in lucene is backing storage for index. Lucene uses directory for storing index contents. So there is RAMDirectory, FileDirectory, MemoryMappedFileDirectory, NIODirectory each presenting various different options. lucene-bytebuffer will allow in-memory index to grow upto several gigabytes without incurring garbage collection cost.&lt;br /&gt;&lt;br /&gt;Mostly indexes are 90 to 95% read and 2-5% write ie. index hardly changes. If index is huge it will cost a lot in terms Garbage Collection CPU cycles. RAMDirectory holds arrays of size 1024 so for 1GB index its 1 million array objects. So as size gets increased in-memory index performance degrades due to garbage collection. &lt;br /&gt;&lt;br /&gt;What if you want to index say 5GB data? Use off-heap bytebuffer backed directory.&lt;br /&gt;&lt;br /&gt;Another question is why would you want to use lucene in-memory indexing. May be as Cache which can be queried on more than one property of object indexed?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-145022029216475091?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/145022029216475091/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=145022029216475091' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/145022029216475091'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/145022029216475091'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2010/10/lucene-bytebuffer.html' title='lucene-bytebuffer'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-8519463759289615901</id><published>2010-10-19T22:56:00.005+05:30</published><updated>2010-10-21T21:51:34.612+05:30</updated><title type='text'>jmalloc : Manual Memory Management in java</title><content type='html'>One of the definitive advantage of Java over C++ is automatic memory management. Automatic memory management also has its cost tough. This cost was high in earlier versions of JDK(Serial stop the world garbage collection)  but now it has been much improved : parallel and concurrent collections. In some cases this cost is so high that manual memory management is the answer. &lt;a href="http://code.google.com/p/jmalloc/"&gt;jmalloc&lt;/a&gt; is one such simple effort.&lt;br /&gt; &lt;br /&gt;GC pain point in java, a limiting factor in many cases. Garbage collection tuning in java is considered as black art and very difficult to tune.&lt;br /&gt;&lt;br /&gt;Caching provides performance boost for lot of application. Caching of large data is restrictive because caching mostly is very small part of application logic but it costs relatively more in terms GC impact. JVM don't perform well predictively beyond size of 4GB. Cache is typical - it holds objects with predictable life cycle. Some objects infact live through-out the application life such as &lt;span style="font-style:italic;"&gt;"reference data"&lt;/span&gt; which does not change and remain cached. Such objects are also problematic for GC, they get promoted to old generation and scanned in every Full garbage collection wasting CPU. Terracotta has addressed similar problem using direct ByteBuffer. jmalloc also does the same thing for ehcache.&lt;br /&gt;&lt;br /&gt;BigMemory benchmark claims to have been scaled upto 350 GB of cache on beefy server. BigMemory has shown that garbage collection that java offers is not sufficient for some use-cases like Caching. Caching modifies object only two times : Put on Cache and Eviction from Cache. This is typical case of &lt;span style="font-weight:bold;"&gt;manual memory management&lt;/span&gt;. jmalloc is manual memory management of direct buffers with two simple routines : malloc and free. Direct buffers are not visible to java garbage collection. Thus object stored in directbyte buffer lives as long as its ByteBuffer reference is not collected. jmalloc allocates a single ByteBuffer and divides it into many variable size chunks where objects are serialized and stored.&lt;br /&gt;&lt;br /&gt;This is just start. Apart from generic malloc/free metods, I am planning to write a helper class for ehcache which will wrap ehcache so that all benefits like eviction, disk based overflow are available but the object is stored in&lt;br /&gt;&lt;br /&gt;If you like the idea let me know.&lt;br /&gt;..&lt;br /&gt;Tushar&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-8519463759289615901?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/8519463759289615901/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=8519463759289615901' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/8519463759289615901'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/8519463759289615901'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2010/10/jmalloc-manual-memory-management-in.html' title='jmalloc : Manual Memory Management in java'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-92429034737419770</id><published>2010-09-16T23:40:00.006+05:30</published><updated>2010-10-01T14:02:32.771+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='terracotta'/><title type='text'>BigMemory - Memory with no garbage collection overhead How?</title><content type='html'>I just came to know about BigMemory. After reading description and Terracotta CTO Ari's &lt;a href="http://blog.terracottatech.com/2010/09/bigmemory_explained_a_bit.html&lt;br /&gt;"&gt;blog&lt;/a&gt; I wondered how does it work? BigMemory stores object in memoey without any garbage collection tax and stores it in native memory. It means you are no longer bound by JVM heap limit and you can use all memory (which is dirt cheap) available. And all this in Plain Java. No JNI. &lt;br /&gt;&lt;br /&gt;I mean how did it happened that If there was technique available why cant any available cache framework used it? By implementing the this technique along with complete memory manager, Terracotta thus showed that its indeed leader in distributed cache. Why spent effort in optimizing garbage collection times which is a black art.&lt;br /&gt;&lt;br /&gt;Lets assume that We have such mechanism which allows us to store java objects in native memory. So how do we implement BigMemory like system. Let's focus just on Cache usecase . You need to track objects in cache. But Object tracking is quite easy in cache usecase.  They are removed directly by cache eviction threads or user so ultimately its map.remove(key).&lt;br /&gt;&lt;br /&gt;So how does BigMemory work?. This is just my guess. It may be using Direct ByteBuffers. I did some googling around allocating native memory in JVM and found this &lt;a href="http://www.ibm.com/developerworks/java/library/j-nativememory-linux/"&gt;article&lt;/a&gt;. and Yes Direct ByteBuffers are stored in Native memory. So below is my little shot at mimicking BigMemory. Basically each object is converted in ByteBuffer and stored in ByteBuffer. Some time and  memory can further be saved by using faster and more smart serialization techniques.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public Object put(K key, V value){&lt;br /&gt;  try {&lt;br /&gt;   ByteArrayOutputStream baos = new ByteArrayOutputStream();&lt;br /&gt;   ObjectOutputStream stream  = new ObjectOutputStream(baos);&lt;br /&gt;   stream.writeObject(value);&lt;br /&gt;   stream.close();&lt;br /&gt;   byte b[] = baos.toByteArray();&lt;br /&gt;   ByteBuffer buffer = ByteBuffer.allocateDirect(b.length);&lt;br /&gt;   ByteBuffer buffer2 = map.put(key, buffer);&lt;br /&gt;   if(buffer2!=null){&lt;br /&gt;    ByteArrayInputStream bais = new ByteArrayInputStream(buffer2.array());  &lt;br /&gt;    ObjectInputStream oois = new ObjectInputStream(bais);&lt;br /&gt;    V object = (V)oois.readObject();&lt;br /&gt;    oois.close();&lt;br /&gt;    return object;&lt;br /&gt;   }&lt;br /&gt;   else return null;   &lt;br /&gt;  } catch (IOException e) {&lt;br /&gt;   e.printStackTrace();&lt;br /&gt;   throw new RuntimeException(e);&lt;br /&gt;  } catch (ClassNotFoundException e) {&lt;br /&gt;   e.printStackTrace();&lt;br /&gt;   throw new RuntimeException(e);&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public V get(Object key){&lt;br /&gt;  try{&lt;br /&gt;   ByteBuffer buffer2 = map.get(key);&lt;br /&gt;   if(buffer2!=null){&lt;br /&gt;    ByteArrayInputStream bais = new ByteArrayInputStream(buffer2.array());  &lt;br /&gt;    ObjectInputStream oois = new ObjectInputStream(bais);&lt;br /&gt;    V object = (V)oois.readObject();&lt;br /&gt;    oois.close();&lt;br /&gt;    return object;&lt;br /&gt;   }&lt;br /&gt;   else return null;&lt;br /&gt;  }catch (IOException e) {&lt;br /&gt;   e.printStackTrace();&lt;br /&gt;   throw new RuntimeException(e);&lt;br /&gt;  } catch (ClassNotFoundException e) {&lt;br /&gt;   e.printStackTrace();&lt;br /&gt;   throw new RuntimeException(e);&lt;br /&gt;  } &lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The solution above stores keys in JVM heap and objects on non-heap memory. So If number of objects are 2M, JVM only has overhead of 2M objects while doing GC and not 4M ( in case of Map and 4-5M in case of EHCACHE where object is serialized and wrapped in ehcache Element object). This can be even further reduced by implementing some sort of hashing. Key is hashed into one of the buckets which are serialized and stored in buffers. You de-serialise bucket metadata and then iterate though it to find out actual buffer and then locate element. But BigMemory &lt;span style="font-weight:bold;"&gt;is just not cache&lt;/span&gt; its entire object graph storage.&lt;br /&gt;&lt;br /&gt;Thus version presented here is poor man's BigMemory compared to what BigMemory will have but it still can save hugh GC tuning efforts in cases where there is hugh memory requirement in the application and thus heavy garbage collection. But Terracotta's BigMemory would be with much more smart strategies and data structures, integrated with distributed garbage collector and implementing all cluster semantics as all other terracotta clustered data structure do. Waiting for integration of BigMemory into Terracotta server. Memory has been one of the biggest paint points in Terracotta. That would give Terracotta unlimited-scalability in terms of number of distributed objects stored.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-92429034737419770?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/92429034737419770/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=92429034737419770' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/92429034737419770'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/92429034737419770'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2010/09/bigmemory-memory-with-no-garbage.html' title='BigMemory - Memory with no garbage collection overhead How?'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-37151578507078102</id><published>2010-04-01T22:43:00.007+05:30</published><updated>2010-04-03T13:55:44.104+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><title type='text'>More than MVC framework for Flex : Mate</title><content type='html'>Recently at work place I was working on complex GUI screen which was to be designed in Flex. Flex has quite nice capabilities : Making beautiful GUI containing charts, widgets with minimal efforts and getting data from java-based-server-side with RemoteObject. But I guess as application will get complex(Do check &lt;a href="http://listen.grooveshark.com/"&gt;grooveshark.com&lt;/a&gt; to see how rich and complex but beautiful GUI can be created with Flex) I needed some way of structuring and designing application so anybody can understand and extend application without reading thousands of lines of action script code. Being java programmer (framework based eco-system) naturally I thought on the lines of Struts, MVC framework. But then I felt need of spring like container too where I can write/design each component separately, test them and inject and wire them in main application. There are lots of framework in flex : Cairngorm, pureMVC and Mate. Naturally first pick was Cairngorm since its official adobe framework. While browsing through HelloWorld program, I thought why I am needed to to make so many framework specific classes. Last update date on download site was very old : 30th May 2007. Then I learned about Mate  : a wonderful framework which allows structuring of application in very unobtrusive way with very small learning curve. It was quite easy for me to help other team members understand new design with this framework.&lt;br /&gt;&lt;br /&gt;Mate uses flex eventing. So with Model-View-Controller, View generates events like Submit-Form which then you can "map" to one or more Controllers. The best feature of this framework is "Injection". It injects model into controller and view so once you change model in Controller methods View updates it self. With Flex data binding and Mate injection this becomes quite powerful and very simple design for complex GUI. Mate EventMap tag allows declarative coding thus allows rapid testing and prototyping. When you look at Mate EventMap you will come to know what Application is doing, its high-level components. - your design - exactly what framework should do. Mate allowed me structure my application and set discipline. &lt;br /&gt;&lt;br /&gt;Say for example on clicking on "submit" button, you want to show make remote call, get data, update couple of labels on screen and put data into Grid also calculate Total Amount from all records and based on some "Value" you want to show some Signal like Yellow, Amber or Green indicating current status. Such screen can be described by simple EventMap declaration as follows. View can be implemented with its own Panels : SearchPanel and DisplayPanel. SearchController will host all activity specific code like calculating Totals or Summary etc.&lt;br /&gt;&lt;br /&gt; EventMap&lt;br /&gt; &lt;hr&gt;&lt;br /&gt;&lt;br /&gt;&lt;style type="text/css"&gt;&lt;!--&lt;br /&gt;/**&lt;br /&gt; * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann&lt;br /&gt; * (http://qbnz.com/highlighter/ and http://geshi.org/)&lt;br /&gt; */&lt;br /&gt;.mxml .de1, .mxml .de2 {font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;color: #000020;}&lt;br /&gt;.mxml  {font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;}&lt;br /&gt;.mxml a:link {color: #000060;}&lt;br /&gt;.mxml a:hover {background-color: #f0f000;}&lt;br /&gt;.mxml .imp {font-weight: bold; color: red;}&lt;br /&gt;.mxml li, .mxml .li1 {font-weight: normal; vertical-align:top;font: normal normal 130% 'Courier New', Courier, monospace; color: #003030;}&lt;br /&gt;.mxml .ln {width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;}&lt;br /&gt;.mxml .li2 {font-weight: bold; vertical-align:top;font-weight: bold; color: #006060;}&lt;br /&gt;.mxml .coMULTI {color: #808080; font-style: italic;}&lt;br /&gt;.mxml .es0 {color: #000099; font-weight: bold;}&lt;br /&gt;.mxml .br0 {color: #66cc66;}&lt;br /&gt;.mxml .sy0 {color: #66cc66;}&lt;br /&gt;.mxml .st0 {color: #ff0000;}&lt;br /&gt;.mxml .nu0 {color: #cc66cc;}&lt;br /&gt;.mxml .sc0 {color: #00bbdd;}&lt;br /&gt;.mxml .sc1 {color: #ddbb00;}&lt;br /&gt;.mxml .sc2 {color: #339933;}&lt;br /&gt;.mxml .sc3 {color: #000000;}&lt;br /&gt;.mxml .re0 {font-weight: bold; color: black;}&lt;br /&gt;.mxml .re1 {color: #7400FF;}&lt;br /&gt;.mxml .re2 {color: #7400FF;}&lt;br /&gt;.mxml span.xtra { display:block; }&lt;br /&gt;&lt;br /&gt;--!&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="mxml"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp;&lt;span class="sc3"&gt;&amp;lt;EventHandlers type=&lt;span class="st0"&gt;&amp;quot;{SearchEvent.SEARCH}&amp;quot;&lt;/span&gt;&lt;span class="re2"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="sc3"&gt;&lt;span class="coMULTI"&gt;&amp;lt;!-- call the remoting service --&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="sc3"&gt;&amp;lt;RemoteObjectInvoker instance=&lt;span class="st0"&gt;&amp;quot;{services.productService}&amp;quot;&lt;/span&gt; method=&lt;span class="st0"&gt;&amp;quot;search&amp;quot;&lt;/span&gt; arguments=&lt;span class="st0"&gt;&amp;quot;{event.searchCriteria1,event.searchCriteria1}&amp;quot;&lt;/span&gt;&lt;span class="re2"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class="sc3"&gt;&lt;span class="coMULTI"&gt;&amp;lt;!-- result sequence gets executed when service returns with a result --&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li2"&gt;&lt;div class="de2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class="sc3"&gt;&amp;lt;resultHandlers&lt;span class="re2"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class="sc3"&gt;&amp;lt;MethodInvoker generator=&lt;span class="st0"&gt;&amp;quot;{SearchController}&amp;quot;&lt;/span&gt; method=&lt;span class="st0"&gt;&amp;quot;setGridData&amp;quot;&lt;/span&gt; arguments=&lt;span class="st0"&gt;&amp;quot;{resultObject}&amp;quot;&lt;/span&gt;&lt;span class="re2"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class="sc3"&gt;&amp;lt;MethodInvoker generator=&lt;span class="st0"&gt;&amp;quot;{SummaryCalculator}&amp;quot;&lt;/span&gt; method=&lt;span class="st0"&gt;&amp;quot;calculateSummary&amp;quot;&lt;/span&gt; arguments=&lt;span class="st0"&gt;&amp;quot;{resultObject}&amp;quot;&lt;/span&gt;&lt;span class="re2"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class="sc3"&gt;&amp;lt;MethodInvoker generator=&lt;span class="st0"&gt;&amp;quot;{SignalIndicator}&amp;quot;&lt;/span&gt; method=&lt;span class="st0"&gt;&amp;quot;calculateAndIndicateState&amp;quot;&lt;/span&gt; arguments=&lt;span class="st0"&gt;&amp;quot;{resultObject}&amp;quot;&lt;/span&gt;&lt;span class="re2"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class="sc3"&gt;&amp;lt;/resultHandlers&lt;span class="re2"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li2"&gt;&lt;div class="de2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class="sc3"&gt;&amp;lt;faultHandlers&lt;span class="re2"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class="sc3"&gt;&amp;lt;CallBack method=&lt;span class="st0"&gt;&amp;quot;handleFault&amp;quot;&lt;/span&gt; arguments=&lt;span class="st0"&gt;&amp;quot;{fault.faultDetail}&amp;quot;&lt;/span&gt;&lt;span class="re2"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class="sc3"&gt;&amp;lt;/faultHandlers&lt;span class="re2"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="sc3"&gt;&amp;lt;/RemoteObjectInvoker&lt;span class="re2"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="sc3"&gt;&amp;lt;/EventHandlers&lt;span class="re2"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li2"&gt;&lt;div class="de2"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;View code can be refactored into two panels : SearchPanel and DisplayPanel SearchPanel looks like as follows :&lt;br /&gt;&lt;br /&gt;SearchPanel&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;div class="mxml"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="sc2"&gt;&amp;lt;mx:Script&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="sc2"&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;![CDATA[&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="sc2"&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;import mate.events.*;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="sc2"&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;import mx.controls.Alert;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li2"&gt;&lt;div class="de2"&gt;&lt;span class="sc2"&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;import mx.collections.*;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="sc2"&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="sc2"&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;private function fireSearch():void &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="sc2"&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="sc2"&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var event:MessageEvent = new SearchEvent(SearchEvent.SEARCH, true);&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li2"&gt;&lt;div class="de2"&gt;&lt;span class="sc2"&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;event.searchCriteria1 = textInput1.text;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="sc2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; event.searchCriteria2 = textInput2.text;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="sc2"&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dispatchEvent(event);&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="sc2"&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="sc2"&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li2"&gt;&lt;div class="de2"&gt;&lt;span class="sc2"&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;]]&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="sc2"&gt; &amp;nbsp; &amp;nbsp;&amp;lt;/mx:Script&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp;&lt;span class="sc3"&gt;&lt;span class="re1"&gt;&amp;lt;mx:Button&lt;/span&gt; id=&lt;span class="st0"&gt;&amp;quot;searchBtn&amp;quot;&lt;/span&gt; label=&lt;span class="st0"&gt;&amp;quot;Search&amp;quot;&lt;/span&gt; width=&lt;span class="st0"&gt;&amp;quot;100&amp;quot;&lt;/span&gt; click=&lt;span class="st0"&gt;&amp;quot;fireSearch()&amp;quot;&lt;/span&gt;&lt;span class="re2"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Where as DisplayPanel looks like as follows :&lt;br /&gt;&lt;br /&gt;DisplayPanel&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;div class="mxml"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="sc3"&gt;&lt;span class="re1"&gt;&amp;lt;mx:Panel&lt;/span&gt;&lt;span class="re2"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="sc2"&gt;&amp;lt;mx:Script&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="sc2"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;![CDATA[&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="sc2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; import mate.events.*;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li2"&gt;&lt;div class="de2"&gt;&lt;span class="sc2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; import mx.controls.Alert;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="sc2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; import mx.collections.*;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="sc2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; import mate.model.*;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="sc2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [Bindable]&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li2"&gt;&lt;div class="de2"&gt;&lt;span class="sc2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public var searchResult:SearchResultVO;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="sc2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ]]&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="sc2"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/mx:Script&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li2"&gt;&lt;div class="de2"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="sc3"&gt;&lt;span class="re1"&gt;&amp;lt;mx:VBox&lt;/span&gt; label=&lt;span class="st0"&gt;&amp;quot;Search Result&amp;quot;&lt;/span&gt;&lt;span class="re2"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class="sc3"&gt;&lt;span class="re1"&gt;&amp;lt;mx:DataGrid&lt;/span&gt; id=&lt;span class="st0"&gt;&amp;quot;dataGrid&amp;quot;&lt;/span&gt; width=&lt;span class="st0"&gt;&amp;quot;350&amp;quot;&lt;/span&gt; height=&lt;span class="st0"&gt;&amp;quot;200&amp;quot;&lt;/span&gt; dataProvider=&lt;span class="st0"&gt;&amp;quot;{searchResult.Data}&amp;quot;&lt;/span&gt;&lt;span class="re2"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="sc3"&gt;&lt;span class="re1"&gt;&amp;lt;/mx:VBox&lt;/span&gt;&lt;span class="re2"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="sc3"&gt;&lt;span class="re1"&gt;&amp;lt;/mx:Panel&lt;/span&gt;&lt;span class="re2"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;and code below injects model into controller and DisplayPanel. The way it works like Spring context's singlton bean so same instance is shared and below tag says :  DisplayPanel.searchResult =  SearchController.currentResultSet&lt;br /&gt;&lt;br /&gt;EventMap - Injector&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;div class="mxml"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="sc3"&gt;&amp;lt;Injectors target=&lt;span class="st0"&gt;&amp;quot;{DisplayPanel}&amp;quot;&lt;/span&gt; &lt;span class="re2"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class="sc3"&gt;&amp;lt;PropertyInjector targetKey=&lt;span class="st0"&gt;&amp;quot;searchResult&amp;quot;&lt;/span&gt; source=&lt;span class="st0"&gt;&amp;quot;{SearchController}&amp;quot;&lt;/span&gt; sourceKey=&lt;span class="st0"&gt;&amp;quot;currentResultSet&amp;quot;&lt;/span&gt; &lt;span class="re2"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp;&lt;span class="sc3"&gt;&amp;lt;/Injectors&lt;span class="re2"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Below is code for Controller which requires its own Binding when currentResultSet changes :&lt;br /&gt;&lt;br /&gt;SearchController&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="mxml"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;package mate.controller&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;{ &amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; import flash.events.Event;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; import flash.events.EventDispatcher;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li2"&gt;&lt;div class="de2"&gt;&amp;nbsp; &amp;nbsp; import mx.controls.Alert;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; import mx.collections.ArrayCollection;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; import mate.model.*;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; public class SearchController extends EventDispatcher&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li2"&gt;&lt;div class="de2"&gt;&amp;nbsp; &amp;nbsp; { &amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private var _currentResultSet:SearchResultVO;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [Bindable (event=&amp;quot;currentSetChange&amp;quot;)]&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public function get currentResultSet():SearchResultVO&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li2"&gt;&lt;div class="de2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return _currentResultSet;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public function setGridData(result:SearchResultVO):void&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li2"&gt;&lt;div class="de2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Do other processing if required....&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _currentSet = result;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dispatchEvent( new Event('currentSetChange'))&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li2"&gt;&lt;div class="de2"&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;} &amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;One more good feature if Mate is that it has MockService interface where you can write dummy remote service as part of Flex application itself. This allows developers to work independently when server-side services are not ready or avaialable.&lt;br /&gt;&lt;br /&gt;&lt;div class="mxml"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp;&lt;span class="sc3"&gt;&amp;lt;MockRemoteObject id=&lt;span class="st0"&gt;&amp;quot;helloService&amp;quot;&lt;/span&gt; showBusyCursor=&lt;span class="st0"&gt;&amp;quot;true&amp;quot;&lt;/span&gt; delay=&lt;span class="st0"&gt;&amp;quot;1&amp;quot;&lt;/span&gt; mockGenerator=&lt;span class="st0"&gt;&amp;quot;{MockHelloService}&amp;quot;&lt;/span&gt;&lt;span class="re2"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Welcome to awesomeness of Mate.&lt;br /&gt;Tushar&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-37151578507078102?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/37151578507078102/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=37151578507078102' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/37151578507078102'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/37151578507078102'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2010/04/more-than-mvc-framework-for-flex-mate.html' title='More than MVC framework for Flex : Mate'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-3473210685041495356</id><published>2010-03-14T14:32:00.004+05:30</published><updated>2010-03-14T14:57:53.714+05:30</updated><title type='text'>Uploading and Sharing Photos</title><content type='html'>We all want to share pictures all our Kodak moments with our friends. This is one kind of existence in Web 2.0 virtual world. This normally involves following pattern :&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Take a lot of pictures by using point-and-shoot digital cameras. &lt;/li&gt;&lt;li&gt;Download them from Camera/Memory card to computer&lt;/li&gt;&lt;li&gt;Edit them in Picture editor&lt;/li&gt;&lt;li&gt;Upload them to web-album sites like flickr or picasa&lt;/li&gt;&lt;li&gt;Share photos from Picasa or Filkr&lt;/li&gt;&lt;li&gt;Upload and share on social networking sites like Orkut or Facebook.&lt;/li&gt;&lt;/ol&gt;Step 4,5 and 6 are normally mutually exclusive but then if you have friends which are on one social network and few others are on other or worse, some friends don't live in Web 2.0 so you have to send them email invitation. Now uploading photos at all these places is really pain esp. if you have hundreds of photos of your latest trip to some exotic location. I don't understand why cant somebody come-up with simple application where it allows me to do basic things like chatting, adding photos, sharing and viewing updates from all social networking sites from one single window. If you find one working application with such functionality let me know.&lt;br /&gt;&lt;br /&gt;Picasa makes sharing photos really easy. I use Picasa Desktop Application for all my photos. Picasa has concept of gadgets where you can add button, clicking on which it will post your album to sites like Orkut or Facebook. So here is my way.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Download photos from Camera or Phone using Picasa.&lt;/li&gt;&lt;li&gt;Edit them using picasa&lt;/li&gt;&lt;li&gt;Use picasa tool bar buttons to upload them to Picasa Web album, orkut and facebook.&lt;/li&gt;&lt;/ol&gt;You can add Facebook button from this url : &lt;a href="http://apps.facebook.com/picasauploader/"&gt;Facebook Picasa uploader plugin&lt;/a&gt;. Details you can find &lt;a href="http://picasa.google.com/support/bin/answer.py?hl=en&amp;amp;answer=150419."&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;And orkut has inbuilt support for Picasa Web Albums See screen shot below&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_0GZ6Vgy7CVI/S5yqJ7bST0I/AAAAAAAACrI/0pkeA7jH1LQ/s1600-h/orkut_picasa.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 46px;" src="http://4.bp.blogspot.com/_0GZ6Vgy7CVI/S5yqJ7bST0I/AAAAAAAACrI/0pkeA7jH1LQ/s320/orkut_picasa.JPG" alt="" id="BLOGGER_PHOTO_ID_5448416736759140162" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_0GZ6Vgy7CVI/S5yqUbfVbTI/AAAAAAAACrQ/9gfN_nKrLr4/s1600-h/picasabar.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 31px;" src="http://1.bp.blogspot.com/_0GZ6Vgy7CVI/S5yqUbfVbTI/AAAAAAAACrQ/9gfN_nKrLr4/s320/picasabar.JPG" alt="" id="BLOGGER_PHOTO_ID_5448416917164748082" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Hope this simple tip makes your life with Photos and Social Networks easier.&lt;br /&gt;&lt;br /&gt;Tushar.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-3473210685041495356?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/3473210685041495356/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=3473210685041495356' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/3473210685041495356'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/3473210685041495356'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2010/03/uploading-and-sharing-photos.html' title='Uploading and Sharing Photos'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_0GZ6Vgy7CVI/S5yqJ7bST0I/AAAAAAAACrI/0pkeA7jH1LQ/s72-c/orkut_picasa.JPG' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-609793377831798609</id><published>2010-02-10T21:07:00.004+05:30</published><updated>2010-02-11T12:36:45.545+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='google'/><title type='text'>Google Buzz</title><content type='html'>My first impression - I like the idea of adding connected sites : twitter, picasa, blogger, reader and all status messages. I am still searching for good social network desktop client which will connect to all my accounts : gmail, orkut, facebook, yahoo, linked-in, twitter but there is not such application existing yet. The once which was closer is Digsby, but digsby's UI is really clumsy to use.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_0GZ6Vgy7CVI/S3LVu634QjI/AAAAAAAACnE/WtLd1a9b9K8/s1600-h/buzz.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 285px; height: 320px;" src="http://4.bp.blogspot.com/_0GZ6Vgy7CVI/S3LVu634QjI/AAAAAAAACnE/WtLd1a9b9K8/s320/buzz.JPG" alt="" id="BLOGGER_PHOTO_ID_5436642702243938866" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Buzz is single window solution. You want to share picasa album or your recent tweet it works. Lets hope that it does not fail as Google Wave failed due to absence of freinds. I hope google this time sends invitations to clusters of users such that when I use buzz I will find at least some friends to share buzz. Buzz is suppose to compete with Facebook and Twitter, it surely has plus points against both&lt;br /&gt;&lt;ul&gt;&lt;li&gt;it works right inside the most popular Google application - gmail &lt;/li&gt;&lt;li&gt;no 140 character limit&lt;/li&gt;&lt;li&gt;auto publish feature : when I tweet, same twit will be "buzzed" too&lt;/li&gt;&lt;/ul&gt;I hope Buzz comes with lot of "twitter" applications by default or provides options to add applications written with help of Buzz API like Gmail Labs application. One thing I would have liked to see is that Buzz should have implemented hashtags that are popular in twitter. Hashtags are like "user metadata" which helps to follow/search tweets that you are interested thus allowing to connect/discover like minded people.&lt;br /&gt;&lt;br /&gt;On other side, I don't know what google is thinking of having two different products : Wave and Buzz. I think since Wave has failed Google was in serious need to restrict facebook's advance so google added social networking aspects to its most loyal user base - Gmail. I am not sure about Buzz success, its surely going to tank as like google's other recent products. Facebooks strong point is that all sharing links, photos, activities, thoughts is at the central of page but in gmail is just another view so am not sure it should be part of gmail. Gmail view is OK but there should be separate page also where I can just spend time on Buzz. Hope google adds new features slowly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-609793377831798609?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/609793377831798609/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=609793377831798609' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/609793377831798609'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/609793377831798609'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2010/02/google-buzz.html' title='Google Buzz'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_0GZ6Vgy7CVI/S3LVu634QjI/AAAAAAAACnE/WtLd1a9b9K8/s72-c/buzz.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-5122151741958657649</id><published>2010-01-09T12:47:00.004+05:30</published><updated>2010-01-09T13:10:16.738+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='fun'/><category scheme='http://www.blogger.com/atom/ns#' term='android'/><title type='text'>Google Nexus One</title><content type='html'>Two days back I bought my android phone in US. Cant wait to get hands on it. Here are few pics of it.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_0GZ6Vgy7CVI/S0gxw1fyCzI/AAAAAAAACk0/XXvi5NWm_R4/s1600-h/IMG_2503.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 213px;" src="http://4.bp.blogspot.com/_0GZ6Vgy7CVI/S0gxw1fyCzI/AAAAAAAACk0/XXvi5NWm_R4/s320/IMG_2503.JPG" alt="" id="BLOGGER_PHOTO_ID_5424640466231626546" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_0GZ6Vgy7CVI/S0gxSn9CzVI/AAAAAAAACks/Fg_aSZdda1s/s1600-h/IMG_2504.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 213px;" src="http://3.bp.blogspot.com/_0GZ6Vgy7CVI/S0gxSn9CzVI/AAAAAAAACks/Fg_aSZdda1s/s320/IMG_2504.JPG" alt="" id="BLOGGER_PHOTO_ID_5424639947200187730" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The most astonishing thing is that it got 1 GHz CPU while most of the smart phones in current generation are around 528 MHz thats big advantage and its got bigger screen. For screen bigger the better. It also has Flash Player, significant factor over IPHONE 3GS.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Tech Specifications. For details spec see : &lt;/span&gt;&lt;a style="font-weight: bold;" href="http://www.google.com/phone/static/en_US-nexusone_tech_specs.html"&gt;Google Site&lt;/a&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Processor Qualcomm QSD 8250 1 GHz&lt;/li&gt;&lt;li&gt;Android Mobile Technology Platform 2.1 (Eclair)&lt;/li&gt;&lt;li&gt;512MB Flash 512MB RAM 4GB Micro SD Card (Expandable to 32 GB)&lt;/li&gt;&lt;li&gt;Display 3.7-inch (diagonal) widescreen WVGA AMOLED touchscreen 800 x 480 pixels&lt;/li&gt;&lt;li&gt;Camera 5 megapixels Autofocus LED flash with Video captured at 720x480 pixels at 20 fps&lt;/li&gt;&lt;li&gt;3G : UMTS Band 1/4/8 (2100/AWS/900)&lt;/li&gt;&lt;lilgsm edge="" 1900=""&gt;&lt;li&gt;Wi-Fi (802.11b/g)&lt;/li&gt;&lt;li&gt;Bluetooth 2.1 + EDR&lt;/li&gt;&lt;/lilgsm&gt;&lt;/ul&gt;There have been lot of speculation about google's entry in Mobile Phone market. Everybody is speculating "how still google not able to deliver a Iphone-killer" since Nexus One still will be be at par with iphone when it comes to user experience especially applications but for Giant google the achievement is launch of url : google.com/phone. Here is detailed blog about it : &lt;a href="http://arstechnica.com/gadgets/news/2010/01/googles-big-news-today-was-not-a-phone-but-a-url.ars?utm_source=rss&amp;amp;utm_medium=rss&amp;amp;utm_campaign=rss"&gt;Google's URL&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-5122151741958657649?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/5122151741958657649/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=5122151741958657649' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/5122151741958657649'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/5122151741958657649'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2010/01/google-nexus-one.html' title='Google Nexus One'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_0GZ6Vgy7CVI/S0gxw1fyCzI/AAAAAAAACk0/XXvi5NWm_R4/s72-c/IMG_2503.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-1784570607294549729</id><published>2009-08-22T16:11:00.015+05:30</published><updated>2009-09-09T16:27:21.296+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='terracotta'/><category scheme='http://www.blogger.com/atom/ns#' term='clustering'/><title type='text'>Querying Java Objects stored in Terracotta's NAM Part 3</title><content type='html'>&lt;a href="http://tusharkhairnar.blogspot.com/2009/04/querying-java-objects-stored-in.html"&gt;First&lt;/a&gt; and &lt;a href="http://tusharkhairnar.blogspot.com/2009/05/querying-java-objects-stored-in.html"&gt;Second part&lt;/a&gt; of this series I talked about Querying data structures available in Java. First part specifically talked about existing ones like JoSQL, JxPath and Quaere and discussed indexing problem. Second part specifically talked about lucene and jofti as indexing frameworks and wrote small framework to test and get some performance numbers. This test showed that B-tree index (memory and possibly disk based) is suitable and not lucene index. Third part of this series now I am discussing my own small framework- &lt;a href="http://code.google.com/p/tc-querymap/"&gt;tcquerymap&lt;/a&gt; which is rewrite of Jofti. Jofti is old and not maintained and uses jdk14 libraries. Now even documentation link does not work : http://prism-index.com/guide.html.&lt;br /&gt;&lt;br /&gt;querymap documentation link : &lt;a href="http://code.google.com/p/tc-querymap/wiki/GettingStartedWithQuerymap"&gt;Getting Started With Querymap&lt;/a&gt;&lt;br /&gt;querymap source download : &lt;a href="http://tc-querymap.googlecode.com/files/querymap-eclipse.tar.gz"&gt;Complete Source Code with Eclipse Project&lt;/a&gt;&lt;br /&gt;querymap TIM : Copy &lt;a href="http://tc-querymap.googlecode.com/files/querymap-1.0-1.0.0-SNAPSHOT.jar"&gt;this&lt;/a&gt; TIM to terracotta modules directory to use it&lt;br /&gt;querymap terracotta sample app : &lt;a href="http://tc-querymap.googlecode.com/files/querymap-sample-eclipse.tar.gz"&gt;Download sample eclipse App.&lt;/a&gt; You can use Terracotta eclipse plugin to launch it within eclipse&lt;br /&gt;&lt;br /&gt;So the basic idea is maintaining in-memory indexes which index String Ids with "Comparable" as Keys. All primitive wrappers in Java implement this interface so no special conversion is needed.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;How it works&lt;/span&gt;&lt;br /&gt;It scans java objects and makes comparable objects for each of the property mentioned to be indexed. It inserts these comparable objects in its own tree against String Ids assigned to the java object. So in-effect its nothing more than maintaining many in-memory Maps. In fact the implementation that I wrote uses JDK TreeMap and not b-tree map. But in-future it will be replaced by more performant B-tree.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Querying&lt;/span&gt;&lt;br /&gt;One needs to understand that with in-memory object indexes its only possible to implement subset of SQL query and no join queries. To start with, small framework only implements following operations : arithmetic operands : &lt;,&gt;,&lt;=,&gt;=,==. Logical operands :  AND , OR. Range : BETWEEN, Set : IN&lt;br /&gt;&lt;br /&gt;To implement querying SQL parser needs to be implemented. I choose to avoid writing parser and implemented direct API kind of querying similar to Quaere. I find Domain specific languages more intuitive since when developer writes code for it he know what querying he writes. So interface looks like below. It is not as good as quaere. Quaere is DSL, below API is just few interfaces implemented. Here execute returns List of IDs put into index against the properties.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt; import static com.google.code.querymap.ObjectQuery.*;&lt;br /&gt;&lt;br /&gt; Collection&lt;string&gt; col = from(Domain.class).where(&lt;br /&gt;     gt("inner.property2", 60),&lt;br /&gt;     lt("inner.property2",89)&lt;br /&gt;     eq("inner.property3",random.nextInt(NUM_OBJECTs))&lt;br /&gt;     ).execute();&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;So basically it is equivalent of follwing SQL&lt;br /&gt;&lt;code&gt;&lt;br /&gt; select from Domain&lt;br /&gt;  where inner.property2 &gt; 60&lt;br /&gt;  and inner.property2 &lt; property3=rand(NUM_OBJECTS)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;How it performs&lt;/span&gt;&lt;br /&gt;Naturally is not as performant as Jofti since it used JDK tree map which uses red-black tree. In future when I complete writing my own b-tree implementation I expect to perform as good as Jofti. Jofti further implemented node level locking so multiple concurrent insert opertations can work parellel. This can also be implemented too. But query performance is not bad and I expect it to improve with b-tree implementation.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;Integration with Terracotta&lt;/span&gt;&lt;br /&gt;Since it uses TreeMap it is cluster-able easily. Attached tc-config.xml has all correct declarations for it. One more advantage is with Terracotta is that object identifier are readily generated by Terracotta. See implementation TerracottaQueryMap. Please dont compare performance of TerracottaQueryMap against HashMap, CHM or Terracotta Distributed Map(Concurrent String Map old name) since all these are just single index maps so easy to stripe or employ mulitple locks.&lt;br /&gt;&lt;br /&gt;For using it as TIM you need to add following lines to tc-config.xml&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;    &amp;lt;modules&amp;gt;&lt;br /&gt;       &amp;lt;module id="com.google.code" name="querymap-1.0" version="1.0.0"&amp;gt;&lt;br /&gt;    &amp;lt;/module&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;In code you can use it as queryable map as follows. Here propList is list of properties to be indexed.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt; TerracottaQueryMap&lt;string, domain=""&gt; map =  new TerracottaQueryMap(Domain.class,proplist));&lt;br /&gt; &lt;br /&gt; map.put(key,domain1);&lt;br /&gt; map.put(key,domain2);&lt;br /&gt; map.put(key,domain3);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt; &lt;br /&gt;&lt;span style="font-weight:bold;"&gt;To Query.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt; Collection&lt;domain&gt; col =map.entrySet(&lt;br /&gt;        from(Domain.class).&lt;br /&gt;        where(&lt;br /&gt;         eq("inner.property2",random.nextInt(NUM_OBJECTs))&lt;br /&gt;         )&lt;br /&gt;        );&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Future directions planned&lt;/span&gt;&lt;br /&gt;Java has hugh limitation for memory intensive application. So achieve scale two approaches : partition index and merge results or use disk to overflow index pages. Other thing I see can be implemented is that when query selects random elements these random elements need to be faulted from Terracotta server thus degrading performance, same elements can be read from local store too like EHCACHE. Later on this topic separately.&lt;br /&gt;&lt;br /&gt;If you think this framework is useful please let me know. You can download its source as Eclipse project(sole dependency on tc.jar) and as Terracotta Integration Module here.&lt;br /&gt;&lt;br /&gt;Tushar&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-1784570607294549729?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/1784570607294549729/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=1784570607294549729' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/1784570607294549729'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/1784570607294549729'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/08/querying-java-objects-stored-in.html' title='Querying Java Objects stored in Terracotta&apos;s NAM Part 3'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-8983118437734270228</id><published>2009-07-10T22:21:00.008+05:30</published><updated>2009-07-10T22:38:01.603+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='erlang'/><title type='text'>Erlang and Concurrency</title><content type='html'>Here I write a lot about my experiments with Terracotta which is shared durable memory for Java applications which are multi-threaded. But some days before I came across erlang, language which is created at Erricsson for running fault-tolerant telecom applications. Whats so special about it?. If you google or rather "Bing" it you will find plenty of things about it. How cool and scalable it is?. If you read &lt;a href="http://zerohedge.blogspot.com/2009/07/is-case-of-quant-trading-industrial.html"&gt;this&lt;/a&gt; you will even come to know How Goldman Sachs was using it to gain significant advantage in program trading over other competitors and how others are trying to steal leaked source code.&lt;br /&gt;&lt;br /&gt;So erlang is not procedural programming language its functional programming language. Frankly I also need to understand whats so different about it. But I saw &lt;a href="ttp://www.infoq.com/presentations/Erlang-Concurrency-Francesco-Cesarini"&gt;this&lt;/a&gt; presentation of infoQ site about erlang concurrency and was amazed. Right from starting I always thought about following graph - throughput increases as a function of in-coming request rate till some point but after it stabilizes and then it drops. It drops because of system overload. In a perfectly cpu-intensive lock-contention free application this will happen because of cpu context switching. &lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_0GZ6Vgy7CVI/SldyCPFSreI/AAAAAAAACFM/75SMU_Qg4-0/s1600-h/erlang.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 229px;" src="http://4.bp.blogspot.com/_0GZ6Vgy7CVI/SldyCPFSreI/AAAAAAAACFM/75SMU_Qg4-0/s320/erlang.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5356875664514526690" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;But in erlang it stays constant instead your latency (response time) increases. This is according to &lt;a href="http://tusharkhairnar.blogspot.com/2009/07/erlang-and-concurrency.html"&gt;Little's Law&lt;/a&gt;. Little law says relation between throughput and latency is number of users in system. N = RX.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.sics.se/~joe/images/apachevsyaws.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 640px; height: 450px;" src="http://www.sics.se/~joe/images/apachevsyaws.jpg" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Above is famous graph of benchmark of YAWS (Http server written in erlang) against Apache and you can see how early apache gets saturated and dies. You can read details &lt;a href="http://www.sics.se/~joe/apachevsyaws.html"&gt;here&lt;/a&gt;  but explanation is given here is :&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;"The problem with Apache is not related to the Apache code per se but is due to the manner in which the underlying operating system (Linux) implements concurrency. We believe that any system implemented using operating system threads and processes would exhibit similar performance. Erlang does not make use of the underlying OS's threads and processes for managing its own process pool and thus does not suffer from these limitations."&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So basically all magic is erlang's concurrency model : No Shared State, Only message passing between light-weight processes. Erlang processes are way lighter than Java Threads since they are logical entities and not tied to user-level or kernel-threads. Thus erlang shows "No Shared State" concurrency model scales well. Since now JVM is touted as platform, I am looking forward to see erlang implementation on JVM and see how it does against other concurrent interpreted languages - scala. This is great &lt;a href="http://weblog.hypotheticalabs.com/?p=452"&gt;post&lt;/a&gt; why JVM is unfit for such porting. May be Java 8 ( I think closures are not part of Java 7). This is also interesting read about Erlang on Java : &lt;a href="http://debasishg.blogspot.com/2008/07/erlangs-concurrency-model-on-jvm-can-we.html"&gt;Erlang Concurrency model on JVM&lt;/a&gt; . Some of work on writing OTP(erlang's sdk for writing applications)  for scala http://github.com/jboner/scala-otp/tree/master/.&lt;br /&gt;&lt;br /&gt;I have already got Programming Erlang book now looking forward to write first program in OTP.&lt;br /&gt;&lt;br /&gt;Tushar&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-8983118437734270228?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/8983118437734270228/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=8983118437734270228' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/8983118437734270228'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/8983118437734270228'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/07/erlang-and-concurrency.html' title='Erlang and Concurrency'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_0GZ6Vgy7CVI/SldyCPFSreI/AAAAAAAACFM/75SMU_Qg4-0/s72-c/erlang.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-3562420025338051758</id><published>2009-07-09T12:01:00.003+05:30</published><updated>2009-07-09T12:13:45.927+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='samples'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='terracotta'/><category scheme='http://www.blogger.com/atom/ns#' term='links'/><title type='text'>Links : Java Sample Apps</title><content type='html'>Many times you hear or read something cool about some framework or tool and you are interested in Sample application written for it just to play with it, browse and go through source-code to find out how to code it.&lt;br /&gt;&lt;br /&gt;Here is list of great sample Apps that I just stumbled upon while reading this great blog about &lt;a href="http://jee-bpel-soa.blogspot.com/2009/07/apache-tomcat-clustering-load-balancing.html"&gt;Tomcat Clustering&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Link : &lt;a href="http://www.mediafire.com/jbs-blog-examples"&gt;http://www.mediafire.com/jbs-blog-examples&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;List is &lt;br /&gt;    * IBM-DB2-JDBC-XML.zip&lt;br /&gt;    * IBM-DB2-JDBC-Relational.zip&lt;br /&gt;    * Google-App-Engine.zip&lt;br /&gt;    * WebServices-JAX-WS-Java-SE.zip&lt;br /&gt;    * RESTful-WebServices-Apache-CXF.zip&lt;br /&gt;    * WebServices-Apache-CXF-Spring-2.5.zip&lt;br /&gt;    * WebServices-Apache-CXF.zip&lt;br /&gt;    * WebServices-WSIT-Reliable-Messaging.zip&lt;br /&gt;    * WebServices-JAX-WS-Web-App-Client-Basic-Security.zip&lt;br /&gt;    * WebServices-JAX-WS-Web-App-Client.zip&lt;br /&gt;    * WebServices-JAX-WS-Web-App.zip&lt;br /&gt;    * PMD-Clover2-Cobertura-Maven2-Test.zip&lt;br /&gt;    * WebServices-JAX-WS.zip&lt;br /&gt;    * WebServices-Axis2-with-Eclipse-client.zip&lt;br /&gt;    * Spring-Maven2-annotations-example.zip&lt;br /&gt;    * Spring-Maven2-basic-example.zip&lt;br /&gt;&lt;br /&gt;I will add following to above lists which I know about&lt;br /&gt;&lt;br /&gt;Terracotta Samples Application written by Team &lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Terracotta Reference Application : &lt;a href="http://terracotta.org/web/display/orgsite/Web+App+Reference+Implementation"&gt;Examinator&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;br /&gt; &lt;a href="http://svn.terracotta.org/svn/forge/projects/samples/trunk/samples/sample-spring-ehcache"&gt;Terracotta with Spring and EHCACHE&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;br /&gt;&lt;a href="http://svn.terracotta.org/svn/forge/projects/samples/trunk/samples/sample-spring-hibernate"&gt;Terracotta, Hibernate, Spring&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;br /&gt;&lt;a href="http://svn.terracotta.org/svn/forge/projects/samples/trunk/samples/sample-spring-quartz"&gt;Terracotta, Spring, Hibernate &lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://code.google.com/p/sample-tc-webapp/"&gt;Sample Web App with Maven, Terracotta&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-3562420025338051758?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/3562420025338051758/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=3562420025338051758' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/3562420025338051758'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/3562420025338051758'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/07/links-java-sample-apps.html' title='Links : Java Sample Apps'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-1544890311310766657</id><published>2009-06-29T23:53:00.006+05:30</published><updated>2009-07-08T12:58:39.937+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='hibernate'/><category scheme='http://www.blogger.com/atom/ns#' term='terracotta'/><title type='text'>Terracotta's Hibernate Integration</title><content type='html'>This post is re-post of my earlier write-behind &lt;a href="http://tusharkhairnar.blogspot.com/2008/12/links-kill-your-database-with.html"&gt;post&lt;/a&gt; but in different perspective : Terracotta's Hibernate integration 3.1&lt;br /&gt;&lt;br /&gt;With version 3.1 Terracotta has implemented its own Caching for Hibernate Second Level Caching Provider. Earlier Terracotta's hibernate integration approach was : clustering EHCACHE. Terracotta with its JVM clustering ability, it was easily possible to cluster any POJO structure. So before 3.1, you might have used EHCACHE as hibernate second level cahce provider and tim-hibernate and tim-ehcache for clustering second level cache. With version 3.1 onwards terracotta will have its own cache backed by map-evictor and concurrent string map. Apart from this new hibernate integration has lots of new additions like cache admin console and read-write cache. Cache is always up-to-date and coherent.&lt;br /&gt;&lt;br /&gt;But what I feel is that Terracotta platform is way more capable and following additional features &lt;span style="font-weight:bold;"&gt;can&lt;/span&gt; be added to make applications more scalable. These are just cool ideas.&lt;br /&gt;&lt;br /&gt;Cache Warm-up feature&lt;br /&gt;It would be nice feature to refresh or load cache whenever application or application cluster is starting up. This can easily be implemented with some sort of CacheLoader interface where Terracotta can callback this interface when faulting cache objects from terracotta server during first access. But such warm-up is only required on full cluster restart otherwise lot of meaningful cache entrites will get overwritten.&lt;br /&gt;&lt;br /&gt;Write-Behind Caching &lt;br /&gt;When you think of cache you will arrive at these cache strategies : Read-Through Caching, Write-Through Caching, Write-Behind Caching. Hibernate Second Level cache is Read-Write-Through Cache where if cache miss occurs, entity is read from database and then handed over to cache for susequent access. But H2LC is not Write-Behind caching. With Terracotta's disk persistence and asynchronsous module it would be really efficient for certain use-cases to implement write-behind. Currently hibernate just directly writes to database. Instead if its modified to write to second level cache and persistent async-database-queue, this would decrease latency and increase throughput dramatically. Imagine if you can schedule all your database writes in non-business hours using &lt;a href="http://forge.terracotta.org/releases/projects/tim-async/"&gt;tim-async&lt;/a&gt;. I find write-behind is certainly the best way to reduce pressure on database. And with Terracotta's clusterwide coherent persistent datastore its practicaly possible. Terracotta would be your database guard taking all your querying as well as database inserts on its shoulders.&lt;br /&gt;But this model would require certain changes in the way hibernate works. especially query cache. Since now Terracotta will have latest snapshot of yor System of Record, queries have to be executed against cache and not database. Thus it can not be generic solution. You can implemented write-behind only in certain cases where your business use case permits it. On the other hand to solve query problem &lt;a href="http://tusharkhairnar.blogspot.com/2009/05/querying-java-objects-stored-in.html"&gt;Querymap&lt;/a&gt; that i disucssed in my previous posts can be used to query certain type of data. So if your business use case permits write-behind and query-map can give you very fast database accelerator. In one of my previous jobs I was working on financial application where certain set of objects were modified at very high rate and same were queried against. For such application classic replicated H2LC does not bring any value, instead it will degrade the performance due to overhead during frequent-cluster-wide updates. But Terracotta will make it scalable, forwarding updates only to Node on which cache entry exists, updating the object clusterwide so when AsyncProcessor picks it up it will contain all the changes made. Its Terracotta's DSO Magic.&lt;br /&gt;&lt;br /&gt;Advantage here is that you dont have to do religious shift of &lt;a href="http://willcode4beer.com/design.jsp?set=kill_your_db"&gt;Killing Your Database&lt;/a&gt; Totally. Database is your System of Record. With Terracotta Hibernate Accerlerator you are only delaying updates to SOR and not replacing it.&lt;br /&gt;&lt;br /&gt;Currently I am going through Hibernate source code and learning how hiberante event mechanism works. My guess is that write-behind can be implemented with hibernate events. If not I may try to modify the source code to add write-behind and h2lc-cache querying capability. Hibernate search is similar where instead of classic session you get Indexing-aware session.&lt;br /&gt;&lt;br /&gt;With &lt;a href="http://www.terracotta.org/web/display/orgsite/Whats+New+Terracotta+3.0"&gt;Terracotta FX&lt;/a&gt; (assuming your application requires more than 4000 write operations per second - avg throughput of one un-tuned Terracotta server) your write throughput will increase linearly which is not possible with any RDBMS on any type of hardware.&lt;br /&gt;&lt;br /&gt;I hope Terracotta will add these features in coming versions. Terracotta 3.1 Hibernate Integration is just start.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-1544890311310766657?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/1544890311310766657/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=1544890311310766657' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/1544890311310766657'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/1544890311310766657'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/06/terracottas-hibernate-integration.html' title='Terracotta&apos;s Hibernate Integration'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-2829888855797900905</id><published>2009-05-25T20:18:00.011+05:30</published><updated>2009-05-26T20:14:49.769+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='terracotta'/><category scheme='http://www.blogger.com/atom/ns#' term='clustering'/><title type='text'>Querying Java Objects stored in Terracotta's NAM Part 2</title><content type='html'>&lt;p&gt;&lt;br /&gt;&lt;a href="http://tusharkhairnar.blogspot.com/2009/04/querying-java-objects-stored-in.html"&gt;First part&lt;/a&gt; of this series, I talked about existing frameworks and  what I found out is that they lack indexing hence rarely useful for large data-sets. So I tried finding out how to do indexing. My idea was simple : index objects and store reference to object in index then with Terracotta you can cluster objects and index as well. So it becomes "queryable" datastore. My first attempt was to find out how indexing is done. By book it says b-tree index. I found out this(jdbm) framework which is trying to do the persistent DB in Java by implementing B-tree indexes on disk.I took only b tree and implemented simple query parser. What it does is that it traverses b-tree and finds out tuples and then returns them.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;After this first attempt, then I experimented with Lucene. Lucene is not tree-index, its inverted index but it has lot of capability and its fast, supports in-memory and disk-based indexes.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;So here is my little framework for queryable datastore :&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt; public interface TCQueryMap&lt;T&gt; extends Map&lt;String,T&gt;{&lt;br /&gt;  void init();&lt;br /&gt;  Map&lt;String,T&gt; query(String query);&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Naturally its extension of Map which is single index. My implementation wraps a HashMap with ReadWrite locks and Lucene RAMDirectory index. So all get/puts hit index within lock boundaries and then you can query index. This is very simple, I have not gone into complexities like spill-over of index onto disk etc.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt; LuceneIndexingConfig config = new LuceneIndexingConfig();&lt;br /&gt; List&lt;String&gt; propList = new ArrayList&lt;String&gt;();&lt;br /&gt; // index three properties only&lt;br /&gt; propList.add("accountName");&lt;br /&gt; propList.add("person.age");&lt;br /&gt; propList.add("person.name.firstName");&lt;br /&gt; &lt;br /&gt; config.setIndexPropertyList(propList);&lt;br /&gt; &lt;br /&gt; TCQueryMap indexer = new LuceneQueryStore(config);&lt;br /&gt; &lt;br /&gt; // add object&lt;br /&gt; Acccount account .....&lt;br /&gt; indexer.put("user99",account);&lt;br /&gt;  &lt;br /&gt; // query object &lt;br /&gt; Map col = indexer.query("person.age:21");&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;I also came to know about Jofti from one of comments. Jotfi is what I would eventually like to write. I don't know why its not used by many people. One reason could be its not maintained. I found it pretty useful so I plugged in Jofti as well in my framework.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Now lets compare it with simple Hibernate-JDBC based solution. Obviously its not perfect. SQL is way more complex and expressive language. But here we are talking about cached data and I am sure once data is cached ( it means objectified from join query on relational DB)  very few times you will require join, its mostly "where clause" of one or more conditions. Lucene does that very well.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;So lets see numbers. I have not done any tuning apart from standard lucene stuff. One of main parameters is how many properties you want to index. This determines index size, memory and speed.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Below is small benchmark showing 60K objects inserts with three properties indexed and then random queries on three properties&lt;br /&gt;&lt;br /&gt;Lucene Inserts/Sec = 1000&lt;br /&gt;Jofti Inserts/Sec = 8793.78&lt;br /&gt;Lucene Queries/Sec = 5172 &lt;br /&gt;Jofti Queries/Sec  =13636.36&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Results for 14 properties indexed :&lt;br /&gt;&lt;br /&gt;Lucene Inserts/Sec = 740&lt;br /&gt;Jofti Inserts/Sec = 4866.96&lt;br /&gt;Lucene Queries/Sec = 3750 &lt;br /&gt;Jofti Queries/Sec  = 12500&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Since Jofti is Tree index it outperforms Lucene Index. The problem with Lucene is that once index gets bigger insert performance slows down. Also these numbers are taken with one commit on one put operation. If you index lot of objects together and then commit, lucene is also fast, that's how it is to be used - Batch API. On the other hand Jotfi is fast, I could not find any details about being thread-safe and other concurrency issues so I wrapped it around Lock. I don't know why Jofti is not used by many people.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Also what if you can run Hibernate/JPA queries on Map? that would be great. Its already done by hibernate team. They run query against Second level cache but it would big task to find out and extract idea out of it. Just a thought. Second Level Query cache gets invalidated when you modify single entity, imagine if we update the same object in QueryMap cache you dont need Query cache of course querying capability is not great.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Another thought that comes in my mind is clustering in-memory databases like H2 or HSQLDB. Imagine the benefits of it. But then its &lt;span style="font-weight:bold;"&gt;anti-terracotta&lt;/span&gt;. Why? it would be Relational DB with baggage of ORM mismatch.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Entire source code you can download it from here : &lt;a href="http://code.google.com/tc-querymap/"&gt;http://code.google.com/tc-querymap/&lt;/a&gt;. Tar file is just bunch of java files and its very early&lt;br /&gt;prototype. Stay tuned to project, I will update it once I finish with proper integration with Terracotta. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;So if you find it useful please leave comments, I would love to hear from you.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-2829888855797900905?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/2829888855797900905/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=2829888855797900905' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/2829888855797900905'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/2829888855797900905'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/05/querying-java-objects-stored-in.html' title='Querying Java Objects stored in Terracotta&apos;s NAM Part 2'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-4137551665403662605</id><published>2009-05-04T21:15:00.002+05:30</published><updated>2009-05-04T21:36:48.503+05:30</updated><title type='text'>Got one!!</title><content type='html'>Finally I got my own &lt;a href="http://www.pringoo.com/designdetail/did-5189/1337-1337%20loves%20linux"&gt;I Love Linux T-shirt&lt;/a&gt;, here is snap.&lt;br /&gt;You too can create your own T-shirt with Geeky quotes or any other quotes or picture. I am planning to make another with Ubuntu but waiting/searching for good image apart from standard "Linux for Human Beings"&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_0GZ6Vgy7CVI/Sf8RAwV2PrI/AAAAAAAAB3I/vIUoUwAT3Oc/s1600-h/DSC00461.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 256px;" src="http://3.bp.blogspot.com/_0GZ6Vgy7CVI/Sf8RAwV2PrI/AAAAAAAAB3I/vIUoUwAT3Oc/s320/DSC00461.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5331999188504166066" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_0GZ6Vgy7CVI/Sf8RBPSuADI/AAAAAAAAB3Q/vzlItoG-jCo/s1600-h/DSC00465.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 256px;" src="http://4.bp.blogspot.com/_0GZ6Vgy7CVI/Sf8RBPSuADI/AAAAAAAAB3Q/vzlItoG-jCo/s320/DSC00465.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5331999196812542002" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-4137551665403662605?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/4137551665403662605/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=4137551665403662605' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/4137551665403662605'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/4137551665403662605'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/05/got-one.html' title='Got one!!'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_0GZ6Vgy7CVI/Sf8RAwV2PrI/AAAAAAAAB3I/vIUoUwAT3Oc/s72-c/DSC00461.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-8145869420168997607</id><published>2009-04-15T19:43:00.003+05:30</published><updated>2009-04-15T19:55:48.302+05:30</updated><title type='text'>Portable Ubuntu Rocks</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_0GZ6Vgy7CVI/SeXuUgK5WDI/AAAAAAAAB3A/qRna4ZQpAU4/s1600-h/portable-ubuntu.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 200px;" src="http://3.bp.blogspot.com/_0GZ6Vgy7CVI/SeXuUgK5WDI/AAAAAAAAB3A/qRna4ZQpAU4/s320/portable-ubuntu.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5324924170435909682" /&gt;&lt;/a&gt;&lt;br /&gt;Years ago (literally 2.5 years ago) I had tried co-linux. At that time it was in  initial stages but was working perfectly in text mode. If you don't know whats co-linux, its linux distribution which works like Windows Binary. No need to setup Virtaul Machine Emualator and install or add virtual images. This was when I had never heard of Virtualization and I was really amazed of the idea. At that time co-linux had managed some elementary GUI drawing mainly KDE applications (at least i had seen screeshots), it did not work though on my machine. Just minutes before I downloaded portable ubuntu after reading this &lt;a href="http://lifehacker.com/5195999/"&gt;Post&lt;/a&gt; from LifeHacker. And it works!! just like described. Who needs VMWare and stuff like that if you can work on linux shell as well as Firefox just Alt-Tab apart. Here is screenshot of Portable Ubuntu in action.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-8145869420168997607?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/8145869420168997607/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=8145869420168997607' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/8145869420168997607'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/8145869420168997607'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/04/portable-ubuntu-rocks.html' title='Portable Ubuntu Rocks'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_0GZ6Vgy7CVI/SeXuUgK5WDI/AAAAAAAAB3A/qRna4ZQpAU4/s72-c/portable-ubuntu.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-5904729625005887624</id><published>2009-04-11T00:28:00.002+05:30</published><updated>2009-04-11T00:29:17.657+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='fun'/><category scheme='http://www.blogger.com/atom/ns#' term='links'/><title type='text'>Links : List of Geeky Quotes</title><content type='html'>Here : http://rafaeltrindade.com.br/2008/09/21/best-geek-quotes/&lt;br /&gt;My Fav is I would love to change the world, but they won’t give me the source code&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-5904729625005887624?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/5904729625005887624/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=5904729625005887624' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/5904729625005887624'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/5904729625005887624'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/04/links-list-of-geeky-quotes.html' title='Links : List of Geeky Quotes'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-7635987754314106214</id><published>2009-04-08T20:14:00.001+05:30</published><updated>2009-04-08T20:18:55.641+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Links : Distributed Hash Tables</title><content type='html'>Nice List of Distributed Key-Value Stores : http://www.metabrew.com/article/anti-rdbms-a-list-of-distributed-key-value-stores/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-7635987754314106214?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/7635987754314106214/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=7635987754314106214' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/7635987754314106214'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/7635987754314106214'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/04/links-distributed-hash-tables.html' title='Links : Distributed Hash Tables'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-7718097340819748968</id><published>2009-04-08T17:11:00.005+05:30</published><updated>2009-04-08T23:45:56.439+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='jxpath'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='terracotta'/><category scheme='http://www.blogger.com/atom/ns#' term='quaere'/><category scheme='http://www.blogger.com/atom/ns#' term='josql'/><title type='text'>Querying Java Objects stored in Terracotta's NAM</title><content type='html'>This post is inspired from : http://forums.terracotta.org/forums/posts/list/1965.page . Nothing new .. just another word in blogosphere.&lt;br /&gt;&lt;br /&gt;Terracotta is gr8 clustering solution in-fact its platform-level service hence has large number of uses. One of the use is using it as database. Terracotta can never replace database but it can play role of data storage media very well. One of major disadvantage is lack of querying data. Only way you can query data is Map. Map is like single index so if you want to get list of object satisfying some criteria you are required to integrate through entire collection. There are already APIs written for querying java collections. So you can use them with Terracotta NAM.&lt;br /&gt;&lt;br /&gt;When you think about querying there are lot of factors : Query Language, Its Performance - Optimizers, Operations Supported : Select, Update, Delete, Joins&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;JoSQL&lt;/h2&gt;&lt;br /&gt;JoSQL is good API for querying java collections with good documentation. I did small test with 1 million objects and random query took around 800ms which is way too much. Again its simple iteration through collection due to lack of indexes and query execution plan. Problem with Indexes is that Object graphs can change and at every change you are required to recompute the index which would be difficult to do : as complex as Terracotta's bytecode instrumentation. You can find test code &lt;a href="http://tushar.khairnar.googlepages.com/josql.zip"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Query Language : Moderately good, Performance : Not good for large collections, No update or delete only select projection queries. No joins&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Quaere&lt;/h2&gt;&lt;br /&gt;Quaere is a very flexible DSL that lets you perform a wide range of queries against any data structure that is an array, or implements the java.lang.Iterable. Its sort of port of LINQ of .Net world. I think linq is next generation data quering tool -cleaner. Quaere is not query language but query API just like Hiberate Criteria query but more elegant. I really liked quaere - its really powerful its support join operation. You can read this post for details : &lt;a href="http://andersnoras.com/blogs/anoras/archive/2007/09/14/solving-puzzles-with-quaere.aspx"&gt;Solving Puzzles with Quaere&lt;/a&gt; Its still beta level and not released. One of Queare's another sister project is its JPA integration. Imagine you could write standard JPA application with Quaere as query language and Terracotta as persistent store. No need of database. But as with JoSQL Quaere is also slow. I mean slower than RDBMS. I did small test with 1 million object similar to JoSQL test and response time was similar to JoSQL. You can download test code &lt;a href="http://tushar.khairnar.googlepages.com/quaere.zip"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This &lt;a href="http://idcmp.linuxstuff.org/2007/12/using-sql-on-java-collections.html"&gt;post&lt;/a&gt; also discusses jmap's OQL implementation. It uses rhino javascript engine behind with hashtables.I did consider it to port for Terracotta but its custom written for Object Heap Dumps. JxPath is another tool with which you can query java collections using XPath expressions. I did not evaluate JxPath since i felt it will be on similar lines of JoSQL and Quaere, only different flavor. If you have used XPath earlier then this is much easier to use. &lt;br /&gt;&lt;br /&gt;GlazedList is event driven list API specially designed for Swing Applications displaying table and list data. But if you consider List of Objects as table (each object is row and its properties as columns) a proper in-memory index can be maintained for querying. But this applies to only root object level. What if inner object in object graph store in your container changes?. You may then need to update the container whenever object changes. So i guess maintaining in-memory index for java objects is pretty difficult thing to do.&lt;br /&gt;&lt;br /&gt;With such tools i think you can easily query moderate size java collections stored in Terracotta's durable memory with acceptable response time.&lt;br /&gt;&lt;br /&gt;Tushar&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-7718097340819748968?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/7718097340819748968/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=7718097340819748968' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/7718097340819748968'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/7718097340819748968'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/04/querying-java-objects-stored-in.html' title='Querying Java Objects stored in Terracotta&apos;s NAM'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-5836327321924331622</id><published>2009-04-07T23:41:00.003+05:30</published><updated>2009-04-08T00:10:36.039+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Maven : Java Profiling</title><content type='html'>At workplace I use maven extensively. In fact I like maven so much that I am slowly moving lot of java eclipse project into maven project. Maven has very good eclipse plugin which makes integration with Eclipse very easy. You can run maven from eclipse. Maven is really good tool. If you have any specific needs you can write your own plugin. At my previous workplace, senior engineer in my project automated everything (starting jboss servers on remote machine in various environments : testing, perf-testing, integration testing etc. database population, database schema drop/rebuild etc). &lt;br /&gt;&lt;br /&gt;But now I wanted to profile java application which I used to run from maven. One of the best part of maven is dependency management and repository - it builds classpath automatically for you, but then its pain too. If you want to run java application you have to do through Maven. There is exec plugin with which you can run any Application or shell script and there is exec:java with which you can run java Main class. The problem is that exec:java is in same JVM. So you cant run any java agent(-agent) or other things : Specifically Java Profiling. You should make sure you run the application within the same environment/settings.&lt;br /&gt;&lt;br /&gt;So my first task was to get the complete classpath and then launch java with profiler java options. I am using jprofiler which uses JVMTI agent hence you need to append "-agentlib:jprofilerti=port=31757 -Xbootclasspath/a:/Applications/jprofiler5/bin/agent.jar" to java command line.&lt;br /&gt;&lt;br /&gt;Here is little shell script through which I managed to do java profiling for maven Project. This will work only for J2SE applications tough!. Frustrating part was variable DYLD_LIBRARY_PATH. I was new to MacOS and was trying with usual LD_LIBRARY_PATH and -agentpath jvm option. Surprisingly -agentpath option should work on MacOS but it didnt work i guess some problem with Jprofiler binary. But lastly i managed to profile my application properly. &lt;br /&gt;&lt;br /&gt;&lt;dd&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;mvn dependency:build-classpath -Dmdep.outputFile=mycp.txt&lt;br /&gt;export CLASSP=`cat ./mycp.txt`&lt;br /&gt;export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/Applications/jprofiler5/bin/macos&lt;br /&gt;$JAVA_HOME/bin/java -cp $CLASSP:./target/classes -agentlib:jprofilerti=port=31757 -Xbootclasspath/a:/Applications/jprofiler5/bin/agent.jar $*&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/dd&gt;&lt;br /&gt;&lt;br /&gt;This is the first time I had to do away with maven command. I wished somebody had written maven plugin for lauching jprofiler enabled apps. There is maven plugin for Yourkit Java Profiler : http://code.google.com/p/maven-yourkit-plugin/ but it did now work.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-5836327321924331622?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/5836327321924331622/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=5836327321924331622' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/5836327321924331622'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/5836327321924331622'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/04/maven-java-profiling.html' title='Maven : Java Profiling'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-5802125633345673383</id><published>2009-03-09T15:10:00.002+05:30</published><updated>2009-03-09T15:18:16.661+05:30</updated><title type='text'>Links : What is REST?</title><content type='html'>I needed to learn about REST interface and wanted some good article for learning basics of REST : REpresentational State Transfer. This article : &lt;a href="http://www.infoq.com/articles/rest-introduction"&gt;A Brief Introduction to REST&lt;/a&gt; is really the best one I found so thought of sharing it with you. REST is really nice idea of further simplifying the modeling of web-applications. I implemented by REST program with JSON and my client is in Javascript which is really cool (People are writing entire web based OS and here i am playing with simple java script stuff :-) ) With help of java-script libraries you can easily achieve data binding : like FLEX and other RIA. I really enjoyed working with this totally different stuff. I will add snippets in coming days.&lt;br /&gt;&lt;br /&gt;..&lt;br /&gt;Tushar&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-5802125633345673383?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/5802125633345673383/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=5802125633345673383' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/5802125633345673383'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/5802125633345673383'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/03/links-what-is-rest.html' title='Links : What is REST?'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-5785192661007799922</id><published>2009-02-26T15:10:00.002+05:30</published><updated>2009-02-26T15:18:04.107+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='student'/><category scheme='http://www.blogger.com/atom/ns#' term='links'/><title type='text'>Links : Things I Wish I’d Been Told</title><content type='html'>When I look back in my engineering days and now, I certainly figured out one thing : Whatever they teach in class hardly matters - the syllabus is totally outdated. What matters is that how you learn new things quickly, be updated in this fast moving world of technology. &lt;br /&gt;&lt;br /&gt;Here I am sharing a link I Wish I’d Been Told, when I graduated with computer science engineering degree. &lt;a href="http://www.ir.bbn.com/~craig/things-i-wish.html"&gt;Tips For Students with a Bachelors in Computer Science&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-5785192661007799922?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/5785192661007799922/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=5785192661007799922' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/5785192661007799922'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/5785192661007799922'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/02/links-things-i-wish-id-been-told.html' title='Links : Things I Wish I’d Been Told'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-8844106946874748114</id><published>2009-02-14T21:15:00.003+05:30</published><updated>2009-02-14T21:26:40.345+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='fun'/><category scheme='http://www.blogger.com/atom/ns#' term='youtube'/><title type='text'>Funny Tech Videos : Part 5</title><content type='html'>Geeky Valentine .. for bloggers and twiters.&lt;br /&gt;&lt;br /&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/XbfXUrtnynE&amp;hl=en&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/XbfXUrtnynE&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;Happy Valentine Days May all you get linklove that you deserve.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;..&lt;br /&gt;Tushar&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-8844106946874748114?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/8844106946874748114/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=8844106946874748114' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/8844106946874748114'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/8844106946874748114'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/02/funny-tech-videos-part-5.html' title='Funny Tech Videos : Part 5'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-3590341883850828425</id><published>2009-02-14T20:22:00.004+05:30</published><updated>2009-02-14T21:27:07.623+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='youtube'/><title type='text'>Download Your Favorite Youtube Videos in Batch</title><content type='html'>Last week &lt;a href="http://www.zeemarathi.com/SRGMPLittleChamps2008/default.htm"&gt;SRGMAP - LC&lt;/a&gt; ( Sa-Re-Ga-Ma-Pa Marathi Little Champs) singing contest for children finished. These children are really are talented and boy, crowd loved every performance from them. From long time this was the only show that I wanted to watch every episode of it and did not miss much initially. But when I moved out for my job I was missing it but then this guy &lt;a href="http://www.youtube.com/profile?gl=IN&amp;hl=en-GB&amp;user=ahonkan&amp;view=videos"&gt;"ahonkan"&lt;/a&gt; made sure i at least get to see performance of these god gifted children. Thanks a million ahonkan .. there will countless others like me.  Now competition is over I thought of downloading all videos and keeping copy of it for as my personal collection. Initially I thought I will write my small program in java where I will download the user specific feeds, playlists, Chanel and the via youtube API i will download all FLV files. But then I did came across this  great program. : 1-Click Youtube Downloaded. It allows you download and match bunch of videos It allows you donwload and match bunch of videos from youtube.&lt;br /&gt;&lt;br /&gt;Below is the video from 1-Click which shows you how to download videos using this program.&lt;br /&gt;&lt;br /&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/pPUjRNllId4&amp;hl=en&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/pPUjRNllId4&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;great stuff. may be older but still good enough for another word in blogo-sphere.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Note : Videos uploaded on youtube could be subject to copyright and may be illegal. Here I am only writing about the useful computer program. Make sure you know what you are downloading. Thanks&lt;br /&gt;&lt;br /&gt;Tushar&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-3590341883850828425?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/3590341883850828425/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=3590341883850828425' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/3590341883850828425'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/3590341883850828425'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/02/download-your-favorite-youtube-videos.html' title='Download Your Favorite Youtube Videos in Batch'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-6709306930145012542</id><published>2009-01-26T17:35:00.002+05:30</published><updated>2009-01-26T17:37:55.159+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='fun'/><category scheme='http://www.blogger.com/atom/ns#' term='tech'/><category scheme='http://www.blogger.com/atom/ns#' term='youtube'/><title type='text'>Funny Videos Part 4</title><content type='html'>Here is another tech video : She's An Engineer, soft song&lt;br /&gt;&lt;br /&gt;Could not grasp entire lyrics but here is some part of first para.&lt;br /&gt;&lt;br /&gt;Ah the way I'm feeling now we could lick the world&lt;br /&gt;cause you know I'm always dreaming about you girl&lt;br /&gt;I've been testing out your structure and found it sound&lt;br /&gt;Been installing all our circuits on solid ground&lt;br /&gt;Ah the way I'm feeling now we could take it on&lt;br /&gt;Turn it in our favor and get it on&lt;br /&gt;Generating answers and getting speed&lt;br /&gt;You've got to run it with the fun of it and take it cause&lt;br /&gt;She's an engineer&lt;br /&gt;We don't have much to fear&lt;br /&gt;Ghost in the computer&lt;br /&gt;Ghost goes in sie puter&lt;br /&gt;&lt;br /&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/0znwavPhRc8&amp;hl=en&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/0znwavPhRc8&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-6709306930145012542?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/6709306930145012542/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=6709306930145012542' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/6709306930145012542'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/6709306930145012542'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/01/funny-videos-part-4.html' title='Funny Videos Part 4'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-354280099299236418</id><published>2009-01-23T11:23:00.002+05:30</published><updated>2009-01-23T11:36:18.946+05:30</updated><title type='text'>Free Collaboration Software : Mikogo</title><content type='html'>I just used free collaboration software &lt;a href="http://www.mikogo.com/Welcome.aspx"&gt;Mikogo&lt;/a&gt;. At work place I used WebEX : the default choice but at home I needed to collaborate : basically share screen, show some demos, slides. With content sharing you also need to speak : i used skype for that. For screen sharing I searched google and Mikogo was the first result. It the on of the nest free software I have encountered : No hidden features, nearly all of features : like giving control to other participants, see other participants screen are present.&lt;br /&gt;It also has &lt;a href="https://extras.skype.com/1672/view"&gt;integration with skype&lt;/a&gt; which i did not used but will use for my next meeting. I initially assumed there will be some cap on either on duration on participants but our meeting well last 2 and half hours. In fact we spent 10 minutes in finding and testing out features of Mikogo.&lt;br /&gt;&lt;br /&gt;Who needs WebEX? certainly for personal Mikogo is the best.&lt;br /&gt;&lt;br /&gt;..&lt;br /&gt;Tushar&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-354280099299236418?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/354280099299236418/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=354280099299236418' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/354280099299236418'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/354280099299236418'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/01/free-collaboration-software-mikogo.html' title='Free Collaboration Software : Mikogo'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-7416413854901268733</id><published>2009-01-04T22:47:00.005+05:30</published><updated>2009-01-05T00:33:36.228+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='terracotta'/><title type='text'>CountDownLatch for Terracotta</title><content type='html'>With Java 5, java has inbuilt concurrency library in java.concurrent with classes like CountDownLatch, CylcicBarrier, FutureTask, ExecutorService, LinkedBlockingQueue, ConcurrentHashMap, ReentrantReadWriteLock, which greatly simplifies writing multi-threaded applications. With increasing number of cores you need to write applications which are  multi-threaded. With Terracotta this further makes really simple to run such application across more than one JVM effectively giving you more number of threads with slight degradation of performance but near-linear scalability. Terracotta supports some important data structures of "java.utl.concurrent" out of the box these are mainly : LinkedBlockingQueue, ExecutorService, CycliBarrier., FutureTask and of course Locks.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Below I am presenting one more addition to this library : CountDownLatch. CountDownLatch is used to co-ordinate between threads. You pass number of threads in constructor and each  thread then calls countDown() method. When you want to get notified that all threads have finished their work you call await() method. This method will wait till all parties have finished and called countDown() method. If you want to write such code in Terracotta enabled applicaiton you have to use CyclicBarrier where each thread calls await() method. But this will cause finished threads to unnecessarily block on barrier. By using CountDownLatch you can "countdown" and exit the thread thus only master or co-ordinator thread needs to block.&lt;br /&gt;&lt;br /&gt;Logic implemented is very simple - initiate with number of parties. decrease the counter in countDown method, when reached to zero notify all waiting threads and in await() method "wait()" on object till count is reached to zero.&lt;br /&gt;&lt;br /&gt;Below is the source code for it. You need to put class MyCountDownLatch in instrumented classes section as well as define write-lock for the await() and countDown() method. You can download the source-code for the same &lt;a href="http://tushar.khairnar.googlepages.com/tc-countDownLatch.jar"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Main Class&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="java" name="code"&gt;&lt;br /&gt;&lt;br /&gt;public class MyCountdownLatch {&lt;br /&gt;	&lt;br /&gt;	&lt;br /&gt;	int count = -1;&lt;br /&gt;	public MyCountdownLatch(int count)&lt;br /&gt;	{&lt;br /&gt;		this.count = count;&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;	&lt;br /&gt;	public synchronized void countDown()&lt;br /&gt;	{&lt;br /&gt;		count--;&lt;br /&gt;		if (count == 0) { notifyAll();  }&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;	&lt;br /&gt;	public synchronized void reset(int count)&lt;br /&gt;	{&lt;br /&gt;		this.count = count;&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;	public synchronized void await() throws InterruptedException &lt;br /&gt;	{&lt;br /&gt;        if (count == 0) { notifyAll(); return; }&lt;br /&gt;        else { &lt;br /&gt;        	while(count &gt; 0)&lt;br /&gt;        		{&lt;br /&gt;        			wait(); &lt;br /&gt;        		}&lt;br /&gt;        }&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Test Class TestCountDownLatch&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="java" name="code"&gt;&lt;br /&gt;import java.util.Random;&lt;br /&gt;&lt;br /&gt;public class TestCountDownLatch {&lt;br /&gt;	&lt;br /&gt;	public static int N=10;&lt;br /&gt;	&lt;br /&gt;	public static MyCountdownLatch startSignal = null;;&lt;br /&gt;	 public static MyCountdownLatch doneSignal = null;	&lt;br /&gt;	&lt;br /&gt;	 private static Object lock = new Object();&lt;br /&gt;	 &lt;br /&gt;	public static void main(String[] args) {&lt;br /&gt;		&lt;br /&gt;		&lt;br /&gt;		Runnable runs[] = new Runnable[N];&lt;br /&gt;		&lt;br /&gt;		if(startSignal==null)&lt;br /&gt;		{&lt;br /&gt;			synchronized (lock) {&lt;br /&gt;				startSignal = new MyCountdownLatch(1);&lt;br /&gt;				doneSignal = new MyCountdownLatch(N);	&lt;br /&gt;			}&lt;br /&gt;		}&lt;br /&gt;		&lt;br /&gt;		&lt;br /&gt;		 for(int i=0;i&lt;N;i++)&lt;br /&gt;		 {&lt;br /&gt;			runs[i] = new Worker(startSignal,doneSignal);&lt;br /&gt;			new Thread(runs[i]).start();&lt;br /&gt;		 }&lt;br /&gt;		 &lt;br /&gt;		 startSignal.countDown();&lt;br /&gt;		 try {&lt;br /&gt;			doneSignal.await();&lt;br /&gt;		} catch (InterruptedException e) {&lt;br /&gt;			&lt;br /&gt;			e.printStackTrace();&lt;br /&gt;		} &lt;br /&gt;		&lt;br /&gt;		&lt;br /&gt;		System.out.println("All thread finished ...");&lt;br /&gt;		&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;	&lt;br /&gt;	public static class Worker implements Runnable&lt;br /&gt;	{&lt;br /&gt;		MyCountdownLatch startSignal = null;&lt;br /&gt;		MyCountdownLatch doneSignal = null;&lt;br /&gt;	&lt;br /&gt;		public Worker(MyCountdownLatch startSignal, MyCountdownLatch doneSignal)&lt;br /&gt;		{&lt;br /&gt;			this.startSignal = startSignal;&lt;br /&gt;			this.doneSignal = doneSignal;&lt;br /&gt;			&lt;br /&gt;		}&lt;br /&gt;		&lt;br /&gt;		public void run()&lt;br /&gt;		{&lt;br /&gt;			System.out.println("Waiting for start signal...");&lt;br /&gt;			try {&lt;br /&gt;				startSignal.await();&lt;br /&gt;			} catch (InterruptedException e) {&lt;br /&gt;				&lt;br /&gt;				e.printStackTrace();&lt;br /&gt;			}&lt;br /&gt;	        doWork();&lt;br /&gt;	        doneSignal.countDown();&lt;br /&gt;		}&lt;br /&gt;		&lt;br /&gt;		public void doWork()&lt;br /&gt;		{&lt;br /&gt;			System.out.println("Starting to work now");&lt;br /&gt;			Random random = new Random();&lt;br /&gt;			try {&lt;br /&gt;				Thread.sleep(random.nextInt(2000));&lt;br /&gt;			} catch (InterruptedException e) {&lt;br /&gt;				// TODO Auto-generated catch block&lt;br /&gt;				e.printStackTrace();&lt;br /&gt;			}&lt;br /&gt;			System.out.println("Completd work");&lt;br /&gt;		}&lt;br /&gt;		&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Config file tc-config.xml&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="xml" name="code"&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;&amp;lt;tc:tc-config xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-4.xsd" xmlns:tc="http://www.terracotta.org/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&amp;gt;&lt;br /&gt;  &amp;lt;servers&amp;gt;&lt;br /&gt;    &amp;lt;server host="localhost" name="tc-srv01" bind="0.0.0.0"&amp;gt;&lt;br /&gt;      &amp;lt;data&amp;gt;%(user.home)/terracotta/server-data1&amp;lt;/data&amp;gt;&lt;br /&gt;      &amp;lt;logs&amp;gt;%(user.home)/terracotta/server-logs1&amp;lt;/logs&amp;gt;&lt;br /&gt;      &amp;lt;dso-port&amp;gt;9510&amp;lt;/dso-port&amp;gt;&lt;br /&gt;      &amp;lt;jmx-port&amp;gt;9520&amp;lt;/jmx-port&amp;gt;&lt;br /&gt;      &amp;lt;l2-group-port&amp;gt;9530&amp;lt;/l2-group-port&amp;gt;&lt;br /&gt;      &amp;lt;dso&amp;gt;&lt;br /&gt;        &amp;lt;garbage-collection&amp;gt;&lt;br /&gt;          &amp;lt;enabled&amp;gt;true&amp;lt;/enabled&amp;gt;&lt;br /&gt;          &amp;lt;interval&amp;gt;300&amp;lt;/interval&amp;gt;&lt;br /&gt;          &amp;lt;verbose&amp;gt;true&amp;lt;/verbose&amp;gt;&lt;br /&gt;        &amp;lt;/garbage-collection&amp;gt;&lt;br /&gt;      &amp;lt;/dso&amp;gt;&lt;br /&gt;    &amp;lt;/server&amp;gt;&lt;br /&gt;  &amp;lt;/servers&amp;gt;&lt;br /&gt;  &amp;lt;clients&amp;gt;&lt;br /&gt;    &amp;lt;logs&amp;gt;%(user.home)/terracotta/client-logs1/&amp;lt;/logs&amp;gt;&lt;br /&gt;    &amp;lt;statistics&amp;gt;%(user.home)/terracotta/server-statistics-%D&amp;lt;/statistics&amp;gt;&lt;br /&gt;  &amp;lt;/clients&amp;gt;&lt;br /&gt;  &amp;lt;application&amp;gt;&lt;br /&gt;    &amp;lt;dso&amp;gt;&lt;br /&gt;    &amp;lt;instrumented-classes&amp;gt;&lt;br /&gt;        &amp;lt;include&amp;gt;&lt;br /&gt;          &amp;lt;class-expression&amp;gt;*..*&amp;lt;/class-expression&amp;gt;&lt;br /&gt;        &amp;lt;/include&amp;gt;&lt;br /&gt;      &amp;lt;/instrumented-classes&amp;gt;&lt;br /&gt;      &amp;lt;roots&amp;gt;&lt;br /&gt;        &amp;lt;root&amp;gt;&lt;br /&gt;          &amp;lt;field-name&amp;gt;TestCountDownLatch.startSignal&amp;lt;/field-name&amp;gt;&lt;br /&gt;        &amp;lt;/root&amp;gt;&lt;br /&gt;        &amp;lt;root&amp;gt;&lt;br /&gt;          &amp;lt;field-name&amp;gt;TestCountDownLatch.doneSignal&amp;lt;/field-name&amp;gt;&lt;br /&gt;        &amp;lt;/root&amp;gt;&lt;br /&gt;      &amp;lt;/roots&amp;gt;&lt;br /&gt;      &amp;lt;locks&amp;gt;&lt;br /&gt;        &amp;lt;autolock&amp;gt;&lt;br /&gt;          &amp;lt;method-expression&amp;gt;* MyCountdownLatch.countDown(..)&amp;lt;/method-expression&amp;gt;&lt;br /&gt;          &amp;lt;lock-level&amp;gt;write&amp;lt;/lock-level&amp;gt;&lt;br /&gt;        &amp;lt;/autolock&amp;gt;&lt;br /&gt;        &amp;lt;autolock&amp;gt;&lt;br /&gt;          &amp;lt;method-expression&amp;gt;* MyCountdownLatch.await(..)&amp;lt;/method-expression&amp;gt;&lt;br /&gt;          &amp;lt;lock-level&amp;gt;write&amp;lt;/lock-level&amp;gt;&lt;br /&gt;        &amp;lt;/autolock&amp;gt;&lt;br /&gt;      &amp;lt;/locks&amp;gt;&lt;br /&gt;    &amp;lt;/dso&amp;gt;&lt;br /&gt;  &amp;lt;/application&amp;gt;&lt;br /&gt;&amp;lt;/tc:tc-config&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-7416413854901268733?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/7416413854901268733/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=7416413854901268733' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/7416413854901268733'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/7416413854901268733'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2009/01/countdownlatch-for-terracotta.html' title='CountDownLatch for Terracotta'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-8432283266031368427</id><published>2008-12-24T22:35:00.004+05:30</published><updated>2009-01-26T17:38:26.864+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='fun'/><category scheme='http://www.blogger.com/atom/ns#' term='youtube'/><title type='text'>Funny Tech Video Part 3</title><content type='html'>Below is really gr8 video called kill dash nine. "Kill -9" is the command in unix to kill the process like Task Manager in Windows. You can find entire lyrics &lt;a href="http://www.monzy.com/intro/killdashnine_lyrics.html"&gt;here&lt;/a&gt;. You can download mp3 version of it too from the same page. Some of the lines are really gr8 like &lt;br&gt;&lt;br /&gt;&lt;center&gt;You're running csh and my shell is bash, &lt;br&gt;&lt;br /&gt;You're the tertiary storage; I'm the L1 cache. &lt;br&gt;&lt;br /&gt;You're a dialup connection; I'm a gigabit LAN.&lt;/center&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/Fow7iUaKrq4&amp;color1=0xb1b1b1&amp;color2=0xcfcfcf&amp;feature=player_embedded&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/Fow7iUaKrq4&amp;color1=0xb1b1b1&amp;color2=0xcfcfcf&amp;feature=player_embedded&amp;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-8432283266031368427?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/8432283266031368427/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=8432283266031368427' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/8432283266031368427'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/8432283266031368427'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2008/12/tech-video-part-3.html' title='Funny Tech Video Part 3'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-4573525610309231200</id><published>2008-12-21T19:59:00.003+05:30</published><updated>2009-01-04T23:06:30.857+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>An Insane idea to Solve Java's Memory Problem</title><content type='html'>This could be insane idea to solve java's memory problem.&lt;br /&gt;&lt;br /&gt;Garbage collection overhead has been one of the major performance problem. Recent improvements in Garbage collector : ability to parallel collect garbage using more processors or cores available,  concurrent garbage collection has drastically reduced this belief that GC is mostly cause of performance problems. Earlier this problem could be solved by running multiple instances of application on the same box to use its all CPU power and memory. But for some memory-intensive application GC overhead is still a problem to be solved. As JVM is being touted as more of Virtual Machine for many interpreted languages as opposed to only Java runtime memory problem is bound to occur. I have been working recently on Terracotta which is Network Attached Memory (NAM) for Java Applications. When you say NAM, you application now can access more number of objects that could fit in your local heap since objects which are not in your local heap  are transparently loaded into local JVM when they are accessed .. sort of lazy loading in hibernate. Now this idea can also be applied to JVM .. offload some objects which are not accessed often down to local disk and load them when they are not accessed.Imagine a situation where you are running application on 16 core or 32 core processors ( intel has one prototype of 80 cores) ..data processing ability of such hugh machine. With 64-bit platform JVM size can grow beyond 2 GB limit but when Full GC happens on JVM sized more than 4 GB its really painful for applications. I have never worked on such hugh JVMs no really no idea how jdk 5 and 6 performs in such situations. Sure there will be some optimizations in JVM to operate at such scale.&lt;br /&gt;&lt;br /&gt;A simple prototype of this is various cache solutions which offer cache eviction to local disk when number of objects cross defined cache size. But these implementations are targeted as "caching solutions" which know only how to "get" and "put" objects in a manner so as to make best use of available space.&lt;br /&gt;&lt;br /&gt;At first this idea may be insane but various optimizations can be done to make it practical. This is what terracotta has done,  to avoid object serialization and operate at field level. Consider a map of 10000 fat objects. When this map is offloaded to disk all value objects will also be written to disk. Now when some value object is looked upon only the object can be loaded while rest of the objects still being stored on disk. This basically means you have to implement some sort of virtual memory manager for virtual machine which will use application access pattern and some stored intelligence to minimize the total load delay and at the same time allow application to operate on large data set.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Any comments are welcome .. I am sure there will be a lot of comments on this insane idea.&lt;br /&gt;&lt;br /&gt;..&lt;br /&gt;Tushar&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-4573525610309231200?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/4573525610309231200/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=4573525610309231200' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/4573525610309231200'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/4573525610309231200'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2008/12/insane-idea-to-solve-javas-memory.html' title='An Insane idea to Solve Java&apos;s Memory Problem'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-7870911582314226991</id><published>2008-12-16T17:16:00.004+05:30</published><updated>2009-01-04T23:07:13.622+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='dilbert'/><category scheme='http://www.blogger.com/atom/ns#' term='fun'/><category scheme='http://www.blogger.com/atom/ns#' term='youtube'/><title type='text'>Funny Tech Video Part 2</title><content type='html'>&lt;b&gt;Hug a developer ....&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;dd&gt;&lt;br /&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/1lqxORnQARw&amp;hl=en&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/1lqxORnQARw&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;/dd&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;Now this is one is reaaly funny and for the developers&lt;br /&gt;&lt;br /&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/hadxBZWxNrs&amp;hl=en&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/hadxBZWxNrs&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What makes an engineer .. little dilbert video&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;dd&gt;&lt;br /&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/KaHm1ecBCgw&amp;hl=en&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/KaHm1ecBCgw&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;/dd&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Every bulid you break ...&lt;/b&gt;&lt;br /&gt;&lt;dd&gt;&lt;br /&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/fVc_VPMsj7A&amp;hl=en&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/fVc_VPMsj7A&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;/dd&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-7870911582314226991?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/7870911582314226991/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=7870911582314226991' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/7870911582314226991'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/7870911582314226991'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2008/12/funny-tech-video-part-2.html' title='Funny Tech Video Part 2'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-480159951088894816</id><published>2008-12-16T16:23:00.005+05:30</published><updated>2009-01-04T23:07:58.477+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='fun'/><category scheme='http://www.blogger.com/atom/ns#' term='sniper twins'/><category scheme='http://www.blogger.com/atom/ns#' term='office space'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><category scheme='http://www.blogger.com/atom/ns#' term='youtube'/><title type='text'>Funny Tech Videos</title><content type='html'>Here are some really funny tech videos.&lt;br /&gt;&lt;br /&gt;First one is my favorite : Matrix runs on windows. Listen carefully for  some meaningful (real-world universal truth) lines like : "progress bar is moving but remaining time is going up". Its time to upgrade to Ubuntu.&lt;br /&gt;&lt;br /&gt;&lt;dd&gt;&lt;br /&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/yX8yrOAjfKM&amp;hl=en&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/yX8yrOAjfKM&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;/dd&gt;&lt;br /&gt;&lt;br /&gt;Second one is music remix based on XP error sounds.&lt;br /&gt;&lt;br /&gt;&lt;dd&gt;&lt;br /&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/RoU_-hwYXs0&amp;hl=en&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/RoU_-hwYXs0&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;/dd&gt;&lt;br /&gt;&lt;br /&gt;Third one is really creative geeky rap video from some "Sniper Twins".&lt;br /&gt;&lt;br /&gt;&lt;dd&gt;&lt;br /&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/FNXe_3gVz6I&amp;hl=en&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/FNXe_3gVz6I&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;/dd&gt;&lt;br /&gt;&lt;br /&gt;Fourth one is from movie Office Space : Movie based on life of frustrated IT-Software Engineer, really describes life of some my friends : working on weekends, reporting to more than one boss. Somebody come up with that one, good, its old movie though 1996.&lt;br /&gt;&lt;br /&gt;&lt;dd&gt;&lt;br /&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/I1L8l3LrzLA&amp;hl=en&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/I1L8l3LrzLA&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;/dd&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-480159951088894816?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/480159951088894816/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=480159951088894816' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/480159951088894816'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/480159951088894816'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2008/12/funny-tech-videos.html' title='Funny Tech Videos'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-4625922876321822804</id><published>2008-12-13T00:28:00.005+05:30</published><updated>2009-01-04T23:08:19.293+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='tech'/><category scheme='http://www.blogger.com/atom/ns#' term='online TV'/><title type='text'>Online TV : Reality for Indians</title><content type='html'>I recently moved to Noida for my new job and missing watching TV, especially Zee Marathi SA-RE-GA-MA-PA. And then very unthinkable happened : Shootout in the heart of mumbai - my beloved city. It was really hard to think whats going on in Mumbai, sitting in air-conditioned office in Noida. I could watch those boring and ever-repeating clips of news channel videos online but these are only dramatic and not informative at all. Then I thought what if I could watch TV online where I can get whole feel of whats happening, and yes by doing little bit of googling I managed to find out lot of channel which are available online. I could watch My favorite TV serial (one-and-only-one) online. Not only that I could see live news channel. Go to : &lt;a href="http://www.ibollytv.com/iTV.php"&gt;http://www.ibollytv.com/iTV.php&lt;/a&gt;. Lot of regional channels are covered there. Internet connection speed required for these feed depends on the quality but 512 Kbps (that's around 64 KBps download speed) is sufficient for it. Sad thing is that, in India wireless internet is still hanging around 144 Kbps boundary so you can not avail this facility on move. On broadband front though thing look OK now, lot of ISP now provide 2 Mbps speed so things &lt;br /&gt;&lt;br /&gt;One thing I want say is Thanks and I really appreciate to this to CNN-IBN. CNN-IBN (Leading news channel in India) has official free live feed. That's what you call free press. In events like Mumbai shootout this could really save your and your families day. Thanks once gain : Rajdeep Sardesai.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;..&lt;br /&gt;Tushar&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-4625922876321822804?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/4625922876321822804/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=4625922876321822804' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/4625922876321822804'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/4625922876321822804'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2008/12/online-tv-reality-for-indians.html' title='Online TV : Reality for Indians'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-667324063241135221</id><published>2008-12-12T23:58:00.004+05:30</published><updated>2009-01-04T23:08:49.191+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='terracotta'/><category scheme='http://www.blogger.com/atom/ns#' term='clustering'/><title type='text'>Links : Kill Your Database with Terracotta</title><content type='html'>I am going to start a new series from this post. Many times you find great article on the internet that you would like to share with others. "Links" is one such series.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;And very first link here is an Article written on Terracotta : An amazing technology for java application clustering. Its here : &lt;a href="http://willcode4beer.com/design.jsp?set=kill_your_db"&gt;Kill Your Database&lt;/a&gt;. Terracotta is clustering technology with built-in support for HA. Clustering is all about shared data and when you talk about HA, you are actually caring for the shared data, its availability. Terracotta implements it by writing every change to shared data to disk in transactional manner. So if your data whose life is short or medium, (often you need to store derived data from the temporary data which is very large, and we use RDBMS for all of this) you can use terracotta to store it in very fast manner : since you don't have to convert data to relational model its all java. Pretty powerful!!. Other use case is Database off-loading which means you can use terracotta to store all data temporarily and then write to your database in manner which would not affect end-user response time. By doing this you remove database access and operation time from response time ( which mostly is the very significant part of the response time). Article mentioned above touches all these concepts. I will add one more link on terracotta org-site which describes this case ( and all other wonderful use-cases for terracotta). Here it is : &lt;a href="http://www.terracotta.org/web/display/orgsite/Write+Behind+to+SOR"&gt;Write Behind SOR&lt;/a&gt;. If you read my &lt;a href="http://tusharkhairnar.blogspot.com/2008/08/java-performance-caching-clustering-and.html"&gt;previous post&lt;/a&gt;, I had exactly discussed the same idea : Write Behind or Asynchronous writes. That time I knew only coherence supported this. Then I came to know that Gigaspaces also supports it. ( See comments below on the same post). But terracotta would be the most exciting among them all. Why? One reason is all existing application can easily integrate this pattern in there application with very small change in code-base. Second reason terracotta supports lot of java framework out of the box.&lt;br /&gt;&lt;br /&gt;..&lt;br /&gt;Tushar&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-667324063241135221?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/667324063241135221/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=667324063241135221' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/667324063241135221'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/667324063241135221'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2008/12/links-kill-your-database-with.html' title='Links : Kill Your Database with Terracotta'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-1216859706675752017</id><published>2008-11-05T00:41:00.002+05:30</published><updated>2009-01-04T23:09:14.040+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='fun'/><title type='text'>Pal Pal Dil Ke Paas</title><content type='html'>OK this is supposed to be technical blog. but this post is not going to be technical, Lets take a break. I had too I had nasty accident on bike couple of weeks ago so all my normal work is affected. Often I listen songs new ones old ones especially Kishor Kumar's song. My favorite ones are &lt;span style="font-weight:bold;"&gt;Chookar Mere Man Ko&lt;/span&gt; and &lt;span style="font-weight:bold;"&gt;Pal Pal Dil Ke Passs&lt;/span&gt;. Come on! many people will agree to this. I was searching for exact lyrics of two songs what I found out that middle para, in Hindi its called "&lt;span style="font-style:italic;"&gt;antara&lt;/span&gt;" is missing in nearly all lyrics sites so here is complete song below.&lt;br /&gt;&lt;br /&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/MAvVDCOdC_k&amp;hl=en&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/MAvVDCOdC_k&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;dd&gt;&lt;br /&gt;&lt;br /&gt;Pal Pal Dil Ke Paas Tum Rehti Ho&lt;br /&gt;Jeevan Meethi Pyaas Yeh Kehti Ho&lt;br /&gt;Pal Pal Dil Ke Paas Tum Rehti Ho&lt;br /&gt;&lt;br /&gt;Har Shyam Aankhon Par&lt;br /&gt;Tera Aanchal Lehraye&lt;br /&gt;Har Raat Yaadon Ki&lt;br /&gt;Baarat Le Aaye&lt;br /&gt;Maein Saans Leta Hoon&lt;br /&gt;Teri Khushboo Aati Hai&lt;br /&gt;Ek Mehka Mehka Sa&lt;br /&gt;Paigham Laati Hai&lt;br /&gt;Meri Dil Ki Dhadkan Bhi&lt;br /&gt;Tere Geet Gaati Hai&lt;br /&gt;Pal Pal ...&lt;br /&gt;&lt;br /&gt;kal tuzhko dekha tha&lt;br /&gt;mene apne aangan me &lt;br /&gt;jaise kahe rahi tu&lt;br /&gt;muzhe bandh lo bandhan me&lt;br /&gt;ye kaisa rishta he&lt;br /&gt;ye kaise sapnye he&lt;br /&gt;begane hokar bhi &lt;br /&gt;kyu lagte apne he&lt;br /&gt;me soch me rahta hu&lt;br /&gt;dar dar ke kehta hu&lt;br /&gt;&lt;br /&gt;Tum Sochogi Kyon Itna&lt;br /&gt;Maein Tumse Pyaar Karoon&lt;br /&gt;Tum Samjhogi Deewana&lt;br /&gt;Maein Bhi Iqraar Karoon&lt;br /&gt;Dewaanon Ki Yeh Baatein&lt;br /&gt;Deewane Jaante Hain&lt;br /&gt;Jalne Mei Kya Mazaa Hai&lt;br /&gt;Parwanr Jaante Hain&lt;br /&gt;Tum Yunhi Jalate Rehna&lt;br /&gt;Aa Aakar Khwabon Mein&lt;br /&gt;Pa L Pal ...&lt;br /&gt;&lt;/dd&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In india television channels, currently nearly all Channels have reality singing competitions going on. I follow one of this Marathi Sa-Re-Ga-Ma-Pa singing program. Its called little champs where children aged less than 14 yrs old sing all kind of marathi songs yes!! i said all kinds - Lavni, Koli Geete, Bharud, Abhanga, Natya-Sangeet. I too tried a bit in singing, recorded my favorite songs on my laptop. Believe me its really difficult. Really Hats off to those 10 years old. Still many more to come.&lt;br /&gt;&lt;br /&gt;Here is one of the performances with comments from Shankar Mahadevan:&lt;br /&gt;&lt;center&gt;&lt;br /&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/z_BwcRMQxCI&amp;hl=en&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/z_BwcRMQxCI&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;/center&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-1216859706675752017?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/1216859706675752017/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=1216859706675752017' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/1216859706675752017'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/1216859706675752017'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2008/11/pal-pal-dil-ke-paas.html' title='Pal Pal Dil Ke Paas'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-4693377352864846032</id><published>2008-09-13T20:48:00.001+05:30</published><updated>2009-01-04T23:09:29.087+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='google'/><title type='text'>Beware of Google!!</title><content type='html'>Just now i was chatting with my college friend in Marathi - one of many languages spoken in India. I had missed some of last sentences so so opened it again from "Chats" section in Gmail. Google shows clips and sponesred adds above the main area where mail is displayed. I was amazed to see Adds of site targeted to marathi speking community, to be specific : Matrimony site. How does google know that i am chatting in Marathi and Engilsh mixed and Matrimony site add is relevant to the item to be displaced. Hats of to google!&lt;br /&gt;&lt;br /&gt;But at the same time i feel you should be careful about GMail and Google in specific. They are building database of people : your social network, your browsing habits and many other things. Now it has come-up with browser - Chrome. Minimalist one, but behind it Google can store lot of personal information on its servers. Google's mantra is "Don't Be Evil". But after certain limit its really intrusive. Google basically uses all this information for advertising thats there bread-n-butter. But who knows what will they sell to the advertisers. So Beware of Google!&lt;br /&gt;&lt;br /&gt;Here is post on HackerNews Network that talks about Dependence on Google &lt;br /&gt;&lt;a href="http://news.ycombinator.com/item?id=350968"&gt;http://news.ycombinator.com/item?id=350968&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-4693377352864846032?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/4693377352864846032/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=4693377352864846032' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/4693377352864846032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/4693377352864846032'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2008/09/beware-of-google.html' title='Beware of Google!!'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-2181203974750936898</id><published>2008-09-06T21:45:00.001+05:30</published><updated>2009-01-04T23:10:02.957+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='administration'/><category scheme='http://www.blogger.com/atom/ns#' term='nagios'/><category scheme='http://www.blogger.com/atom/ns#' term='performance monitoring'/><title type='text'>Building Performance Monitoring Solution with Nagios and NDOUtils Part 2 PerfNagios</title><content type='html'>Welcome to part 2 of this series. This took long time but was worth the effort. In this part i am going to describe  how to save performance data and integrate a sample monitoring scripts for performance monitoring. In earlier post I wrote about how to install and configure NDOUtils for database support in nagios. We will be using the same setup for storing data but will add some more table to store performance repository. Remember NDOUtils will delete data periodically!.&lt;br /&gt;&lt;br /&gt;Lets first discuss how would you save performance data. &lt;h2&gt;&lt;a href="https://sourceforge.net/projects/perfnagios/"&gt;PerfNagios&lt;/a&gt;&lt;/h2&gt; is sourceforge project started by me for implementing this idea. Currently only parsing code is stable, reporting and dashboard functionalities will be added later. Stay connected on this blog for future updates to this project.&lt;br /&gt;&lt;br /&gt;PerfNagios is basically small web-interface for displaying nagios related data easily. Eventually it will have good reporting capabilities. Currently it only shows performance data for last 1000 readings. You can see screenshots below.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_0GZ6Vgy7CVI/SMKvMQGfGcI/AAAAAAAAAto/vqx37nMMJr4/s1600-h/home2.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_0GZ6Vgy7CVI/SMKvMQGfGcI/AAAAAAAAAto/vqx37nMMJr4/s320/home2.png" alt="" id="BLOGGER_PHOTO_ID_5242945541228140994" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Following are tables i used for storing performance data.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;CREATE TABLE `nagios_metrics` (&lt;br /&gt;`metric_id` int(11) NOT NULL auto_increment,&lt;br /&gt;`instance_id` smallint(6) NOT NULL ,&lt;br /&gt;`host_object_id` smallint(6) NOT NULL ,&lt;br /&gt;`service_object_id` smallint(6)  ,&lt;br /&gt;`unit` varchar(60),&lt;br /&gt;`label` varchar(255),&lt;br /&gt;PRIMARY KEY  (`metric_id`)&lt;br /&gt;) ENGINE=InnoDB;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CREATE TABLE `nagios_metric_data` (&lt;br /&gt;`metric_data_id` int(11) NOT NULL auto_increment,&lt;br /&gt;`metric_id` int(11) NOT NULL,&lt;br /&gt;`value` double not null,&lt;br /&gt;`warn` double,&lt;br /&gt;`critical` double,&lt;br /&gt;`min` double,&lt;br /&gt;`max` double,&lt;br /&gt;`date` datetime not null,&lt;br /&gt;PRIMARY KEY  (`metric_data_id`, `metric_id`)&lt;br /&gt;) ENGINE=InnoDB;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CREATE TABLE `nagios_perf_batches` (&lt;br /&gt;`date` datetime not null,&lt;br /&gt;`last_service_check_id` int(11) not null,&lt;br /&gt;`last_host_check_id` int(11) not null,&lt;br /&gt;`host_checks` int(11) not null,&lt;br /&gt;`service_check` int(11) not null&lt;br /&gt;) ENGINE=InnoDB;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Lets take an example say we need to keep track of how cpu is getting used. For that we need to add service call CPU to monitoring host. Below is small script which outputs important cpu performance metrics : CPU Run length, User, System and Wait-on I/O. Output is like :&lt;br /&gt;&lt;br /&gt;&lt;code&gt;CPU : OK 0 | rl=0;2;5 us=2;85;85 sys=0;10;20 wa=0;5;10 total=3;80;90 &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;check_java.sh&lt;/li&gt;&lt;/ul&gt;&lt;code&gt;&lt;br /&gt;value=`vmstat 3 3 | awk -f /opt/nagios/libexec/ubuntu-sys-plugins/cpu.awk`&lt;br /&gt;returnvalue=`echo $value | awk '{print $4}'`&lt;br /&gt;echo $value;&lt;br /&gt;exit $returnvalue;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;and cpu.awk&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;{&lt;br /&gt;  #print $1,$13,$14,$15,$16;&lt;br /&gt;  if(NR&gt;=5)&lt;br /&gt;  {&lt;br /&gt;    rl=rl + $1;&lt;br /&gt;    us= us+ $13;&lt;br /&gt;    sys = sys + $14;&lt;br /&gt;    wa = wa + $16;&lt;br /&gt;  }&lt;br /&gt;  #print NR,"---&gt;", $0;&lt;br /&gt;}&lt;br /&gt;END {&lt;br /&gt;&lt;br /&gt;  rl = rl /2;&lt;br /&gt;  us= us/2;&lt;br /&gt;  sys = sys/2;&lt;br /&gt;  wa = wa /2;&lt;br /&gt;  total = us + sys + wa;&lt;br /&gt;&lt;br /&gt;  #print "Total is ", total;&lt;br /&gt;&lt;br /&gt;  if(total &lt;= 75)    {      msg = "CPU : OK"; returnvalue=0;    }    if(toal &gt; 75 &amp;amp;&amp;amp; total &lt;= 85)    {      msg = "CPU : WARINING ";      returnvalue = 1;    }    else if(total &gt; 85)&lt;br /&gt;  {&lt;br /&gt;    msg = "CPU : CRITICAL";&lt;br /&gt;    returnvalue = 2;&lt;br /&gt;  }&lt;br /&gt;  msg = sprintf("%s %d | rl=%d;2;5 us=%d;85;85 sys=%d;10;20 wa=%d;5;10 total=%d;80;90",msg,returnvalue,rl,us,sys,wa,total);&lt;br /&gt;  print msg;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;To include this monitoring script you need to add service for localhost. In nagios 3.x configuration is based on templetes. For defining we need to first add check command in file  /opt/nagios/etc/objects/commands.cfg&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# 'check_cpu command definition - tushar&lt;br /&gt;define command{&lt;br /&gt;command_name    check_cpux&lt;br /&gt;command_line    /opt/nagios/libexec/ubuntu-sys-plugins/check_cpu.sh&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Once this is done you need to add service definition in /opt/nagios/etc/objects/localhost.cfg.&lt;/li&gt;&lt;/ul&gt;&lt;code&gt;&lt;br /&gt;define service{&lt;br /&gt;use                             local-service         ; Name of service template to use&lt;br /&gt;host_name                       localhost&lt;br /&gt;service_description             CPU&lt;br /&gt;check_command                   check_cpux&lt;br /&gt;notifications_enabled           0&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_0GZ6Vgy7CVI/SMKw-QKQsRI/AAAAAAAAAuA/otvSJKljU14/s1600-h/service.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_0GZ6Vgy7CVI/SMKw-QKQsRI/AAAAAAAAAuA/otvSJKljU14/s320/service.png" alt="" id="BLOGGER_PHOTO_ID_5242947499749060882" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_0GZ6Vgy7CVI/SMKvg3n_HjI/AAAAAAAAAtw/ECkgbXBVUsE/s1600-h/output.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_0GZ6Vgy7CVI/SMKvg3n_HjI/AAAAAAAAAtw/ECkgbXBVUsE/s320/output.png" alt="" id="BLOGGER_PHOTO_ID_5242945895435017778" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Restart the Nagios by /etc/init.d/nagios restart and done! You system is now able to monitor cpu information.&lt;br /&gt;&lt;br /&gt;Below is the graph drawn in PerfNagios for the same script.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_0GZ6Vgy7CVI/SMKuxtIl0fI/AAAAAAAAAtY/tMft00jyREc/s1600-h/cpu12.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_0GZ6Vgy7CVI/SMKuxtIl0fI/AAAAAAAAAtY/tMft00jyREc/s320/cpu12.png" alt="" id="BLOGGER_PHOTO_ID_5242945085165130226" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_0GZ6Vgy7CVI/SMKvCbddJaI/AAAAAAAAAtg/Rvq_CYlJNbo/s1600-h/cpu22.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_0GZ6Vgy7CVI/SMKvCbddJaI/AAAAAAAAAtg/Rvq_CYlJNbo/s320/cpu22.png" alt="" id="BLOGGER_PHOTO_ID_5242945372478580130" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-2181203974750936898?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/2181203974750936898/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=2181203974750936898' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/2181203974750936898'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/2181203974750936898'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2008/09/building-performance-monitoring.html' title='Building Performance Monitoring Solution with Nagios and NDOUtils Part 2 PerfNagios'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_0GZ6Vgy7CVI/SMKvMQGfGcI/AAAAAAAAAto/vqx37nMMJr4/s72-c/home2.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-4464090277251148811</id><published>2008-09-06T20:15:00.002+05:30</published><updated>2009-07-16T12:38:19.463+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='performance monitoring'/><category scheme='http://www.blogger.com/atom/ns#' term='jamon'/><title type='text'>JAMon Data for Java Applications</title><content type='html'>Recently i used JAMon for gathering important metric in one application which was not j2ee application. For JDK based application how do you get information in absence of JAMon Web Interface. I asked about it to Steve Souza who imeedaitedly returned with answer :  MonitorFactory.getData() and MonitorFactory.getHeader(). Based on this data jsmons.jsp is written. For JDK based application i thought we can give same information via JMX. Below is small wrapeer to do&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Register JAmon Factory as MBean and implement some key functions like Attributes and Operations&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;pre class="xml" name="code"&gt;&lt;br /&gt;   JAMonMBean mbean = new JAMon();&lt;br /&gt;   ObjectName name = new ObjectName("jamon.perf:type=JAMonBean");&lt;br /&gt;   MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();&lt;br /&gt;   mbs.registerMBean(mbean, name);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;JAMon Client&lt;/li&gt;&lt;/ul&gt;        &lt;br /&gt;&lt;pre class="java" name="code"&gt;&lt;br /&gt;   ObjectName name = new ObjectName("jamon.perf:type=JAMonBean");&lt;br /&gt;   MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();&lt;br /&gt;   String arr[] = {key};&lt;br /&gt;   String[] signature = new String[] { "java.lang.String" };&lt;br /&gt;   obj = mbs.invoke(name,operationName, arr,signature );&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Start background thread to store information in file&lt;/li&gt;&lt;/ul&gt; &lt;br /&gt;&lt;pre class="java" name="code"&gt;&lt;br /&gt;   Object[][] data= client.getData();   &lt;br /&gt;   // record format date : label : Hits : Avg : Total : StdDev&lt;br /&gt;   String timestamp = "" + System.currentTimeMillis();&lt;br /&gt;   if(data!=null)&lt;br /&gt;   {&lt;br /&gt;    for(int i=0;i&amp;ltdata.length;i++)&lt;br /&gt;    {&lt;br /&gt;     StringBuilder sb = new StringBuilder();&lt;br /&gt;     sb.append(timestamp).append(" : ");&lt;br /&gt;     sb.append(data[i][0]).append(" : ");&lt;br /&gt;     sb.append(data[i][1]).append(" : ");&lt;br /&gt;     sb.append(data[i][2]).append(" : ");&lt;br /&gt;     sb.append(data[i][3]).append(" : ");&lt;br /&gt;     sb.append(data[i][4]);&lt;br /&gt;     pw.println(sb.toString());&lt;br /&gt;     pw.flush();&lt;br /&gt;     //System.out.println(sb.toString());&lt;br /&gt;    }&lt;br /&gt;   }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Equipped with above, I have also written a small utility which outputs information of all counters periodically in the format&lt;br /&gt;&lt;br /&gt;timestamp : label : avg. response time : hits : std. deviation&lt;br /&gt;&lt;br /&gt;I have uploaded code used to demonstrate the JAMon Bean have been uploaded at &lt;a href="http://tushar.khairnar.googlepages.com/perf-sample.zip"&gt;http://tushar.khairnar.googlepages.com/perf-sample.zip&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;Please see Sample Program for the same.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-4464090277251148811?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/4464090277251148811/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=4464090277251148811' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/4464090277251148811'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/4464090277251148811'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2008/09/jamon-data-for-java-applications.html' title='JAMon Data for Java Applications'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-7611841827213298414</id><published>2008-08-24T23:42:00.001+05:30</published><updated>2009-01-04T23:10:53.327+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='administration'/><category scheme='http://www.blogger.com/atom/ns#' term='performance monitoring'/><title type='text'>Building Performance Monitoring Solution with Nagios and NDOUtils</title><content type='html'>In my previous post i talked about Application Performance Management - APM tools and discussed possible requirements of it. I also talked about Nagios being wonderful and proven monitoring and solution. In this post i will show how to build monitoring solution with Nagios comparable to any commercial monitoring system.&lt;br /&gt;&lt;br /&gt;We will be using following components along with Nagios.&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt; NDOUtils - Storing runtime information to database &lt;/li&gt;&lt;br /&gt;&lt;li&gt; NRPE - Remote Plugin Agent&lt;/li&gt;&lt;br /&gt;&lt;li&gt; NSCA - Remote Plugin with Passive Checks&lt;/li&gt;&lt;br /&gt;&lt;li&gt; Nagvis - Visualization Addon&lt;/li&gt;&lt;br /&gt;&lt;li&gt; Nagios Business Process Addons - Custom Bird's Eye View of Business Application&lt;/li&gt;&lt;br /&gt;&lt;li&gt; NSClient++ - For monitoring Windows Hosts&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;Tough part is that these are all discrete components requires good knowledge. This series will focus on all these system and build good monitoring solution. This part will be focusing on NDOUtils and performance data. Once complete I will release the package with installation script so that it will be easy for installation.&lt;br /&gt;&lt;br /&gt;I assume you have nagios installed and working. If not visit quick-start guides &lt;a href="http://nagios.sourceforge.net/docs/3_0/quickstart-ubuntu.html"&gt;Ubuntu&lt;/a&gt;, &lt;a href="http://nagios.sourceforge.net/docs/3_0/quickstart-fedora.html"&gt;Fedora&lt;/a&gt;, &lt;a href="http://nagios.sourceforge.net/docs/3_0/quickstart-opensuse.html"&gt;OpenSUSE&lt;/a&gt;. They work perfectly. Go through nagios console and explore what nagios provide out of the box.&lt;br /&gt;&lt;br /&gt;Lets first see how to setup nagios and NDOUtils.  NDOUtils is an implementation of Nagios Event Broker module(NEB). NEB has shared object which is loaded by nagios and can register for listening events. NDOUtils passes this event to file or socket. Second part of NDOUtils is C-daemon which saves the information to database.&lt;br /&gt;&lt;br /&gt;Download ndoutils tar from nagios site. When you try to compile it you may face problem with mysql library. On Ubuntu first install mysql-dev library. Off course you have to have mysql server installed first.&lt;br /&gt;&lt;br /&gt;&lt;dd&gt;&lt;code&gt;sudo apt-get install libmysqlclient15-dev&lt;/code&gt;&lt;/dd&gt;&lt;br /&gt;&lt;br /&gt;Start mysql client and login as root. Create Database and nagios user.&lt;br /&gt;&lt;dd&gt;&lt;code&gt;&lt;br /&gt;create database nagios;&lt;br /&gt;use nagios;&lt;br /&gt;grant all on nagios.* to 'nagios'@'' identified by 'nagios'&lt;br /&gt;grant all on nagios.* to 'nagios'@'localhost' identified by 'nagios'&lt;br /&gt;&lt;/code&gt;&lt;/dd&gt;&lt;br /&gt;Go to db directory and create necessary tables.&lt;br /&gt;&lt;br /&gt;&lt;dd&gt;&lt;code&gt;./installdb -u nagios -p nagios -h localhost -d nagios&lt;/code&gt;&lt;/dd&gt;&lt;br /&gt;&lt;br /&gt;Now go ndoutil deirctory and compile the source&lt;br /&gt;&lt;br /&gt;&lt;dd&gt;&lt;code&gt;./configure --with-mysql-lib=/usr/lib/mysql&lt;/code&gt;&lt;/dd&gt;&lt;br /&gt;&lt;br /&gt;Copy binaries to nagios. This assumes that you have installed nagios in /opt/nagios (Defualt is /usr/local/nagios)&lt;br /&gt;&lt;dd&gt;&lt;code&gt;&lt;br /&gt; cp ndo2db-3x /opt/nagios/bin&lt;br /&gt; cp ndomod-3x.o /opt/nagios/bin&lt;br /&gt;&lt;/code&gt;&lt;/dd&gt;&lt;br /&gt;Also copy config files - ndomod.cfg and ndo2db.cfg from config directory to /opt/nagios/etc&lt;br /&gt;Modify Following lines.&lt;br /&gt;&lt;br /&gt;ndomod.cfg&lt;br /&gt;&lt;dd&gt;&lt;code&gt;output_type=tcpsocket&lt;br /&gt; output=127.0.0.1&lt;br /&gt; buffer_file=/opt/nagios/var/ndomod.tmp&lt;br /&gt;&lt;/code&gt;&lt;/dd&gt;&lt;br /&gt;ndo2db.cfg&lt;br /&gt;&lt;dd&gt;&lt;code&gt;socket_type=tcp&lt;br /&gt; db_name=nagios&lt;br /&gt; db_user=nagios&lt;br /&gt; db_pass=nagios&lt;br /&gt;&lt;/code&gt;&lt;/dd&gt;&lt;br /&gt;Now open nagios.cfg file and modify following keys&lt;br /&gt;&lt;dd&gt;&lt;code&gt;&lt;br /&gt; event_broker_options=-1&lt;br /&gt; broker_module=/opt/nagios/bin/ndomod-3x.o config_file=/opt/nagios/etc/ndomod.cfg&lt;br /&gt;&lt;/code&gt;&lt;/dd&gt;&lt;br /&gt;Now start ndo2db daemon before restarting nagios&lt;br /&gt;&lt;dd&gt;&lt;code&gt;&lt;br /&gt; /opt/nagios/bin/ndo2db-3x -c /opt/nagios/etc/ndo2db.cfg&lt;br /&gt;&lt;/code&gt;&lt;/dd&gt;&lt;br /&gt;Restart Nagios&lt;br /&gt;&lt;dd&gt;&lt;code&gt;&lt;br /&gt; /opt/nagios/bin/nagios -d /opt/nagios/etc/nagios.cfg&lt;br /&gt;&lt;/code&gt;&lt;/dd&gt;&lt;br /&gt;Now start mysql client and check nagios_hosts and nagios_services table to see that data is getting saved.&lt;br /&gt;&lt;br /&gt;You can put following lines /etc/rc.local so that all events fired by Nagios ( which is started from /etc/init.d/nagios script) are picked up and processed. This makes everything started when machine boots up.&lt;br /&gt;&lt;br /&gt;&lt;dd&gt;&lt;code&gt;/opt/nagios/bin/ndo2db-3x -c /opt/nagios/etc/ndo2db.cfg&lt;/code&gt;&lt;/dd&gt;&lt;br /&gt;&lt;br /&gt;Once this is done all your data is saved to database. Now we can build our Performance Parser on top of this. I will come-up with shell or perl script for all installation once complete.&lt;br /&gt;&lt;br /&gt;..&lt;br /&gt;Tushar&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-7611841827213298414?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/7611841827213298414/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=7611841827213298414' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/7611841827213298414'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/7611841827213298414'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2008/08/building-performance-monitoring.html' title='Building Performance Monitoring Solution with Nagios and NDOUtils'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-7505548433316751221</id><published>2008-08-19T23:29:00.001+05:30</published><updated>2009-01-04T23:11:28.208+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='performance monitoring'/><title type='text'>Java Performance : Monitoring and Measurements - APM</title><content type='html'>Recently I came across &lt;a href="http://www.ibm.com/developerworks/library/j-rtm1/index.html"&gt;this&lt;/a&gt; (Run-time performance and availability monitoring for Java systems) wonderful series of articles about implementing run-time performance monitoring for application's ecosystem sometimes its called APM (Application Performance Management). This series really good piece of information every person who needs to implement some kind of ecosystem for performance needs to read it. But all screen shots resemble Wily Introscope so basically it describes everything what Introscope does.&lt;br /&gt;Article say Helios is the reference implementation of idea discussed.&lt;br /&gt;&lt;br /&gt;It covers&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Monitoring fundamentals&lt;/span&gt; - Why you need it. What you need it - Periodic reports based on template and custom reports, Historical storage and analysis, Live Visualization and simultaneous plotting for correlation, Alerting : based on email, blackberry, sms or JMS with GUI, Dashboards &lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Recent advancements&lt;/span&gt; - like Agentless monitoring, Synthetic Transaction&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight:bold;"&gt;Some very high-level design details&lt;/span&gt; - Performance Data Source, Collector, Tracers&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Tracing patterns&lt;/span&gt; : Polling, Listening, Interception , Instrumentation &lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;And about how you go about performance monitoring in general?&lt;br /&gt;&lt;br /&gt;It focuses JMX as primary way of doing things but if you look towards commercial APM like CA Wily's Introscope these are not JMX based. I feel if your application is java centric then it helps to have java based apm : Introscope Wily.&lt;br /&gt;&lt;br /&gt;I would like to add following too.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Synthetic transactions :&lt;/span&gt; I feel synthetic transactions are really helpful but at the same time difficult to implement. Tools like Grinder can help you to implemented these.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Application Specific Metrics :&lt;/span&gt; Generally you have infrastructure metrics like os metrics, storage metrics, network and application infrastructure metrics like : App Server metrics (queue length, response time) and Database : avg. query time. But sometime you may require to gather application/business specific metrics. An example would be say : policies issued per day. Framework should be flexible to allow such metric to be posted to APM where it can then be correlated to technical metrics.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Dignosis :&lt;/span&gt; Also APM should be able to switch gears when problem occurs. When problem occurs APM should start collecting data at more granular level so as to get more refiend picture of system. Introscope has dignosis tool called : Transaction Monitor which traces entire transaction as one context. Article though talks about "heavy instrumentation" as i guess there&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Heuristics:&lt;/span&gt; APM should also provide some level of analysis (rule based) like what  Glassbox does. See demo http://demo.glassbox.com/glassbox&lt;br /&gt;&lt;br /&gt;Dilemma with APM systems is that commercial products like IBM Tivoli, HP OpenView, Mercury BAC come with many features with hefty cost. So open-source comes to rescue here : There lot of Open-source projects which implement this idea. I am big fan of Nagios. Others like Groundwork Monitor implement extra functionality around nagios. Nagios 3.0 has made lot of progress and now &lt;span style="font-style: italic;"&gt;"installable"&lt;/span&gt; for normal user with this guide. &lt;a href="http://nagios.sourceforge.net/docs/3_0/quickstart.html"&gt;http://nagios.sourceforge.net/docs/3_0/quickstart.html&lt;/a&gt;&lt;br /&gt;Also, if your application is java centric then it makes good seance to have JMX based system as described in this article. Sometimes you don't need full blown system. In such situation tools like &lt;span style="font-weight: bold;"&gt;JAMon API&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;/span&gt; can help you. Do visit JAMon site it will surely help you even its recommended to keep running on production environment.&lt;br /&gt;&lt;br /&gt;If you are interested in java profiling and how its done read : &lt;a href="http://www-128.ibm.com/developerworks/java/library/j-jip/"&gt;Build your own profiling tool&lt;/a&gt;  and Jensor (jensor.sourceforge.net). Jensor is java profiler built by TCS's Performance Engg Group ( from where i started my career) is focused on first article mentioned but has good analysis gui which helps you to dig in. Commercial profilers JProbe and JProfiler are really good.&lt;br /&gt;&lt;br /&gt;In past I had experimented same idea with system called Nagios. There focus was to implement performance monitoring system for the entire lab. We had written Nagios plugins for Webspere(PMI based) and weblogic ( weblogic shell) for collecting performance metrics. Nagios but, is only scheduling and executing engine which does not effectively care about the data ( Currently with 3.0 version it has lot of extension points where you can save events and performance data in mysql or postgres database). So we had used small open-source system &lt;a href="http://perfparse.sourceforge.net/"&gt;Perfparse&lt;/a&gt; for performance data and pulling out reports. In our lab we had implemented this on about 80 servers on single CPU monitoring machine running RHEL 4.0. Worked very well for me.&lt;br /&gt;&lt;br /&gt;Best one is the one which solved your problem!!.&lt;br /&gt;&lt;br /&gt;..&lt;br /&gt;Tushar&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-7505548433316751221?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/7505548433316751221/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=7505548433316751221' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/7505548433316751221'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/7505548433316751221'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2008/08/java-performance-monitoring-and.html' title='Java Performance : Monitoring and Measurements - APM'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-3451489280825317646</id><published>2008-08-15T12:17:00.001+05:30</published><updated>2009-01-04T23:11:44.597+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Meet the People Who Have Trillions Riding on Linux this Fall</title><content type='html'>Hi,&lt;br /&gt;&lt;br /&gt;Recently i cam across this link : &lt;a href="http://www.linux-foundation.org/weblogs/jzemlin/2008/07/09/meet-the-people-who-have-trillions-riding-on-linux-this-fall/"&gt;Meet the People Who Have Trillions Riding on Linux this Fall&lt;/a&gt;. This shows how deep linux has penetrated. Linux is handling trillions of money. Wow!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-3451489280825317646?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/3451489280825317646/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=3451489280825317646' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/3451489280825317646'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/3451489280825317646'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2008/08/meet-people-who-have-trillions-riding.html' title='Meet the People Who Have Trillions Riding on Linux this Fall'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-7275741095062851016</id><published>2008-08-13T23:37:00.001+05:30</published><updated>2009-01-04T23:12:06.774+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='multicore'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Java Performance - Multi Core Processors</title><content type='html'>Hi i was reading book called Java Concurrency in Practice by Brian Goetz and others.&lt;br /&gt;I found this interesting quote :&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;"For the past 30 years, computer performance has been driven by Moore's Law; from now on, it will be driven by Amdahl's Law. Writing code that effectively exploits multiple processors can be very challenging."&lt;span style="font-style:italic;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Amdahl's law describes how much a program can theoretically be sped up by additional computing resources, based on the proportion of parallelizable and serial components.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://g.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html"&gt;util.concurrent&lt;/a&gt; from Doug Lea brought Java Concurrency API right into JDK. From starting java was the first (at first among mainstram prograaming languages)&lt;br /&gt;language to support Multithreading. With JAVA 5 any developer can write safe and scalable Java programs.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;All latest processors now are multi-core processors this clearly shows shift towards parallel systems where your program has to effectively use all hardware thread underlying cpu provides. Unless programs are completely multithreaded, they simply won’t use the power available in hugely multicore systems. Lot of attention is given to transform code to multi-thread code. Read this post for details :  &lt;a href="http://apcmag.com/we_can_transform_single_thread_to_multithread_intel.htm"&gt;"Intel: We Can Transform Single Thread to Multithread"  &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I also got to read this wonderful post which discusses Java Performance mainly GC on multicore processors : &lt;a href="http://www.devwebsphere.com/devwebsphere/2006/11/multicore_may_b.html"&gt;&lt;span style="font-weight:bold;"&gt;Multicore may be bad for Java&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Indeed Java is Multicore Ready I believe .. Happy Multithreading.&lt;br /&gt;&lt;span style="font-style:italic;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;..&lt;br /&gt;Tushar&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-7275741095062851016?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/7275741095062851016/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=7275741095062851016' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/7275741095062851016'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/7275741095062851016'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2008/08/java-performance-multi-core-processors.html' title='Java Performance - Multi Core Processors'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-4959945005493707867</id><published>2008-08-10T18:32:00.002+05:30</published><updated>2009-01-04T23:13:18.401+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='tech'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>My New Laptop - Acer 2920</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_0GZ6Vgy7CVI/SJ7rODemExI/AAAAAAAAArk/aPMqpaC5YK4/s1600-h/DSC00403.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_0GZ6Vgy7CVI/SJ7rODemExI/AAAAAAAAArk/aPMqpaC5YK4/s320/DSC00403.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5232878443735421714" /&gt;&lt;/a&gt;&lt;br /&gt;Hi, weeks before I bought new laptop for me Acer 2920. Earlier I had blogged about my journey with linux earlier. Linux was mandatory criteria for my laptop. So i had experimented a lot with different laptop reviewed them on internet. My brother's Laptop : Sony VAIO CR12GB/H had responded well to linux call ... it was so good that my brother is now linux convert uses Ubuntu prefarably (See snapshot Below).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Other criteria being : Windows XP. I feel Vista is a big flop specially for countries like india where hardware here is atleast 6-7 months behind latest technology. In very first post on this blog I mentioned my disappointment in following words &lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;"And last thing i want to say about VISTA is that its fooling people around. It takes seconds to load dekstop and pretend ready for action but reality is different. It take much more time to get all networking started and then i can start my browser. With linux it takes time to login but I know when its now ready - ready for anything file explorer, browser and mp3. "&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_0GZ6Vgy7CVI/SJ7r1nqnLiI/AAAAAAAAArs/FulBJc8NKKs/s1600-h/DSC00404.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_0GZ6Vgy7CVI/SJ7r1nqnLiI/AAAAAAAAArs/FulBJc8NKKs/s320/DSC00404.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5232879123464400418" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;But the market here in India is not that good. You don't get Windows XP laptop with good hardware these days. So I had to go cost mode .. laptops which are targeted as utility laptops : I settled for Lenovo and then i saw this beauty in Vijay Sales Thane Shop. Sales Guy was really friendly and allowed to boot the laptop with ubuntu live CD. It passed the test. &lt;span style="font-weight:bold;"&gt;Acer 2920 is the smallest laptop around with no compromise on hardware or any necessary features.&lt;span style="font-style:italic;"&gt;&lt;/span&gt;&lt;/span&gt; It comes with driver CD for both Vista and XP which is not common in latest laptops which restrict you to vista only.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_0GZ6Vgy7CVI/SJ7thqnVlmI/AAAAAAAAAr0/0pFp9VvORd4/s1600-h/DSC00407.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://4.bp.blogspot.com/_0GZ6Vgy7CVI/SJ7thqnVlmI/AAAAAAAAAr0/0pFp9VvORd4/s320/DSC00407.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5232880979681842786" /&gt;&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;so if you are looking for good utility laptop : Acer is good brand and certainly best one for linux laptop. I recommend Sony also : Sony is also good value for money. Sony laptops have good sound quality : loud and clear, clear crisp bright display. VAIO CR series certainly suited for the most.&lt;br /&gt;&lt;br /&gt;..&lt;br /&gt;Tushar&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-4959945005493707867?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/4959945005493707867/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=4959945005493707867' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/4959945005493707867'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/4959945005493707867'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2008/08/my-new-laptop-acer-2920.html' title='My New Laptop - Acer 2920'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_0GZ6Vgy7CVI/SJ7rODemExI/AAAAAAAAArk/aPMqpaC5YK4/s72-c/DSC00403.JPG' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-4692236346282946135</id><published>2008-08-09T00:35:00.001+05:30</published><updated>2009-01-04T23:12:44.516+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='terracotta'/><title type='text'>Java Performance : Caching Clustering ... and "FlushCache"</title><content type='html'>Hi i came back after long time. This time again with java. Recenly playing with lot of java solutions relating to scaling and clustering. Lot of places java high performacne systems you see buzzwords like  multi-threading, clustering, caching, map-reduce, partitioning, grid solutions. Lets discuss some of them.&lt;br /&gt;&lt;br /&gt;I have been using hibernate for last 1.5 year in my personal experiments and at work place too. In one of project we had cache requirement for master data which was read-only. There we had implemented caching by hand as follows.&lt;br /&gt;&lt;br /&gt;1. Wrapper around DAOs which first check in cache and then go to database.&lt;br /&gt;2. Cache was implemented with Websphere provided object pooling API.&lt;br /&gt;3. Websphere provided object pooling mechanism which even works in clustered set-up or network deployment with cache replication strategies.&lt;br /&gt;&lt;br /&gt;Our requirement was well met and caching brought lot of improvement in response time as expected.&lt;br /&gt;&lt;br /&gt;After caching, horizontal scaling or clustering comes into my mind when i think about performance.&lt;br /&gt;Since then, I discovered lot of caching/clustering projects/apis, some of which are very much i feel worth to take a note.&lt;br /&gt;&lt;br /&gt;1. &lt;a href="http://www.theserverside.com/news/thread.tss?thread_id=43256"&gt;Tangosol&lt;/a&gt; - recently acquired by Oracle, along with oracle, timesten ( oracle in-memory database, another acquisition :-) ) forms formidable data-tier. Tangasol is very proven prodcut which provides lot of features like distributed cache, data partitioning. Cameron Purdy on Theserverside claims to reach upto 0.5 milllion cache transaction per second.&lt;br /&gt;&lt;br /&gt;2. &lt;a href="http://www.terracotta.org/"&gt;Terracotta&lt;/a&gt; :- Terracotta is very revolutionary java product in fact listed in top 10 java things of year. Terracotta actually speaking is not caching solution but a clustering solution. Its basically JVM level clustering. They have provided cache solutions for lot of commons requirements : Hibernate, HTTP Session, Spring Beans etc. They provide good extension for lot of open-source projects. I had tested tomcat clustering and terracotta, similar to one on terracotta site and it gives good performance boost. Among all other clustering solutions terracotta has simplest programming model : NO PROGRAMMING MODEL. right : objects basically clustered at jvm level so only configuration change no code change. Practically you do require to change java code but that's minimal All java semantics work well in terracotta cluster. Terracotta is very useful in patterns like Master/Worker or bunch processes looking for some coordination or data sharing. Master Worker pattern term i guess was introduced much before Googles Map/Reduce and very much the same idea.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3. Memcached : this one is in c but has client libraries in almost all major  programming languages. Idea of memcached is actually little bit different. You keep bunch of memcached process running objects are stored on these processes with hash key. Memcached works best when its processes run on web servers which are cpu-intensive with lot of memory available.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;4. New bunch of grind frameworks : gigaspaces, hadoop  - java map-reduce implementation&lt;br /&gt;&lt;br /&gt;But now i had come across very different requirement where cache modification (writes) were significant in numbers and jdbc-batching with asynchronous operation was key to performance sometime this is called - write behind. When i looked upon only tangosol claims to have such facility so i decided to implement by hand. Here is an idea.&lt;br /&gt;&lt;br /&gt;1. A background threads basically monitors queue.&lt;br /&gt;2. All cache write operations append modified objects to this queue.&lt;br /&gt;3. queue periodically flushes them to database and notifies successful operation to clients.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here catch is how do you handle object graph updates&lt;br /&gt;1. Delta Calculation&lt;br /&gt;2. New Object insertion may require updates in one specific order where result of first inserts basically required for next one. (foreign key)&lt;br /&gt;&lt;br /&gt;Initially i went with hibernate where i used StatelessSession as SQL generation engine hoping that hibernate will calculate delta properly. But lack of L1 cache means no life cycle hence no delta monitoring. So i had two choices.&lt;br /&gt;&lt;br /&gt;1. Use merge : Fires extra selects&lt;br /&gt;2. Generate sql by hand.&lt;br /&gt;&lt;br /&gt;With help of cglib proxies i managed to get list of dirty columns but then how do you handle object relationships?&lt;br /&gt;&lt;br /&gt;I soon realized whole ORM needs to be implemented... here list of requirements for basic ORM cum cache with write-behind&lt;br /&gt;&lt;br /&gt;1. easy configuration : declarative orm mapping sufficient for most of scenarios&lt;br /&gt;2. Should provide different execution strategies timer driven, threadpool driven, batch reached, batch and timer combined, entity level strategy for sync&lt;br /&gt;3. in-memory multi-indexing based on columns or own implementation : cache object can be queried with different criteria&lt;br /&gt;4. notification - listeners&lt;br /&gt;5. target rate with % of write operation : 500 requests/second.&lt;br /&gt;5. recovery test : check points : automated and manual&lt;br /&gt;6. clustering with help of terracotta.&lt;br /&gt;&lt;br /&gt;This is exhaustive list .. where first one itself is very big one..... my take on it is to restrict the scope and focus on caching instead of fancy orm stuff the one like hibernate.... it should be able to support only object graph ... all lifecycle is left to user..&lt;br /&gt;&lt;br /&gt;I will add code snippets in coming posts ... now only idea has been finalized.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-4692236346282946135?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/4692236346282946135/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=4692236346282946135' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/4692236346282946135'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/4692236346282946135'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2008/08/java-performance-caching-clustering-and.html' title='Java Performance : Caching Clustering ... and &quot;FlushCache&quot;'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-1125585093675434530</id><published>2008-05-25T13:46:00.005+05:30</published><updated>2009-01-04T23:14:16.228+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='fun'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>My Linux Journey</title><content type='html'>&lt;span style="font-weight: bold;"&gt;My Linux Journey&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;My linux journey started in my engineering days when i got 3 cds of redhat 9.0. I did not have internet connection and only source was friends and computer magazines. I was very much impressed with it first i installed it but then i did not have anything to do with it i had Photoshop, Flash, Dreamweaver and Frontpage in windows and Age Of Empires too!!. I installed software called System Commander which was sort of protector for my system. At that time i did not have any guts to play with GRUB. And no live CDs for recovery. It is boot loader and system software. One time i had 6-7 different OS on my system - Windows 98/NT (don't exactly remember but i am proud of the fact i had worked on all version of windows - 3.1,95,98,ME,NT4,XP,2000,2003 and now VISTA, funny thing is that all of them have crashed on my system - blue screen of death. Most delicate was ME and  NT,2003 were rock solid XP being most practical), Windows XP, Red hat 9, Damn small linux, Minix, some linux distro that used to fit on floppy i had installed it on my harddisk thanks to System Commander. I used test new versions and flavor of linux &lt;span style="color: rgb(0, 0, 0);font-size:130%;" &gt;&lt;span style="font-weight: bold;"&gt;Just for fun&lt;/span&gt;&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;By the way&lt;span style="font-size:130%;"&gt; &lt;span style="font-weight: bold; color: rgb(0, 0, 0);"&gt;Just For Fun&lt;/span&gt; &lt;/span&gt;is autobiography of Linux Torvalds - very funny book if you are geek/programmer you will definitely like it. i did.&lt;br /&gt;&lt;br /&gt;But then after lot of crashes, partition formatting/reformatting,i settled on Windows XP which worked without any hassles. Occasionally i used to boot into linux again just for fun.&lt;br /&gt;&lt;br /&gt;After i got my first salary i started upgrading my pc. I bought new 80GB harddisk so that i could have more space to store data for windows. I reserved 20 GB for linux and tried a new (for me till that time i was familiar with only redhat linux) and hot distro of that time - UBUNTU. I liked it so much that i replaced my fedora with ubuntu moving all my data to it. But i still thought XP is better than ubuntu.&lt;br /&gt;&lt;br /&gt;For last 6 months my brother's laptop has been sort of laboratory for me. My old (infact very old) PIII 800Mhz box can not take it any more. I was very much excited to idea of virtualization. Till 6 months before i was not confident enough on linux desktop so i was using Windows XP and with virtualization i could run ubuntu right within windows - best of two worlds. I tried ubuntu 7.04, 7.10 8.04, Kububtu 7.10, gOs2 beta, Oracle Linux, and Fedora.&lt;br /&gt;&lt;br /&gt;I have been successful in attempts to convert my borther in to a linux follower - thanks to the buggy and resource hungry Windows Vista. Who want that eye candy when you get similar( though not that good though) graphics effects on linux without any performance loss.&lt;br /&gt;&lt;br /&gt;After lauch of Ubuntu 8.0 beta i thought i will give it a try for desktop linux. I used ubuntu for over a week without booting linux on my old box PIII 800Mhz 256MB RAM. Whenver i required any application i went to Add/Remove did  a simple search and i could find and use ( without any crash - earlier also i had used linux but most of the time something used to crash) equivalent linux application. Only reason i had to boot into windows being to check my office applications - Site works only on Internet Explorer. I never tried Wine yet now i&lt;br /&gt;need it.&lt;br /&gt;&lt;br /&gt;Most suprising thing is that Ubuntu 8.0 worked out of the box on Sony VIAO CR12GH/B laptop. Ubuntu 7.10 has some difficulty recognising intel x3100 graphics accelerator hence screen resolution was limited to 800x600 ( i tweaked  Xorg conf and it worked with resolution 1200x800 on ubuntu 7.10 as well).&lt;br /&gt;&lt;br /&gt;Earlier whenever i worked on linux i knew something would go wrong and i accepted it now i dont have that feeling - Ubuntu ROCKS.&lt;br /&gt;&lt;br /&gt;Till that moment i used to think linux is just not ready for desktop for normal user( i am half normal and half geek - i am passionate about linux but have grown in comforts of windows) ( there are plenty reasons for it - h/w  is one major reason i feel). But last 2 years i have seen great growth in linux distros mainly Fedora, Suse and Ubuntu.&lt;br /&gt;&lt;br /&gt;If you have good standard hardware on your box linux is READY for you and certainly is for Me and it will beat windows vista in user experience. Major reason for this fact is buggy and bulky VISTA. i get rating of only 3.0 out of 5.0 with very strong hardware for laptop. What the heck what do you want exactly VISTA? 5 GHz processor. 2 GB graphics card????&lt;br /&gt;&lt;br /&gt;Here is my list:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Rythmbox&lt;/span&gt;&lt;br /&gt;Window Media Player/Winamp - Windows media player takes around 50% CPU when playing high beat rate (more than 150 Kbps) mp3 Winamp and rythmbox take less cpu.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Totem/VLC&lt;/span&gt;&lt;br /&gt;Movie player I love VLC. Its best player avaialable. Windows Media player really sucks here. I just cannot run any movie in my p3 box with version 10 onwards. VLC is much better both on windows and linux. Whats better than having your favoiurite application avaialable on both systems. Again windows application sucks here.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Bit-torrent&lt;/span&gt;&lt;br /&gt;Microtorrent is very good but so is azureus and Transmission. No problems here too.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;    Browser&lt;/span&gt;&lt;br /&gt;Firefox 3.0 rocks and blazingly fast on sony vaio laptop. I can not get same performance on Vista/IE or Vista/Firefox combination. Most developers say Firefox 3.0 is the FASTEST browser to date. I did not get any improvment on my p3 box (windows xp). But i could feel firefox more responsive on linux on both systems - XP(PIII) as well as Vista(Core 2 Duo T7100). Why is so?. I really dont know neither i don't believe in benchmark numbers ( i have done performance testing/benchmarking i know how misleading sometime they could be). As performance engineer i used to give importance on fact how end-users are experincing it. Did they find any improvement or felt good. With firefox 3.0 on linux i felt. On other note IE7 is not that bad too. But i am firefox convert. long time ago.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;    Programming&lt;/span&gt;&lt;br /&gt;Editplus beats any lightweight editor in linux. I have not tried anything other that GEdit. Gedit is little bit heavy ( on P3). But i could find editor called Geany i liked it very much. I used Ecliplse for most of my Java programming and was disappointed a bit on linux. On thing about IDE i care is how it uses screen effectively to pack useful stuff. On linux SWT occupies much more space than on windows.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;    Office&lt;/span&gt;  &lt;br /&gt;Nothing to say. OpenOffice is really behind MS Office. but i have different opinion here. Dominance of MS Office is just because of numbers. What would you do if you have to write some document and mail it to somebody. I could find one alternative in OpenOffice, Convert that document to PDF and mail it. I just hate rebooting again to windows and edit that doc.&lt;br /&gt;&lt;br /&gt;For other applications you can refer to this interesting links :&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;&lt;a href="http://www.littleubuntu.com/blog/?p=3" rel="bookmark" title="Permanent Link to Awesome Ubuntu/Linux Apps you might not know about"&gt;Awesome Ubuntu/Linux Apps you might not know about&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;font-size:100%;" &gt;&lt;a href="http://www.emmaalvarez.com/2007/12/top-best-50-ubuntu-opensource.html"&gt;&lt;span&gt;Top Best 50 Ubuntu App for Designing&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;And last thing i want to say about VISTA is that its fooling people around. It takes seconds to load dekstop and pretend ready for action but reality is&lt;br /&gt;different. It take much more time to get all networking started and then i can start my browser. With linux it takes time to login but i know when its&lt;br /&gt;now ready - ready for anything file explorer, browser and mp3. In and all if you don't have any reason to stick to windows like you IDE works only in&lt;br /&gt;windows then go and install ubuntu (or any linux) give it a try. Vista is just not ready for countries like india where latest hardware comes to&lt;br /&gt;mainstream atleast 6-8 months after. Concepts like open source, linux, ubuntu, free document formats (openoffice), OLAP (one laptop per child) are very much suitable in developing countries. This will make sure that user gets what it need and hes not forced to buy first windows then Microsoft office and&lt;br /&gt;then anti-virus then internet protection software to protect windows. its chain that's not needed and can certainly be avoided.&lt;br /&gt;&lt;br /&gt;More or less computing is for fun as said by Linus Torvalds in his thoughts on life... so enjoy it. I certainly enjoyed it with linux.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-1125585093675434530?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/1125585093675434530/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=1125585093675434530' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/1125585093675434530'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/1125585093675434530'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2008/05/my-linux-journey-my-linux-journey.html' title='My Linux Journey'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-3327036455253349089</id><published>2008-05-25T13:46:00.003+05:30</published><updated>2009-01-04T23:13:03.119+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Oracle on Ubuntu Hardy Haron</title><content type='html'>I had hard time installing oracle on my brother's sony vaio laptop. Not because of linux but because of windows i was out of space on ubuntu and wanted to shrink windows partition. i had strage expeprice with it. Windows does not let me to shring below 1 GB. Why? may be some technical difficuly. huh! then i started with ubuntu 8.0 live cd, opened Gparted i could resize my NTFS partition. Wow! why windows wouldnt allow then? Does it know that i had ubuntu installed on this laptop and user of this laptop dosent prefer windows. Only reson that i went to windows to resize is because vista is very particular of stratup files and my exprience with NTFS on linux is bad. lost lot of data once.&lt;br /&gt;Within 2 hour  gparted moved my 50 gb partition. freed 16 gb for linux and 2gb for swap.&lt;br /&gt;&lt;br /&gt;Very first thing i noticed is that oracle doesnt support ubuntu as officially supported linux distribution but i could manange to find installation guide for debian. Its recommended to go with RHEL/SUSE Enterprise if you are using for commercial purpose.&lt;br /&gt;&lt;br /&gt;Here are some of links for pre-setup tasks :&lt;br /&gt;&lt;ul&gt;&lt;li&gt;http://linux.togaware.com/survivor/Oracle_10g.html&lt;/li&gt;&lt;li&gt;http://www.akshaymehta.com/2006/12/10/installing-oracle-10g-r2-on-ubuntu-edgy/&lt;/li&gt;&lt;li&gt;http://rossov.com/2006/02/08/oracle-10g-ubuntu-linux-vmware-part-ii/&lt;/li&gt;&lt;li&gt;http://www.oracle.com/technology/pub/articles/smiley_10gdb_install.html&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Even oracle's Installation Guide is also helpful.&lt;br /&gt;&lt;br /&gt;Follow all the steps correctly. This actually helps you in case you come across some problem, Since you know what is installed where?&lt;br /&gt;So here we go start terminal with oracle users&lt;br /&gt;&lt;br /&gt;   &lt;span style="font-family:courier new;"&gt;su oracle&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    ./runInstaller -ignoreSysPrereqs&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;-ignoreSysPrereqs is flag that allows oracle to proceed without check. Alternative is to create file /etc/release and pretend that i am rhel.&lt;br /&gt;&lt;br /&gt;Installlation went more or less smooth but i faced some problem which are faced by many people. I has faced similar problems on RHEL too!. Little bit of googling will solve most of them.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Linking phase fails for 10gR2 on Ubuntu 6.06: undefined ref to 'nnfyboot'&lt;/li&gt;&lt;/ul&gt;Solution : Create following sysmlinks and relink&lt;br /&gt;   ln -s $ORACLE_HOME/lib/libclient10.a $ORACLE_HOME/lib/libagtsh.a&lt;br /&gt;   $ORACLE_HOME/bin/genagtsh $ORACLE_HOME/lib/libagtsh.so 1.0&lt;br /&gt;&lt;br /&gt;This problme is discussed &lt;a href="http://forums.oracle.com/forums/thread.jspa?threadID=413032&amp;amp;tstart=0"&gt;here&lt;/a&gt; and worked on ubuntu 8 too:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Right version libstc++ library on my ubuntu 8.04 version was 6.x. So i created following symlink &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;dd&gt;libstdc++.so.6 -&gt; libstdc++.so.1 ( Present)&lt;br /&gt;libstdc++.so.5 -&gt; libstdc++.so.1 ( Oracle tries to find it, so i added)&lt;br /&gt;&lt;/dd&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;"ORA-12547: TNS:lost contact" when creating database in Oracle 10g. Lib AIO Error  This is very annoying.After installation oracle starts configuration assistant DBCA. After googling a bit around i found out libaio was required. In ubunntu it is called libaio1.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;   &lt;br /&gt;&lt;dd&gt;&lt;br /&gt;So do &lt;code&gt;apt-get install libaio1&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   This problm is discussed in this &lt;a href="http://www.linuxquestions.org/questions/linux-software-2/ora-12547-tnslost-contact-when-creating-database-in-oracle-10g-404415/"&gt;thread&lt;/a&gt; for Fedora.&lt;br /&gt;&lt;/dd&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;  Most of the problems were in linking phase hence i did $ORACLE_HOME/bin/relink all again to make sure that all changes have been affected.&lt;br /&gt;&lt;br /&gt;  Now oracle is working fine on ubuntu 8.04 beta.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-3327036455253349089?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/3327036455253349089/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=3327036455253349089' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/3327036455253349089'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/3327036455253349089'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2008/05/oracle-on-ubuntu-hardy-haron.html' title='Oracle on Ubuntu Hardy Haron'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4556017295143623721.post-3497532449376555751</id><published>2008-05-25T11:33:00.001+05:30</published><updated>2009-01-04T23:14:56.795+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='ajax'/><title type='text'>How to integrate DWR and Struts</title><content type='html'>DWR is AJAX framework for JAVA. Using DWR you can call directly any method of java class asynchronously ie. without entire page reload. With following you can even integrate DWR with struts so as to have access to important formbeans and also any other java classes.  Only restriction being : methods to be called has to be form methods. This is easily done by refactoring code in Action class to form class. By this way you can call this code from Action class as well as via ajax.&lt;br /&gt;&lt;br /&gt;Add dwr.jar to web project&lt;br /&gt;&lt;br /&gt;Modify Web.xml Add following code to web.xml. Make sure DWR servlet gets loaded after ActionServlet.&lt;br /&gt;&lt;br /&gt;&lt;pre class="xml" name="code"&gt;&lt;br /&gt;&amp;lt;servlet&amp;gt;&lt;br /&gt;    &amp;lt;servlet-name&amp;gt;dwr-invoker&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;    &amp;lt;servlet-class&amp;gt;org.directwebremoting.servlet.DwrServlet&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;    &amp;lt;init-param&amp;gt;&lt;br /&gt;      &amp;lt;param-name&amp;gt;debug&amp;lt;/param-name&amp;gt;&lt;br /&gt;      &amp;lt;param-value&amp;gt;true&amp;lt;/param-value&amp;gt;&lt;br /&gt;    &amp;lt;/init-param&amp;gt;&lt;br /&gt;    &amp;lt;init-param&amp;gt;&lt;br /&gt;      &amp;lt;param-name&amp;gt;activeReverseAjaxEnabled&amp;lt;/param-name&amp;gt;&lt;br /&gt;      &amp;lt;param-value&amp;gt;true&amp;lt;/param-value&amp;gt;&lt;br /&gt;    &amp;lt;/init-param&amp;gt;&lt;br /&gt;    &amp;lt;init-param&amp;gt;&lt;br /&gt;      &amp;lt;param-name&amp;gt;initApplicationScopeCreatorsAtStartup&amp;lt;/param-name&amp;gt;&lt;br /&gt;      &amp;lt;param-value&amp;gt;true&amp;lt;/param-value&amp;gt;&lt;br /&gt;    &amp;lt;/init-param&amp;gt;&lt;br /&gt;    &amp;lt;init-param&amp;gt;&lt;br /&gt;      &amp;lt;param-name&amp;gt;maxWaitAfterWrite&amp;lt;/param-name&amp;gt;&lt;br /&gt;      &amp;lt;param-value&amp;gt;100&amp;lt;/param-value&amp;gt;&lt;br /&gt;    &amp;lt;/init-param&amp;gt;&lt;br /&gt;    &amp;lt;!--&lt;br /&gt;    &amp;lt;init-param&amp;gt;&lt;br /&gt;      &amp;lt;param-name&amp;gt;org.directwebremoting.extend.ServerLoadMonitor&amp;lt;/param-name&amp;gt;&lt;br /&gt;      &amp;lt;param-value&amp;gt;org.directwebremoting.impl.PollingServerLoadMonitor&amp;lt;/param-value&amp;gt;&lt;br /&gt;    &amp;lt;/init-param&amp;gt;&lt;br /&gt;    --&amp;gt;&lt;br /&gt;    &amp;lt;load-on-startup&amp;gt;2&amp;lt;/load-on-startup&amp;gt;&lt;br /&gt;  &amp;lt;/servlet&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;    &amp;lt;servlet-name&amp;gt;dwr-invoker&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;    &amp;lt;url-pattern&amp;gt;/dwr/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;  &amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Create dwr.xml file. This file will tell DWR which classes are to be exposed for asynchronous calls. Following example file exposes PersonFrom class using interface name Forms using Struts Creator.  It also exposes Date class as remote class JDate.&lt;br /&gt;&lt;br /&gt;&lt;pre class="xml" name="code"&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;&amp;lt;!DOCTYPE dwr PUBLIC "-//GetAhead Limited//DTD Direct Web Remoting 2.0//EN" "http://getahead.org/dwr//dwr20.dtd"&amp;gt;&lt;br /&gt;&amp;lt;dwr&amp;gt;&lt;br /&gt; &amp;lt;allow&amp;gt;&lt;br /&gt;  &amp;lt;create creator="new" javascript="JDate"&amp;gt;&lt;br /&gt;   &amp;lt;param name="class" value="java.util.Date" /&amp;gt;&lt;br /&gt;  &amp;lt;/create&amp;gt;&lt;br /&gt;  &amp;lt;create creator="struts" javascript="forms"&amp;gt;&lt;br /&gt;   &amp;lt;param name="formBean" value="personForm" /&amp;gt;&lt;br /&gt;  &amp;lt;/create&amp;gt;&lt;br /&gt;  &amp;lt;convert converter="bean" match="$Proxy*" /&amp;gt;&lt;br /&gt; &amp;lt;/allow&amp;gt;&lt;br /&gt;&amp;lt;/dwr&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Include following lines in JSP for adding DWR javascripts. “forms.js” refers to our “forms” class exposed in dwr.xml. These files do not exist physically but are dynamically generated and served by DWR servlet.&lt;br /&gt;&lt;pre class="xml" name="code"&gt;&lt;br /&gt;&amp;lt;script type='text/javascript' src='dwr/engine.js'&amp;gt; &amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script type='text/javascript' src='dwr/util.js'&amp;gt; &amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script type='text/javascript' src='dwr/interface/forms.js'&amp;gt; &amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now you can call any method of form PersonForm class. PersonForm class has method called generateAntiSpamMailto. You can directly call this method using javascript. See following example. Following example basically dynamically calls “generateAntiSpamMailto” method on server to get anti-spam text and puts in to the div and makes the div visible. This is done by defining function as the third argument. First two arguments are regular arguments which are same as java arguments.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&lt;br /&gt;function process() {&lt;br /&gt;  var address = dwr.util.getValue("address");&lt;br /&gt;  var name = dwr.util.getValue("name");&lt;br /&gt;  alert('Addres is ' + address);&lt;br /&gt;  alert('Name is ' + name);&lt;br /&gt;  &lt;br /&gt;  forms.generateAntiSpamMailto(name, address, function(contents) {&lt;br /&gt;    alert('content is ' + contents);&lt;br /&gt;    dwr.util.setValue("outputFull", contents, { escapeHtml:false });&lt;br /&gt;    dwr.util.byId("output").style.display = "block";&lt;br /&gt;  });&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;and HTML part as&lt;br /&gt;&lt;pre class="html" name="code"&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;input id="submit" type="button" value="Submit Query" onclick="process()"/&amp;gt;&lt;br /&gt;&amp;lt;html:submit&amp;gt;Submit Query&amp;lt;/html:submit&amp;gt;&lt;br /&gt;&amp;lt;/html:form&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;div id="output" style="display:none;"&amp;gt;&lt;br /&gt;  &amp;lt;h2&amp;gt;Generated Links&amp;lt;/h2&amp;gt;&lt;br /&gt;  &amp;lt;textarea id="outputFull" rows="9" cols="70"&amp;gt;&lt;br /&gt;  &amp;lt;/textarea&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;You can even use DWR to validate certain field on the spot when user finishes typing the data. Validation will be done on the server but called asynchronously via AJAX. Following is an example which makes use of Apache Commons Validator framework to validate an email address. This require certain jars to added to lib(BSF, BSH,Commons jars included in the zip file attached).&lt;br /&gt;&lt;br /&gt;DWR xml&lt;br /&gt;&lt;pre class="xml" name="code"&gt;&lt;br /&gt;&amp;lt;create creator="script" javascript="EmailValidator" scope="application"&amp;gt;&lt;br /&gt;&amp;lt;param name="language" value="beanshell"/&amp;gt;&lt;br /&gt;&amp;lt;param name="script"&amp;gt;&lt;br /&gt;import org.apache.commons.validator.EmailValidator;&lt;br /&gt;return EmailValidator.getInstance();&lt;br /&gt;&amp;lt;/param&amp;gt;&lt;br /&gt;&amp;lt;/create&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;and HTML /JavaScript part&lt;br /&gt;&lt;pre class="html" name="code"&gt;&lt;br /&gt;&amp;lt;script&amp;gt; &lt;br /&gt;function verifyAddress() {&lt;br /&gt;  var address = dwr.util.getValue("address");&lt;br /&gt;  EmailValidator.isValid(address, function(valid) {&lt;br /&gt;    dwr.util.setValue("addressError", valid ? "" : "Please enter a valid email address");&lt;br /&gt;  });&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;html:text property="name" size="16" onkeypress="dwr.util.onReturn(event, process)" onblur="verifyAddress()"/&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4556017295143623721-3497532449376555751?l=tusharkhairnar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tusharkhairnar.blogspot.com/feeds/3497532449376555751/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4556017295143623721&amp;postID=3497532449376555751' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/3497532449376555751'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4556017295143623721/posts/default/3497532449376555751'/><link rel='alternate' type='text/html' href='http://tusharkhairnar.blogspot.com/2008/05/how-to-integrate-dwr-and-struts.html' title='How to integrate DWR and Struts'/><author><name>Tushar Khairnar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry></feed>
