<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Thinking Outloud &#187; java</title>
	<atom:link href="http://thebull.macsimumweb.com/category/java/feed" rel="self" type="application/rss+xml" />
	<link>http://thebull.macsimumweb.com</link>
	<description>Thoughts on poker, programming and other stuff.</description>
	<lastBuildDate>Fri, 13 Nov 2009 17:51:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Will Google App Engine Revolutionize Java Development?</title>
		<link>http://thebull.macsimumweb.com/will-google-app-engine-revolutionize-java-development</link>
		<comments>http://thebull.macsimumweb.com/will-google-app-engine-revolutionize-java-development#comments</comments>
		<pubDate>Fri, 10 Apr 2009 01:16:31 +0000</pubDate>
		<dc:creator>The Bull</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[google app engine]]></category>
		<category><![CDATA[grails]]></category>

		<guid isPermaLink="false">http://thebull.macsimumweb.com/?p=331</guid>
		<description><![CDATA[There is a lot of buzz in the Java community concerning the announcement over the availability of Java on the Google App Engine. It is a big boon for Java developers for sure, but there are some drawbacks for serious applications.





Logging
Seems you are stuck with using the JDK logging. Let&#8217;s face it, no developer in [...]]]></description>
			<content:encoded><![CDATA[<p>There is a lot of buzz in the Java community concerning the announcement over the availability of Java on the Google App Engine. It is a big boon for Java developers for sure, but there are some drawbacks for serious applications.<br />
<div style="text-align:center">
<script type="text/javascript"><!--
google_ad_client = "pub-3450648811772145";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
google_ad_channel = "";
google_color_border = "3e4243";
google_color_bg = "ffffff";
google_color_link = "00800";
google_color_text = "717171";
google_color_url = "717171";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></p>
<h3>Logging</h3>
<p>Seems you are stuck with using the JDK logging. Let&#8217;s face it, no developer in his right mind chooses that over Log4j. There just isn&#8217;t enough functionality there to make it worthwhile (reporting anyone?).</p>
<h3>Persistence</h3>
<p>You are limited to JDO. This can be both good and bad. JDO and related technologies, are fine for many applications, but there are times when you just need more power than object queries allow.  The upside is that you probably don&#8217;t have to worry about data scaling needs.</p>
<h3>Threading</h3>
<p>You can&#8217;t create your own threads, nor presumably can anything else. This may be a big hindrance for many applications. For example I use the Quartz library all the time for various scheduling needs (especially in Grails).</p>
<p>There are a few other things you can and can&#8217;t do, but the ones above require some serious consideration before choosing to deploy on the app engine. On some brighter news, it looks like the Grails group is working on making Grails compatible with GAE. That alone will probably be the biggest use on GAE, and that isn&#8217;t a bad thing at all.</p>
]]></content:encoded>
			<wfw:commentRss>http://thebull.macsimumweb.com/will-google-app-engine-revolutionize-java-development/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Java is safe. For now&#8230;</title>
		<link>http://thebull.macsimumweb.com/java-is-safe-for-now</link>
		<comments>http://thebull.macsimumweb.com/java-is-safe-for-now#comments</comments>
		<pubDate>Mon, 06 Apr 2009 14:45:07 +0000</pubDate>
		<dc:creator>The Bull</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[ibm]]></category>
		<category><![CDATA[sun]]></category>

		<guid isPermaLink="false">http://thebull.macsimumweb.com/?p=329</guid>
		<description><![CDATA[IBM has pulled its offer to buy Sun according the NYT:
I.B.M. withdrew its $7 billion bid for Sun Microsystems on Sunday, one day after Sun’s board balked at a reduced offer, according to three people close to the talks.
The article goes on to say that other possible suitors could be HP and Cisco. I think [...]]]></description>
			<content:encoded><![CDATA[<p>IBM has pulled its offer to buy Sun according the <a href="http://www.nytimes.com/2009/04/06/technology/business-computing/06blue.html?_r=2&#038;ref=global-home">NYT</a>:</p>
<blockquote><p>I.B.M. withdrew its $7 billion bid for Sun Microsystems on Sunday, one day after Sun’s board balked at a reduced offer, according to three people close to the talks.</p></blockquote>
<p>The article goes on to say that other possible suitors could be HP and Cisco. I think with HP it would be similar to IBM in that HP would buy and dissolve the company with the possible exception of Java. As for Cisco, which is just entering the server business it would be a definite expansion of products all around.</p>
<p>Granted, Java has never really been a money maker for Sun but for IBM Sun&#8217;s Java software is a big competitor all the way from JVM to JEE servers. The other two companies don&#8217;t have a Java stack at all and would most likely leave the Java side alone, keeping out of Big Blue&#8217;s death.</p>
<p>Although IBM has pulled out, there is nothing from them getting back into it, and if Sun&#8217;s upcoming earnings report looks bad IBM may be the only one willing to buy them. Let&#8217;s hope for the best.</p>
]]></content:encoded>
			<wfw:commentRss>http://thebull.macsimumweb.com/java-is-safe-for-now/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Death of Java?</title>
		<link>http://thebull.macsimumweb.com/the-death-of-java</link>
		<comments>http://thebull.macsimumweb.com/the-death-of-java#comments</comments>
		<pubDate>Thu, 19 Mar 2009 15:42:42 +0000</pubDate>
		<dc:creator>The Bull</dc:creator>
				<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://thebull.macsimumweb.com/?p=327</guid>
		<description><![CDATA[With all the news about IBM potentially buying Java, I am saddened for my language of choice. From the purely Java side of things, nothing good can come from IBM owning Java, UNLESS they scrap their entire java-based product line in favor of what Sun has.
Let&#8217;s face it, not a single IBM java product is [...]]]></description>
			<content:encoded><![CDATA[<p>With all the news about IBM potentially buying Java, I am saddened for my language of choice. From the purely Java side of things, nothing good can come from IBM owning Java, UNLESS they scrap their entire java-based product line in favor of what Sun has.</p>
<p>Let&#8217;s face it, not a single IBM java product is really worth a shit. Their JVM is and always will be the slowest one around, their app server is second worst piece of software I have ever had the displeasure of using, is slow, sluggish and can only run on their JVM. </p>
<p>If Sun needs to be bought to be saved, so be it. But please, please IBM, don&#8217;t screw up Java by dumping Sun&#8217;s products for your own!</p>
]]></content:encoded>
			<wfw:commentRss>http://thebull.macsimumweb.com/the-death-of-java/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A few Grails tricks I picked up</title>
		<link>http://thebull.macsimumweb.com/a-few-grails-tricks-i-picked-up</link>
		<comments>http://thebull.macsimumweb.com/a-few-grails-tricks-i-picked-up#comments</comments>
		<pubDate>Tue, 30 Dec 2008 15:30:19 +0000</pubDate>
		<dc:creator>The Bull</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[jmx]]></category>

		<guid isPermaLink="false">http://thebull.macsimumweb.com/?p=276</guid>
		<description><![CDATA[



I&#8217;ve written yet another app on Grails called PatriotRoom.com. It took about six weeks of nights and weekends of work, but it turned out pretty nice. In a nutshell it is a blogging platform of sorts with a few extras and a few common items like recent comments, top commenters, related articles, tagging, etc.
JMX
After I [...]]]></description>
			<content:encoded><![CDATA[<p><div style="float:right;margin:5px">
<script type="text/javascript"><!--
google_ad_client = "pub-3450648811772145";
google_ad_width = 300;
google_ad_height = 250;
google_ad_format = "300x250_as";
google_ad_type = "text_image";
google_ad_channel = "";
google_color_border = "3e4243";
google_color_bg = "FFFFFF";
google_color_link = "00800";
google_color_text = "444444";
google_color_url = "777777";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>I&#8217;ve written yet another app on Grails called <a href="http://patriotroom.com">PatriotRoom.com</a>. It took about six weeks of nights and weekends of work, but it turned out pretty nice. In a nutshell it is a blogging platform of sorts with a few extras and a few common items like recent comments, top commenters, related articles, tagging, etc.</p>
<h3>JMX</h3>
<p>After I got it all running and the domain name switched over, I started to look for ways to tune it a little bit without going too overboard. Being a fan of JMX, my first step was to see what was available via the jconsole. It turns out there are all kinds of things from hibernate, but none of them are enabled by default.</p>
<p>I searched and couldn&#8217;t find anything on the Grails site about it, so it took quite a bit of digging to find it  and eventually I found it on the hibernate site. So in your DataSource.groovy file in the hibernate section, just add<br />
<blockquote>generate_statistics=true</p></blockquote>
<p> and you are good to go.</p>
<p>The nice thing about hibernate&#8217;s stats is they provide all kinds of good stuff, but I was mostly interested in the caching side of it.</p>
<h3>Caching</h3>
<p>After enabling the stats I could see that the cache hits were pretty damn small, as in non-existent. Hmm&#8230; I enabled caching using the <b>cache.use_second_level_cache=true</b> setting as advised in the Grails documentation. Nothing. </p>
<p>A few hours of searching later I found a post in Nabble that said the caching is only enabled by default for Domain.get() operations. Well that sucks! That should have been in the docs! For me those kinds of calls are extremely rare. Matter of fact, a good 99% of all my queries are of the <b>Domain.withCriteria</b> variety. Well, sprinkle in a <b>cacheable( true )</b> call in each of those withCriteria closures and presto I was getting cache hits stats.</p>
<p>What surprised me the most was the number of cache hits I was getting. The site averages about 3000 visitors a day at the moment, and in one 24 hour period I got over 2 million cache hits. That is a lot of saved DB traffic! As I write this, in 2 hours and 8 minutes since the last restart, there have been 1,013 visitors, with 396,917 2nd level cache hits with 86 misses and 55,050 query cache hits with 7,390 misses. That is phenomenal.</p>
<p>The majority of these hits are from articles and comments and thus can afford to be cached. However if the docs had been more clear on this I would have saved a ton of time. Oh well.</p>
<h3>User Stats</h3>
<p>The visitor stats I got by looking at the sessions from tomcat. That information is available via JMX as well and I covered it more in my <a href="http://thebull.macsimumweb.com/using-groovy-for-monitoring-via-jmx">Using Groovy to Monitoring via JMX</a> post.</p>
<h3>Don&#8217;t forget SQL</h3>
<p>While the api that grails provides via GORM is pretty nice and I do like it, let&#8217;s face it, sometimes SQL is just better for the task at hand. In my case I have a dashboard that shows various statics, like the cache stuff mentioned above, but it also does some basic report-type queries. </p>
<p>At first I attempted these by using criteria calls and manipulating the data as needed. It worked. It was horribly slow. One &#8220;query&#8221; took about 15 seconds on each call. Just not acceptable. Thankfully Groovy has a nice little SQL api built in and I took advantage of that. I wrote my sql, threw it into a <b>sql.eachRow</b> call and it executes in milliseconds now like it should. </p>
<p>I have about four of these queries, so it was a huge improvement. As for caching, it isn&#8217;t important in this case as there are only four people that have access to the dashboard, but speed was important.</p>
<p>Overall the site is running pretty smoothly in it&#8217;s first week and half of operation. A few little things here and there are expected of course and we have some plans or expansion. In future posts I&#8217;ll elaborate on more things I&#8217;ve picked up in working with Grails and Groovy in general.</p>
]]></content:encoded>
			<wfw:commentRss>http://thebull.macsimumweb.com/a-few-grails-tricks-i-picked-up/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
