<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Gamlor</title>
	
	<link>http://www.gamlor.info/wordpress</link>
	<description>thoughts about programming, tv-series and other geeky stuff.</description>
	<lastBuildDate>Tue, 19 Mar 2013 00:13:01 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/GamlorEnglishOnly" /><feedburner:info uri="gamlorenglishonly" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:browserFriendly></feedburner:browserFriendly><item>
		<title>Doctor Who, Series 7, First Half *Spoilers*</title>
		<link>http://www.gamlor.info/wordpress/2013/03/doctor-who-series-7-first-half-spoilers/</link>
		<comments>http://www.gamlor.info/wordpress/2013/03/doctor-who-series-7-first-half-spoilers/#comments</comments>
		<pubDate>Tue, 19 Mar 2013 00:09:46 +0000</pubDate>
		<dc:creator>gamlerhart</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Media Zap Oh Snap]]></category>
		<category><![CDATA[5-rating]]></category>
		<category><![CDATA[bbc]]></category>
		<category><![CDATA[doctor who]]></category>
		<category><![CDATA[sci-fi]]></category>
		<category><![CDATA[tv series]]></category>

		<guid isPermaLink="false">http://www.gamlor.info/wordpress/?p=3053</guid>
		<description><![CDATA[(한국어로 쓰는 글 있어요) Doctor Who is my favorite sci-fi series, as you might noticed by all the blog posts ^^. Series 7 has kind of two parts, one aired&#8230; ]]></description>
				<content:encoded><![CDATA[<p>(<a href="http://www.gamlor.info/wordpress/2013/03/dr-who-series-7-first-half-korean/">한국어로 쓰는 글 있어요</a>)<br />
Doctor Who is my favorite sci-fi series, as you might noticed by all the <a href="http://www.gamlor.info/wordpress/tag/doctor-who/">blog posts</a> ^^. Series 7 has kind of two parts, one aired last autumn, the other will be aired soon. So I&#8217;ll just talk about the first half.</p>
<div id="attachment_3055" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/drWhoSeason7EN.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/drWhoSeason7EN-300x219.png" alt="Our Doctor, always busy." width="300" height="219" class="size-medium wp-image-3055" /></a><p class="wp-caption-text">Our Doctor, always busy.</p></div>
<h2>Christmas 2011: The Doctor, the Widow and the Wardrobe</h2>
<p>Ohm, I saw this episode a long time ago, so my memory of it is not that great. I liked the teleporting box and the whole mystery. I usually don&#8217;t like the Christmas episodes, but this one was all right.</p>
<div id="attachment_3056" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/widowWardrobeEN.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/widowWardrobeEN-300x187.png" alt="Our Doctor just loves bow ties" width="300" height="187" class="size-medium wp-image-3056" /></a><p class="wp-caption-text">Our Doctor just loves bow ties</p></div>
<h2>Asylum of the Daleks (S07E01)</h2>
<p>The Daleks kidnap the Doctor, Amy and Rory and throw them to a prison plant. On that planet there are Daleks which went crazy, and a souffle backing woman. And somehow the souffles never turn out well. Why does she keep backing souffles? Why did the Daleks send the Doctor to the prison?</p>
<p>I love the craze Dalkes and woman in this episode. Is fun!</p>
<div id="attachment_3057" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/asylumDalekEN.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/asylumDalekEN-300x179.png" alt="The Daleks are also busy." width="300" height="179" class="size-medium wp-image-3057" /></a><p class="wp-caption-text">The Daleks are also busy.</p></div>
<h2>Dinosaurs on a Spaceship (S07E02)</h2>
<p>The Doctor goes to a Spaceship, which has lost it&#8217;s pilot. To our surprise there are Dinosaurs on the spaceship. And a bad guy.</p>
<p>I didn&#8217;t like the story, but Dinosaurs are always awesome!</p>
<div id="attachment_3058" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/dinosaursEN.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/dinosaursEN-300x203.png" alt="Dinosaurs, uuiiihh!" width="300" height="203" class="size-medium wp-image-3058" /></a><p class="wp-caption-text">Dinosaurs, uuiiihh!</p></div>
<h2>A Town Called Mercy (S07E03)</h2>
<p>UUUAAAH, a western episode, with a evil robot, a alien and gun wielding men. Why does the evil robot hates this small city? Why is there a alien in the city?</p>
<p>I love the western with sci-fi genre. The story itself is OK.</p>
<div id="attachment_3059" class="wp-caption aligncenter" style="width: 304px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/westernEN.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/westernEN-294x300.png" alt="The good, the bad and the ugly!" width="294" height="300" class="size-medium wp-image-3059" /></a><p class="wp-caption-text">The good, the bad and the ugly!</p></div>
<h2>The Power of Three(S07E04)</h2>
<p>Boring episode ㅠㅠ. The episode wants to become mysterious. Strange black cubes suddenly appear. The cubes don&#8217;t do anything. Therefore our team has to wait, and wait, and wait.</p>
<p>I already said that i found this episode to be boring.</p>
<div id="attachment_3060" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/blocksEN.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/blocksEN-300x149.png" alt="Many boxes!" width="300" height="149" class="size-medium wp-image-3060" /></a><p class="wp-caption-text">Many boxes!</p></div>
<h2>The Angels Take Manhattan(S07E05)</h2>
<p>In New York a private investigator receives a strange case. Angel statues which seem to move. However, no one sees them moving, yet they move. So, the detective goes into a hotel, where he meets a old himself. What is going on?</p>
<p>Ah, I like the Weeping Angels. And this episode. It has a lot of time traveling and Weeping Angels. It&#8217;s the best episode of series 7 so far.</p>
<div id="attachment_3061" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/angelsEN.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/angelsEN-300x159.png" alt="Weep, Weep, Weep" width="300" height="159" class="size-medium wp-image-3061" /></a><p class="wp-caption-text">Weep, Weep, Weep</p></div>
<h2>Christmas 2012:  The Snowmen(S07E06)</h2>
<p>Suddenly there are many snowmen and they are evil. Also the souffle making woman is here. Strange!</p>
<p>Hmm, I think the episode is OK.</p>
<div id="attachment_3062" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/snowmenEN.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/snowmenEN-300x162.png" alt="Love Snowmen" width="300" height="162" class="size-medium wp-image-3062" /></a><p class="wp-caption-text">Love Snowmen</p></div>
<h2>Conclusion</h2>
<p>So far I enjoyed series 7. I&#8217;m waiting for the new episodes. On March 30th the BBC will start airing the new episodes. Here are some trailers:</p>
<p><b>Series 7, First Half</b><br />
<iframe width="560" height="315" src="http://www.youtube.com/embed/qrEUBl2pacU" frameborder="0" allowfullscreen></iframe></p>
<p><b>Series 7, Second Half</b><br />
<iframe width="560" height="315" src="http://www.youtube.com/embed/FXqXZepqgMQ" frameborder="0" allowfullscreen></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gamlor.info/wordpress/2013/03/doctor-who-series-7-first-half-spoilers/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ADBCJ: Some Peformance Numbers</title>
		<link>http://www.gamlor.info/wordpress/2013/03/adbcj-some-peformance-numbers/</link>
		<comments>http://www.gamlor.info/wordpress/2013/03/adbcj-some-peformance-numbers/#comments</comments>
		<pubDate>Wed, 06 Mar 2013 20:41:07 +0000</pubDate>
		<dc:creator>gamlerhart</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[adbcj]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://www.gamlor.info/wordpress/?p=2941</guid>
		<description><![CDATA[This time we look at some performance numbers, comparing JDBC with ADBCJ (github, blog-posts). Particular the performance of small web applications, once implemented with JDBC, once with ADBCJ. Each application&#8230; ]]></description>
				<content:encoded><![CDATA[<p>This time we look at some performance numbers, comparing JDBC with ADBCJ (<a href="https://github.com/gamlerhart/adbcj">github</a>, <a href="http://www.gamlor.info/wordpress/tag/adbcj/">blog-posts</a>). Particular the performance of small web applications, once implemented with JDBC, once with ADBCJ. Each application is implemented with the <a href="http://www.playframework.com/">Play Framework</a>, which supports well asynchronous operations. I don&#8217;t want to go into all the gritty details. If you really want to read tons of details, go <a href="http://gamlor.info/files/Asynchronous-Database-Access-Worth-the-Pain-28-February-2013.pdf">ahead</a>. </p>
<p>The setup looked like this:</p>
<p>- Amazon EC2: Mysql Extra Large instance<br />
- Two Amazon EC2: M1 Large instance as web tiers. Running the Play Application.<br />
- Two Amazon EC2:M1  Medium instance as load tiers. Using <a href="http://grinder.sourceforge.net/">Grinder </a>to run scripts which use the web app.</p>
<p>We take a look at latency and throughput.<br />
<div id="attachment_2988" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/test-setup.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/test-setup-300x207.png" alt="Test Setup" width="300" height="207" class="size-medium wp-image-2988" /></a><p class="wp-caption-text">Test Setup</p></div></p>
<h2>Blog-App</h2>
<p>First let&#8217;s look a small blog app. The app serves posts, which have tags and authors. So the application gets the latest posts and fetches the tags for each post. Also it shows the most popular tags.<br />
<div id="attachment_2990" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/blog-post.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/blog-post-300x184.png" alt="A blog" width="300" height="184" class="size-medium wp-image-2990" /></a><p class="wp-caption-text">A blog</p></div><br />
We take a look at the latency, with a web tier which is far away from its max capacity (around 50% CPU utilization):</p>
<div id="attachment_2962" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/BlogLatencyWithoutOutliner.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/BlogLatencyWithoutOutliner-300x193.png" alt="Latency in Blog Application" width="300" height="193" class="size-medium wp-image-2962" /></a><p class="wp-caption-text">Latency in Blog Application</p></div>
<p>We can see that with ADBCJ requests are completed faster. For example with JDBC, it takes around 50ms on average to return the result; the ADBCJ version can do it in about 38ms.</p>
<p>Let’s also look at the throughput. In a small, focused test, where we access the index page in JSON format, ADBCJ performs way better. However, in a more realistic scenario, where we access different pages, the throughput of ADBCJ was about the same.</p>
<div id="attachment_2966" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/scaling-ADBCJvsJDBC1.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/scaling-ADBCJvsJDBC1-300x224.png" alt="Blog: Latency vs Throughput" width="300" height="224" class="size-medium wp-image-2966" /></a><p class="wp-caption-text">Blog: Latency vs Throughput</p></div>
<p>So you are now might tempted to use ADBCJ for a blog like application. Think again, a blog is fairly static application. So we can easily use caching to store the rendered pages. A good cache beats JDBCs and ADBCJs asses! Adding a cache boosts throughput and latency.</p>
<div id="attachment_2966" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/scaling-ADBCJvsJDBC1.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/scaling-ADBCJvsJDBC1-300x224.png" alt="Blog: Latency vs Throughput" width="300" height="224" class="size-medium wp-image-2966" /></a><p class="wp-caption-text">Blog: Latency vs Throughput</p></div>
<div id="attachment_2967" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/BlogLatencyWithoutOutliner1.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/BlogLatencyWithoutOutliner1-300x193.png" alt="Blog: Latency With Caching" width="300" height="193" class="size-medium wp-image-2967" /></a><p class="wp-caption-text">Blog: Latency With Caching</p></div>
<p><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/cache-rocks1.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/cache-rocks1-300x236.png" alt="Cache is King" width="300" height="236" class="aligncenter size-medium wp-image-2995" /></a></p>
<h2>User Content App</h2>
<p>Let&#8217;s look at a more dynamic application, a &#8220;Facebook&#8221; clone. The main page lists posts from the people a person follows. Each post has &#8216;likes&#8217; and comments. Also the site suggests users to follow. Furthermore it also contains messages, which user can send to each other.<br />
About 50% of the requests require complex read operations, the other 50% are simple writes, like inserting a new comment.</p>
<p>First, let&#8217;s look again at the latency. We can see that the complex read operation suddenly is three times faster. However, all writes requests are slowed down. This is maybe a tradeoff which you can make. Reading requests are the ones where users have to wait, while write requests can be done in the background via AJAX.</p>
<div id="attachment_2972" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/UserContentLatencyWIthoutOutliner.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/UserContentLatencyWIthoutOutliner-300x193.png" alt="Latency User Content App" width="300" height="193" class="size-medium wp-image-2972" /></a><p class="wp-caption-text">Latency User Content App</p></div>
<p>So, I wondered if there a fundamental issue with ADBCJ for writes, or if it&#8217;s an interaction effect. I ran test with separate read and write requests only. Then ADBCJ has always better latency. So, it seems to be an unfortunate interaction.</p>
<div id="attachment_2981" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/UserContentPostOnly.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/UserContentPostOnly-300x193.png" alt="Reads / Writes Only" width="300" height="193" class="size-medium wp-image-2981" /></a><p class="wp-caption-text">Reads / Writes Only</p></div>
<p>Finally, let&#8217;s take a throughput. ADBCJ does way better. Even more, when the system is under pressure, also ADBCJ’s latency for writes start to get better compared to JDBC.</p>
<div id="attachment_2985" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/Asynchronous-Database-Access2.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/Asynchronous-Database-Access2-300x213.png" alt="Throughput User Content" width="300" height="213" class="size-medium wp-image-2985" /></a><p class="wp-caption-text">Throughput User Content</p></div>
<div id="attachment_2986" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/LatencyUnderPressure.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/LatencyUnderPressure-300x193.png" alt="Latency under large Load" width="300" height="193" class="size-medium wp-image-2986" /></a><p class="wp-caption-text">Latency under large Load</p></div>
<h2>Stats Collection App</h2>
<p>The last application is a &#8216;stats collection app&#8217;, which collections information about the user’s actions. It is very write heavy, with only some rare, long running reads. Here JDBC and ADBCJ latency was about the same. However, the throughput of ADBCJ was much better.</p>
<div id="attachment_2998" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/stats-collecting.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/stats-collecting-300x204.png" alt="Stats Collecting" width="300" height="204" class="size-medium wp-image-2998" /></a><p class="wp-caption-text">Stats Collecting</p></div>
<div id="attachment_3010" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/ThroughputStats.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2013/03/ThroughputStats-300x212.png" alt="Stats App Throughput" width="300" height="212" class="size-medium wp-image-3010" /></a><p class="wp-caption-text">Stats App Throughput</p></div>
<h2>Conclusion</h2>
<p>So, ADBCJ can speed up your web applications. Of course, only the data serving parts. Keep in mind <a href="https://developers.google.com/speed/">caching, avoiding requests etc</a>). Of course you need to do your own experiment for your use case. Next time I&#8217;m going to explain why ADBCJ can support better latency and throughput, with code examples. Stay tuned!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gamlor.info/wordpress/2013/03/adbcj-some-peformance-numbers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ADBCJ in Scala: Getting Started</title>
		<link>http://www.gamlor.info/wordpress/2013/02/adbcj-in-scala-getting-started/</link>
		<comments>http://www.gamlor.info/wordpress/2013/02/adbcj-in-scala-getting-started/#comments</comments>
		<pubDate>Thu, 28 Feb 2013 21:59:53 +0000</pubDate>
		<dc:creator>gamlerhart</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[software-development]]></category>
		<category><![CDATA[adbcj]]></category>
		<category><![CDATA[concurrency]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[Scala]]></category>

		<guid isPermaLink="false">http://www.gamlor.info/wordpress/?p=2935</guid>
		<description><![CDATA[What, again asynchronous database access? Yes, because I&#8217;m currently knee deep in this stuff. (^^) This post series will show how to use ADBCJ in Scala 2.10, share a few&#8230; ]]></description>
				<content:encoded><![CDATA[<p>What, again asynchronous database access? Yes, because I&#8217;m currently knee deep in this stuff. (^^) This post series will show how to use ADBCJ in Scala 2.10, share a few tips, performance insights etc.</p>
<div id="attachment_2951" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2013/02/ScalaADBCJ.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2013/02/ScalaADBCJ-300x167.png" alt="ADBCJ and Scala, new buddies" width="300" height="167" class="size-medium wp-image-2951" /></a><p class="wp-caption-text">ADBCJ and Scala, new buddies</p></div>
<h2>Grabbing the Bits</h2>
<p>Of course, first we need to grab the bits. We can get it via SBT. Currently there are only snapshots available on my snapshot repository. We pull the Scala ADBCJ API, the ADBCJ connection pool and the MySQL driver.</p>
<script src="https://gist.github.com/5057658.js?file=build.sbt"></script><noscript><pre><code class="language-scala scala">name := &quot;Scala ADBCJ Demo&quot;

version := &quot;1.0&quot;

scalaVersion := &quot;2.10.0&quot;

libraryDependencies += &quot;info.gamlor.adbcj&quot; %% &quot;scala-adbcj&quot; % &quot;0.6-SNAPSHOT&quot;

libraryDependencies += &quot;org.adbcj&quot; % &quot;adbcj-connection-pool&quot; % &quot;0.6-SNAPSHOT&quot;

libraryDependencies += &quot;org.adbcj&quot; % &quot;mysql-async-driver&quot; % &quot;0.6-SNAPSHOT&quot;

resolvers += &quot;Gamlor-Repo&quot; at &quot;https://raw.github.com/gamlerhart/gamlor-mvn/master/snapshots&quot;</code></pre></noscript>
<h2>Getting Access to the Database</h2>
<p>The next step is to get access the the database. We do this with the Database object, by passing in the connection URL, username and password. This create a instance which is used to access this database. Usually you should have one instance only per database in your application.</p>
<script src="https://gist.github.com/5057658.js?file=DatabaseAcccess.scala"></script><noscript><pre><code class="language-scala scala">  // Note the &quot;pooled&quot; prefix, for using the connection pool
  val database: DatabaseAccess = Database(&quot;adbcj:pooled:mysql://localhost/adbcj-demo&quot;,
    &quot;adbcj&quot;,
    &quot;adbcj-pwd&quot;)</code></pre></noscript>
<p>Then we can create new connections. The most basic way is to create a connection directly. However, you are then responsible for closing the connection.</p>
<script src="https://gist.github.com/5057658.js?file=Connect.scala"></script><noscript><pre><code class="language-scala scala">// connect() will return a future, which contains the connection
// You need to close the connection yourself.
val simpleConnectionFuture = database.connect()

// We can use the Scala for construct to deal nicely with futures
val futureForWholeOperation = for {
 connection &lt;-simpleConnectionFuture
 closeDone &lt;- connection.close()
} yield &quot;Done&quot;
</code></pre></noscript>
<h2>Closing Connections Automatically</h2>
<p>Now closing the connection manually can be error prone and tedious. Therefore helper methods exists. One for using a connection and one for using a connection with a new transaction.<br />
The closure has to return a future. Since everything is asynchronously, we cannot close the connection when we leave the future. Instead we need to close it when everything is done. So, the connection will be close, when the future returned by the closure is completed.</p>
<script src="https://gist.github.com/5057658.js?file=UseHelpers.scala"></script><noscript><pre><code class="language-scala scala">val doneWithConnection:Future[DBResultList] = database.withConnection{
connection =&gt;
  // do something with the connection
  // you need to return a future, because everything is asynchrous
  // so the connection can only be closed when everything is done
  connection.executeQuery(&quot;SELECT 1&quot;)
}

val doneWithTransactionAndConnection:Future[DBResultList] = database.withTransaction{
connection =&gt;
  // Same goes for transactions
  connection.executeQuery(&quot;SELECT 1&quot;)
}</code></pre></noscript>
<h2>Some Real Work</h2>
<p>Let&#8217;s do some real work. We create the schema if it doesn&#8217;t exist and then insert a few items. In general, I highly recommend to read the <a href="http://doc.akka.io/docs/akka/2.1.1/scala/futures.html">Akka documentation about futures</a>, which gives an idea how to deal with tem.</p>
<script src="https://gist.github.com/5057658.js?file=Insert.scala"></script><noscript><pre><code class="language-scala scala">val txDoneFuture = database.withTransaction{
connection =&gt;
  // Same goes for transactions
  val schemaCreation = connection.executeQuery(&quot;&quot;&quot;CREATE TABLE IF NOT EXISTS posts(\n
  						id int NOT NULL AUTO_INCREMENT,\n
							title varchar(255) NOT NULL,\n
							ontent TEXT NOT NULL,\n
							PRIMARY KEY (id)\n
							) ENGINE = INNODB;&quot;&quot;&quot;)

  val firstPost =connection.executeUpdate(&quot;INSERT INTO posts(title,content) VALUES('The Title','TheContent')&quot;)
  val secondPost =connection.executeUpdate(&quot;INSERT INTO posts(title,content) VALUES('Second Title','More Content')&quot;)
  val thirdPost =connection.executeUpdate(&quot;INSERT INTO posts(title,content) VALUES('Third Title','Even More Content')&quot;)

  // we want to await for all operations at the end
  for {
  	schemaDone &lt;-schemaCreation
  	postOneDone &lt;-firstPost
  	postTwoDone &lt;-secondPost
  	postThreeDone &lt;-thirdPost
  } yield &quot;All Done&quot;

}</code></pre></noscript>
<h2>Query</h2>
<p>Let&#8217;s also query for some data. When running queries, your future will contain a immutable result set, which supports the standard collection operations.</p>
<script src="https://gist.github.com/5057658.js?file=Select.scala"></script><noscript><pre><code class="language-scala scala">    val postsDataFuture = database.withTransaction{
      connection =&gt;
        val postsFuture =connection.executeQuery(&quot;SELECT * FROM posts&quot;)

        postsFuture onSuccess {
          case rs:DBResultList =&gt; {
            for (row &lt;- rs){
              System.out.println(&quot;ID: &quot;+row(&quot;ID&quot;).getLong()+&quot; with title &quot;+row(&quot;title&quot;).getString());
            }
          }
        }

        postsFuture
    }</code></pre></noscript>
<h2>Prepared Statements</h2>
<p>Of course, there prepared statement support:</p>
<script src="https://gist.github.com/5057658.js?file=PreparedStmt.scala"></script><noscript><pre><code class="language-scala scala">val postsDataFuture= database.withTransaction{
  connection =&gt;
  val preparingStmt =connection.prepareQuery(&quot;SELECT * FROM posts WHERE title LIKE ?&quot;)

	val postsFuture = preparingStmt.flatMap(stmt=&gt;stmt.execute(&quot;Third Title&quot;))

	postsFuture onSuccess {
	  case rs:DBResultList =&gt; {
		for (row &lt;- rs){
		  System.out.println(&quot;ID: &quot;+row(&quot;ID&quot;).getLong()+&quot; with title &quot;+row(&quot;title&quot;).getString());
		}
	  }
	}

	postsFuture
}</code></pre></noscript>
<h2>One Last Hint, Debugging</h2>
<p>So, this was a small tour through the API. However I want to share one last important thing, which helps you dealing with failures.</p>
<p>Let&#8217;s assume you ran a back query:<br />
<script src="https://gist.github.com/5057658.js?file=NormalStackTrace"></script><noscript><pre><code class="language- ">org.adbcj.mysql.codec.MysqlException: 42S02Table 'adbcj-demo.thistabledoesnotexist' doesn't exis 
  at org.adbcj.mysql.codec.packets.ErrorResponse.toException(ErrorResponse.java:49)
	at org.adbcj.mysql.codec.decoding.ExpectQueryResult.handleError(ExpectQueryResult.java:31)
	at org.adbcj.mysql.codec.decoding.ResponseStart.parse(ResponseStart.java:33)
	at org.adbcj.mysql.codec.decoding.AcceptNextResponse.parse(AcceptNextResponse.java:26)
	at org.adbcj.mysql.codec.MySqlClientDecoder.doDecode(MySqlClientDecoder.java:96)
	at org.adbcj.mysql.codec.MySqlClientDecoder.decode(MySqlClientDecoder.java:67)
	at org.adbcj.mysql.netty.Decoder.decode(MysqlConnectionManager.java:177)
	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:113)
	...
</code></pre></noscript></p>
<p>Then you get a future which contain the error. However, the stack trace of the error does not contain any hint where in the code the query was issues. It just contains a stack trace with the internal event loop:</p>
<p>You can use the debug flat to get a stack trace which points at the location which sent the request. Either add -Dorg.adbcj.debug=true to the JVM flags. Or set the appropriate property when crating the database access. Note that this feature is quite expensive, so I recommend to use it while developing or during an investigation.</p>
<script src="https://gist.github.com/5057658.js?file=DebugStackTrace"></script><noscript><pre><code class="language- ">org.adbcj.DbException: 42S02Table 'adbcj-demo.thistabledoesnotexist' doesn't exis 
  at org.adbcj.support.stacktracing.StackTraceCapturing$CaputureByDefault.capture(StackTraceCapturing.java:20)
	at org.adbcj.support.stacktracing.StackTraceCapturing.defaultCapture(StackTraceCapturing.java:11)
	at org.adbcj.support.stacktracing.StackTracingOptions$1.captureStacktraceAtEntryPoint(StackTracingOptions.java:12)
	at org.adbcj.support.DefaultDbFuture.&lt;init&gt;(DefaultDbFuture.java:45)
	at org.adbcj.support.DefaultDbSessionFuture.&lt;init&gt;(DefaultDbSessionFuture.java:50)
	at org.adbcj.mysql.codec.MySqlRequests.executeQuery(MySqlRequests.java:28)
	at org.adbcj.mysql.codec.MySqlConnection.executeQuery(MySqlConnection.java:108)
	at org.adbcj.mysql.codec.MySqlConnection.executeQuery(MySqlConnection.java:102)
	at org.adbcj.connectionpool.PooledConnection.executeQuery(PooledConnection.java:78)
	at info.gamlor.db.DBConnection$$anonfun$executeQuery$1.apply(DBConnection.scala:109)
	at info.gamlor.db.DBConnection$$anonfun$executeQuery$1.apply(DBConnection.scala:109)
	at info.gamlor.db.FutureConversions$class.completeWithAkkaFuture(FutureConversions.scala:20)
	at info.gamlor.db.DBConnection.completeWithAkkaFuture(DBConnection.scala:31)
	at info.gamlor.db.DBConnection.executeQuery(DBConnection.scala:109)
---&gt;at info.gamlor.adbcj.scalademo.MainDemo$$anonfun$8.apply(MainDemo.scala:99)
    ... // RIGHT Location
Caused by: org.adbcj.mysql.codec.MysqlException: 42S02Table 'adbcj-demo.thistabledoesnotexist' doesn't exist 
	at org.adbcj.mysql.codec.packets.ErrorResponse.toException(ErrorResponse.java:49)
	at org.adbcj.mysql.codec.decoding.ExpectQueryResult.handleError(ExpectQueryResult.java:31)
	at org.adbcj.mysql.codec.decoding.ResponseStart.parse(ResponseStart.java:33)
	at org.adbcj.mysql.codec.decoding.AcceptNextResponse.parse(AcceptNextResponse.java:26)
	at org.adbcj.mysql.codec.MySqlClientDecoder.doDecode(MySqlClientDecoder.java:96)
	at org.adbcj.mysql.codec.MySqlClientDecoder.decode(MySqlClientDecoder.java:67)
	at org.adbcj.mysql.netty.Decoder.decode(MysqlConnectionManager.java:177)
	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:113)</code></pre></noscript>

<p>So, that&#8217;s it for now. Future posts will go into more aspects of ADBCJ the interaction with Scala.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gamlor.info/wordpress/2013/02/adbcj-in-scala-getting-started/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>State of Asynchronous Database Access for Java</title>
		<link>http://www.gamlor.info/wordpress/2012/12/state-of-asynchronous-database-access-for-java/</link>
		<comments>http://www.gamlor.info/wordpress/2012/12/state-of-asynchronous-database-access-for-java/#comments</comments>
		<pubDate>Mon, 24 Dec 2012 12:25:35 +0000</pubDate>
		<dc:creator>gamlerhart</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[Technical Wibbly Wobbly]]></category>
		<category><![CDATA[adbcj]]></category>
		<category><![CDATA[async]]></category>

		<guid isPermaLink="false">http://www.gamlor.info/wordpress/?p=2897</guid>
		<description><![CDATA[It has been a while since I wrote any serious technical stuff. Previously I&#8217;ve already written a bit about asynchronous database access. I&#8217;ve been continuing work on this, mainly on&#8230; ]]></description>
				<content:encoded><![CDATA[<p>It has been a while since I wrote any serious technical stuff. Previously I&#8217;ve already written a bit about <a href="http://www.gamlor.info/wordpress/2012/05/async-sql-and-akka/">asynchronous database</a> access.</p>
<p>I&#8217;ve been continuing work on this, mainly on the basics, the <a href="https://github.com/gamlerhart/adbcj">ADBCJ</a> driver implementation . Here&#8217;s a overview of the updates:</p>
<ul>
<li><a href="#connection-pool">Simple connection pool</a>: This helps to avoid the costs of creating connections. It also gives a nice control how many connections are used.</li>
<li><a href="#h2-support">H2-Support</a>: Implemented a driver for the <a href="http://www.h2database.com/html/main.html">H2</a> database</li>
<li><a href="#mysql-synchronisation">MySQL Driver Restructuring</a>: The driver has been massively simplified, mainly in term of synchronization. This makes it easier to debug and reason about it.</li>
<li>DBFuture implementation moved to CAS operations instead of locks: Less overhead, simplifies implementation and avoids potential dead locks</li>
<li>Dropped PostgreSQL driver for now: I never maintained that driver, so I dropped it for now. If someone has interrest in a PostgreSQL driver, talk to me.</li>
<li>Countless bugfixes</li>
</ul>
<div id="attachment_2923" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2012/12/h2-database.png"><img class="size-medium wp-image-2923" alt="H2? What? Ah, the database." src="http://www.gamlor.info/wordpress/wp-content/uploads/2012/12/h2-database-300x158.png" width="300" height="158" /></a><p class="wp-caption-text">H2? What? Ah, the database.</p></div>
<h2><a name="connection-pool"></a>Connection Pool</h2>
<p>In the JDBC world connection pools are the standard. And this has it&#8217;s reasons. Connection to a database needs some initial work. With a connection pool this overhead is avoided. Plus it gives you control how many connections are used. ADBCJ has now a connection-pool too.</p>
<p>First you need to add the pool implementation to your project:<br />
<script src="https://gist.github.com/4349067.js?file=build.sbt"></script><noscript><pre><code class="language-scala scala">libraryDependencies += &quot;org.adbcj&quot; % &quot;adbcj-connection-pool&quot; % &quot;0.5-SNAPSHOT&quot;</code></pre></noscript><br />
<script src="https://gist.github.com/4349067.js?file=pom.xml"></script><noscript><pre><code class="language-xml xml">&lt;dependency&gt;
	&lt;groupId&gt;org.adbcj&lt;/groupId&gt;
	&lt;artifactId&gt;adbcj-connection-pool&lt;/artifactId&gt;
	&lt;version&gt;0.5-SNAPSHOT&lt;/version&gt;
&lt;/dependency&gt;</code></pre></noscript></p>
<p>After that you add the prefix <em>pooled</em> to the connection string. This will load the ADBCJ connection pool. For examples:<br />
<script src="https://gist.github.com/4349067.js?file=ConnectionStrings.java"></script><noscript><pre><code class="language-java java">ConnectionManager plainMysql 
      = ConnectionManagerProvider.createConnectionManager(
            &quot;adbcj:mysql://localhost/adbcjtck&quot;, &quot;root&quot;, &quot;&quot;);

ConnectionManager pooledMysql 
      = ConnectionManagerProvider.createConnectionManager(
            &quot;adbcj:pooled:mysql://localhost/adbcjtck&quot;, &quot;root&quot;, &quot;&quot;);</code></pre></noscript></p>
<p>The connection pool can be configured by providing properties for it. Here are the supported properties with the defaults:<br />
<script src="https://gist.github.com/4349067.js?file=ConfigProperties.java"></script><noscript><pre><code class="language-java java">Map&lt;String,String&gt; poolConfig = new HashMap&lt;String, String&gt;();
poolConfig.put(&quot;pool.maxConnections&quot;,&quot;50&quot;);
poolConfig.put(&quot;pool.maxWaitForConnection&quot;,&quot;500&quot;);

ConnectionManager pooledMysql
  	= ConnectionManagerProvider.createConnectionManager(
  		&quot;adbcj:pooled:mysql://localhost/adbcjtck&quot;,
		&quot;root&quot;,
		&quot;&quot;,
		poolConfig);</code></pre></noscript></p>
<h2><a name="h2-support"></a>H2-Support</h2>
<p>I really like the H2 database. It&#8217;s simply to handle, embed, run and operate. I often use it for smaller projects, testing, default embedded database and so on. So no wonder, I&#8217;ve added support for it. You can add it via Maven/sbt.</p>
<p>First you need to add the driver to your project:<br />
<script src="https://gist.github.com/4349067.js?file=buildH2.sbt"></script><noscript><pre><code class="language-scala scala">libraryDependencies += &quot;org.adbcj&quot; % &quot;h2-async-driver&quot; % &quot;0.5-SNAPSHOT&quot;</code></pre></noscript><br />
<script src="https://gist.github.com/4349067.js?file=pomH2.xml"></script><noscript><pre><code class="language-xml xml">&lt;dependency&gt;
  &lt;groupId&gt;org.adbcj&lt;/groupId&gt;
	&lt;artifactId&gt;h2-async-driver&lt;/artifactId&gt;
	&lt;version&gt;0.5-SNAPSHOT&lt;/version&gt;
&lt;/dependency&gt;</code></pre></noscript></p>
<p>And then you can use the driver:<br />
<script src="https://gist.github.com/4349067.js?file=H2.java"></script><noscript><pre><code class="language-java java">// Plain connection
ConnectionManager h2 
       = ConnectionManagerProvider.createConnectionManager(
       	  &quot;adbcj:h2://localhost:14242/adbcjtck;MVCC=TRUE&quot;,
  	  &quot;sa&quot;,
	  &quot;sa&quot;);

// With connection pool, recommended
ConnectionManager h2Pooled 
       = ConnectionManagerProvider.createConnectionManager(
       	   &quot;adbcj:pooled:h2://localhost:14242/adbcjtck;MVCC=TRUE&quot;,
	   &quot;sa&quot;,
	   &quot;sa&quot;);</code></pre></noscript></p>
<h2><a name="mysql-synchronisation"></a>Restructuring Synchronization of MySQL driver</h2>
<p>The synchronization of the requests and running operations in the MySQL driver was quite complex. This caused a lot of head aches fixing race conditions and finding errors. I&#8217;ve rewritten the internal synchronization of the MySQL driver to be simpler and more understandable.<br />
Another side effect is, that the driver now pipelines request much more aggressively. This should improve performance in some scenario drastically. The cost of this is that most requests cannot be cancelled anymore for now.</p>
<h2>Source, etc.</h2>
<p>The source is still on GitHub (<a href="https://github.com/gamlerhart/adbcj">https://github.com/gamlerhart/adbcj</a>). Also remember that I&#8217;ve a improved <a href="http://www.gamlor.info/wordpress/2012/05/async-sql-and-akka/">Scala-API here</a>.</p>
<p>The stuff is on my Maven-Repo:<br />
<a href="https://github.com/gamlerhart/gamlor-mvn/raw/master/snapshots">https://github.com/gamlerhart/gamlor-mvn/raw/master/snapshots</a></p>
<p>Group-ID and Version for all ADBCJ projects:<br />
<code>GroupID: org.adbcj<br />
Version: 0.5.0-SNAPSHOT</code></p>
<p>API:<br />
<code>ArtifactID: adbcj-api</code></p>
<p>Mysql:<br />
<code>ArtifactID: mysql-async-driver</code></p>
<p>H2:<br />
<code>ArtifactID: h2-async-driver</code></p>
<p>Connection-Pool:<br />
<code>ArtifactID: adbcj-connection-pool</code></p>
<p>That&#8217;s it for now =)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gamlor.info/wordpress/2012/12/state-of-asynchronous-database-access-for-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Guava Collection Test Suite</title>
		<link>http://www.gamlor.info/wordpress/2012/09/google-guava-collection-test-suite/</link>
		<comments>http://www.gamlor.info/wordpress/2012/09/google-guava-collection-test-suite/#comments</comments>
		<pubDate>Tue, 25 Sep 2012 21:31:33 +0000</pubDate>
		<dc:creator>gamlerhart</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[guava]]></category>
		<category><![CDATA[test]]></category>

		<guid isPermaLink="false">http://www.gamlor.info/wordpress/?p=2845</guid>
		<description><![CDATA[Did you even implement your own collections for some reason? Collections which implement the Java collection interfaces? Did you ever wonder if there is test suite for collections, which tests&#8230; ]]></description>
				<content:encoded><![CDATA[<p>Did you even implement your own collections for some reason? Collections which implement the Java collection interfaces? Did you ever wonder if there is test suite for collections, which tests the specified collection-interface behavior? When your answer is yes to these questions then you should check out the Google Guava Testlib.</p>
<div id="attachment_2880" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2012/09/testing-things.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2012/09/testing-things-300x255.png" alt="Testing Collections, Ahoi" title="testing-things" width="300" height="255" class="size-medium wp-image-2880" /></a><p class="wp-caption-text">Testing Collections, Ahoi</p></div>
<p>The Google Guava Testlib brings a whole test suite which tests the behavior of Set, List and Map implementations. You can specify which features your collections support and then profit from the hundreds of tests Google has written for you.</p>
<h2>Getting Started</h2>
<p>First we need to get the library. The easiest way to get it is with Maven:<br />
<script src="https://gist.github.com/3571743.js?file=grab-with-maven.xml"></script><noscript><pre><code class="language-xml xml">&lt;dependency&gt;
	&lt;groupId&gt;com.google.guava&lt;/groupId&gt;
	&lt;artifactId&gt;guava-testlib&lt;/artifactId&gt;
	&lt;version&gt;13.0&lt;/version&gt;
	&lt;scope&gt;test&lt;/scope&gt;
&lt;/dependency&gt;</code></pre></noscript></p>
<p>After that we can start to write a test suite. There are test-suite builders for this purpose, the most important ones are ListTestSuiteBuilder, SetTestSuiteBuilder and MapTestSuiteBuilder. These builder allow you to create a test-suite according to your needs.<br />
First you specify the collection to be used and the test data with the using-method. Afterwards you can specify what features are implemented by your collection. Here&#8217;s an example:</p>
<script src="https://gist.github.com/3571743.js?file=MyListTest.java"></script><noscript><pre><code class="language-java java">private Test myListTestSuite() {
	return ListTestSuiteBuilder.using(
		// This class is responsible for creating the collection
		// And providing data, which can be put into the collection
		// Here we use a abstract generator which will create strings
		// which will be put into the collection
		new TestStringListGenerator(){
			@Override
			protected List&lt;String&gt; create(String[] elements) {
				// Fill here your collection with the given elements
				return new MyListImplementation&lt;String&gt;(elements);
			}
		})
		// The name of the test suite
		.named(&quot;My List Tests&quot;)
		// Here we give a hit what features our collection supports
		.withFeatures(ListFeature.GENERAL_PURPOSE,
						CollectionFeature.ALLOWS_NULL_VALUES,
						CollectionFeature.SERIALIZABLE,
						CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
						CollectionSize.ANY)
		.createTestSuite();
}</code></pre></noscript>
<p>Take a good look into the available constants in CollectionFeature, ListFeature and MapFeature for the features sets to test.<br />
Anyway, BAAAMM! Now I&#8217;ve already a huge suite of test running, which cover a lot of dirty details. For example my implementation seems to have issues with the equals method of the returned sub-lists:</p>
<div id="attachment_2871" class="wp-caption aligncenter" style="width: 646px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2012/09/oh-collection-failures.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2012/09/oh-collection-failures.png" alt="Oh Oh" title="oh-collection-failures" width="636" height="553" class="size-full wp-image-2871" /></a><p class="wp-caption-text">Oh Oh</p></div>
<h2>Setup/Tear-Down, Suppressing Tests</h2>
<p>Now the actual tests do run in already written test classes. So what if your collection needs some setup- / tear down code? For example I use the test-suite to test collections which are backed up by a database. That means I need a setup- / tear down phase.<br />
This can be done by providing a runnable for the setup and tear down:</p>
<script src="https://gist.github.com/3571743.js?file=SetupTeardown.java"></script><noscript><pre><code class="language-java java">return ListTestSuiteBuilder
	.using(new TestStringListGenerator(){
		@Override
		protected List&lt;String&gt; create(String[] elements) {
			return new MyListImplementation&lt;String&gt;(elements);
		}
	})
	.named(&quot;My List Tests&quot;)
	.withFeatures(ListFeature.GENERAL_PURPOSE,
					CollectionFeature.ALLOWS_NULL_VALUES,
					CollectionFeature.SERIALIZABLE,
					CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
					CollectionSize.ANY)
	.withSetUp(new Runnable() {
		@Override
		public void run() {
			// some setup
		}
	})
	.withTearDown(new Runnable() {
		@Override
		public void run() {
			// some setup
		}
	})
	.createTestSuite();
</code></pre></noscript>
<p>You also can suppress very specific methods of the test suite. This is done by giving the methods which should be suppressed:</p>
<script src="https://gist.github.com/3571743.js?file=SuppressTest.java"></script><noscript><pre><code class="language-java java">// previous calls
.suppressing(Arrays.asList(suppressMethod(ListSubListTester.class, &quot;testSubList_entireList&quot;)))
.createTestSuite();


private Method suppressMethod(Class testClass,
		String methodName) {
	try {
		return testClass.getMethod(methodName, new Class[0]);
	} catch (NoSuchMethodException e) {
		throw new AssertionError(&quot;Could not find method to suppress &quot;, e);
	}
}</code></pre></noscript>
<h2>Your Own TestData</h2>
<p>Perhaps your collection implementation can only hold very specialized elements. In that case you might need to generate the test-items yourself, which are added to the list. Instead of using the Google test data provider, you can use your own. Here&#8217;s an example, which tests the collection with a custom type:</p>
<script src="https://gist.github.com/3571743.js?file=SpecializedCollections.java"></script><noscript><pre><code class="language-java java">
// Pass your test data provider to the using method
ListTestSuiteBuilder.using(new MyTestDataGenerator())
	. // continue as normal
	
	
/**
 * Own implementation of a test data generator.
 * First look if an existing one fits your needs
 */
class MyTestDataGenerator implements TestListGenerator&lt;MySpecialItem&gt; {

    @Override
    public SampleElements&lt;MySpecialItem&gt; samples() {
        return new SampleElements&lt;MySpecialItem&gt;(
                new MySpecialItem(&quot;1&quot;),
                new MySpecialItem(&quot;2&quot;),
                new MySpecialItem(&quot;3&quot;),
                new MySpecialItem(&quot;4&quot;),
                new MySpecialItem(&quot;5&quot;)

        );
    }

    @Override
    public List&lt;MySpecialItem&gt; create(Object... elementsAsObjects) {
        // Put the elements in the given array
        // into the collection.
        MySpecialItem[] castedElements = new MySpecialItem[elementsAsObjects.length];
        int i = 0;
        for (Object elementAsObject : elementsAsObjects) {
            castedElements[i++] = (MySpecialItem) elementAsObject;
        }
        return new MyListImplementation&lt;MySpecialItem&gt;((MySpecialItem[])castedElements);
    }

    @Override
    public MySpecialItem[] createArray(int length) {
        // Just create an array of the element type with the given length
        return new MySpecialItem[length];
    }

    @Override
    public Iterable&lt;MySpecialItem&gt; order(List&lt;MySpecialItem&gt; insertionOrder) {
        // In case your collection reorders elements,
        // Then you should return the original order here
        return insertionOrder;
    }
}

// Let's assume our collection only can handle specialized items
class MySpecialItem implements Serializable{
    private final String data;

    MySpecialItem(String data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return &quot;MySpecialItem{&quot; +
                &quot;data='&quot; + data + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        MySpecialItem that = (MySpecialItem) o;

        if (data != null ? !data.equals(that.data) : that.data != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        return data != null ? data.hashCode() : 0;
    }
}

	
	</code></pre></noscript>
<h2>Other Types</h2>
<p>Above I&#8217;ve shown examples for a List implementation. For Sets and Maps it works more or less exactly the same way. Instead of <strong>List</strong>SomeThingSomething the classes are called <strong>Set</strong>SomethingSomething or <strong>Map</strong>SomethingSomething. Otherwise the same principals apply.</p>
<h2>Conclusion</h2>
<p>If you ever implement your own Java collections, take a look at the Guava Test lib. It saves you a ton of work!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gamlor.info/wordpress/2012/09/google-guava-collection-test-suite/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How J2EE (still) feels to me</title>
		<link>http://www.gamlor.info/wordpress/2012/09/how-j2ee-still-feels-to-me/</link>
		<comments>http://www.gamlor.info/wordpress/2012/09/how-j2ee-still-feels-to-me/#comments</comments>
		<pubDate>Thu, 06 Sep 2012 21:25:51 +0000</pubDate>
		<dc:creator>gamlerhart</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[J2EE]]></category>

		<guid isPermaLink="false">http://www.gamlor.info/wordpress/?p=2858</guid>
		<description><![CDATA[It feels like this: &#160; I just recently started to look into some J2EE stuff. Still feels super scary. Don&#8217;t want to say much more about it. Yes,  J2EE got&#8230; ]]></description>
				<content:encoded><![CDATA[<p>It feels like this:<a href="http://www.gamlor.info/wordpress/wp-content/uploads/2012/09/j2ee.png"><img class="aligncenter size-full wp-image-2860" title="How J2EE feels to me" src="http://www.gamlor.info/wordpress/wp-content/uploads/2012/09/j2ee.png" alt="How J2EE feels to me" width="790" height="1000" /></a></p>
<p>&nbsp;</p>
<p>I just recently started to look into some J2EE stuff. Still feels super scary. Don&#8217;t want to say much more about it. Yes,  J2EE got a lot better, but is still a giant monster. And don&#8217;t worry, there are tons of other monsters out there which are as scary as J2EE.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gamlor.info/wordpress/2012/09/how-j2ee-still-feels-to-me/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Series Ratings: Psych, It’s Always Sunny in Philadelphia, Secret Garden, Korean Peninsula…etc.</title>
		<link>http://www.gamlor.info/wordpress/2012/06/series-ratings-psych-its-always-sunny-in-philadelphia-the-korean-peninsula-etc/</link>
		<comments>http://www.gamlor.info/wordpress/2012/06/series-ratings-psych-its-always-sunny-in-philadelphia-the-korean-peninsula-etc/#comments</comments>
		<pubDate>Sat, 30 Jun 2012 21:29:12 +0000</pubDate>
		<dc:creator>gamlerhart</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Media Zap Oh Snap]]></category>
		<category><![CDATA[4.5-rating]]></category>
		<category><![CDATA[Always Sunny in Philadelphia]]></category>
		<category><![CDATA[Dream High]]></category>
		<category><![CDATA[Mad Man]]></category>
		<category><![CDATA[Mary Stayed out All Night]]></category>
		<category><![CDATA[misfits]]></category>
		<category><![CDATA[Office Girls]]></category>
		<category><![CDATA[Peninsula]]></category>
		<category><![CDATA[Pretty Little Liars]]></category>
		<category><![CDATA[Psych]]></category>
		<category><![CDATA[Secret Garden]]></category>
		<category><![CDATA[special life investigation team]]></category>
		<category><![CDATA[tv series]]></category>
		<category><![CDATA[when it is at night]]></category>

		<guid isPermaLink="false">http://www.gamlor.info/wordpress/?p=2805</guid>
		<description><![CDATA[(이 블로그 글이 한국어로 또 있어요). In this blog I usually only write about TV series which I really like. However in this post I tell a few words about&#8230; ]]></description>
				<content:encoded><![CDATA[<p>(이 <a href="http://www.gamlor.info/wordpress/2012/06/bunch-of-tv-series-kr/">블로그 글이 한국어로</a> 또 있어요).<br />
In this blog I usually only write about TV series which I really like. However in this post I tell a few words about many different series, good ones, average ones, terrible ones.</p>
<h2>Misfits 3 (<a href="http://en.wikipedia.org/wiki/Misfits_(TV_series)">Wikipedia</a>, <a href="http://www.youtube.com/watch?v=K7i-QPlQRfI">Trailer</a>)</h2>
<p>I&#8217;ve already covered Misfits <a href="http://www.gamlor.info/wordpress/2009/12/misfits/">here.</a> And Misfits it still damn good, I really can recommend it. The third season is maybe even the best one. I especially love the Zombie episode. If you like fantasy series, and haven&#8217;t tried Misfits yet, give it a watch.</p>
<p>Star-O-Meter: (4.5/5) (Yes, I even slightly increased it).<div id="attachment_2808" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/misfits-3-en.jpg"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/misfits-3-en-300x196.jpg" alt="Zombies! Run!" title="misfits-3-en" width="300" height="196" class="size-medium wp-image-2808" /></a><p class="wp-caption-text">Zombies! Run!</p></div></p>
<h2>It&#8217;s Always Sunny in Philadelphia (<a href="http://en.wikipedia.org/wiki/Always_Sunny_in_Philadelphia">Wikipedia</a>, <a href="http://www.youtube.com/watch?v=XgAKMICbha0">Trailer</a>)</h2>
<p>May people really like this sitcom. Therefore I&#8217;ve watched one season. However I didn&#8217;t really like it. Usually I enjoy black comedy. This series is for me just average, but not great. So I stopped watching after the first season.</p>
<p>Star-O-Meter: (2.5/5)<br />
<div id="attachment_2810" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/always-sunny-en.jpg"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/always-sunny-en-300x210.jpg" alt="You don&#039;t wanna go to this bar." title="always-sunny-en" width="300" height="210" class="size-medium wp-image-2810" /></a><p class="wp-caption-text">You don&#8217;t wanna go to this bar.</p></div></p>
<h2>Psych (<a href="http://en.wikipedia.org/wiki/Psych">Wikipedia</a>, <a href="http://www.youtube.com/watch?v=FiT4Q456pTQ">Trailer</a>)</h2>
<p>In this series a guy who can remember anything pretends to be a psychic. With his abilities he help the police solving difficult cases. Psych is a humor-full detective series, which I quite like. When it&#8217;s boring this series is nice to kill a hour or two.</p>
<p>Star-O-Meter: (3/5)<br />
<div id="attachment_2812" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/psych-en.jpg"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/psych-en-300x184.jpg" alt="There are no ghosts, but big lies" title="psych-en" width="300" height="184" class="size-medium wp-image-2812" /></a><p class="wp-caption-text">There are no ghosts, but big lies</p></div></p>
<h2>Pretty Little Liars (<a href="http://en.wikipedia.org/wiki/Pretty_Little_Liars_%28TV_series%29">Wikipedia</a>, <a href="http://www.youtube.com/watch?v=LfuMhXcLa-Q">Trailer</a>)</h2>
<p>After a young woman dies, her 4 friends receive strange texts on their phones from a unknown person. These message contain secrets and lies of them. Who sends those messages? Who does he or she know all secrets? The plot sounds interesting, but the series isn&#8217;t. I found it rather boring.</p>
<p>Star-O-Meter: (2/5)<br />
<div id="attachment_2813" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/pretty-little-liars-en.jpg"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/pretty-little-liars-en-300x204.jpg" alt="Hello. Hello? Hello??!!??" title="pretty-little-liars-en" width="300" height="204" class="size-medium wp-image-2813" /></a><p class="wp-caption-text">Hello. Hello? Hello??!!??</p></div></p>
<h2>Mad Man (<a href="http://en.wikipedia.org/wiki/Mad_Men">Wikipedia</a>, <a href="http://www.youtube.com/watch?v=LfuMhXcLa-Q">Trailer</a>)</h2>
<p>Mad Man is boring. Don&#8217;t know why people like it.</p>
<p>Star-O-Meter: (1.5/5) <div id="attachment_2815" class="wp-caption aligncenter" style="width: 267px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/mad-men-en.jpg"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/mad-men-en-257x300.jpg" alt="In Mad Man people really don&#039;t work" title="mad-men-en" width="257" height="300" class="size-medium wp-image-2815" /></a><p class="wp-caption-text">In Mad Man people really don&#8217;t work</p></div></p>
<h2>Life Special Investigation Team (<a href="http://wiki.d-addicts.com/Life_Special_Investigation_Team">DramaWiki</a>)</h2>
<p>Life Special Investigation Team is another of these countless crime stories series. This time about insurance fraud. It&#8217;s alright. However it has really strange poop/fart &#8216;jokes&#8217; in there. The aren&#8217;t even jokes, just strange scenes.<br />
Star-O-Meter: (2.5/5)<br />
<div id="attachment_2819" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/life-special-en.jpg"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/life-special-en-300x252.jpg" alt="People go crazy because of insurance money" title="life-special-en" width="300" height="252" class="size-medium wp-image-2819" /></a><p class="wp-caption-text">People go crazy because of insurance money</p></div></p>
<h2>Dream High 1 and 2 (<a href="http://en.wikipedia.org/wiki/Dream_High">Wikipedia</a>, <a href="http://www.youtube.com/watch?v=Dh8t8tdwAiA">Trailer</a>)</h2>
<p>I really like <a href="http://www.gamlor.info/wordpress/2010/04/glee/">Glee </a>. Dream High is a series about music, so I expected something like Glee. However Glee is way better than Dream High. The first season is alright, but not great. The second season is the worse than the first one. </p>
<p>Star-O-Meter: (2.0/5)<br />
<div id="attachment_2821" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/dreamhigh-en.jpg"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/dreamhigh-en-300x181.jpg" alt="Dreaming" title="dreamhigh-en" width="300" height="181" class="size-medium wp-image-2821" /></a><p class="wp-caption-text">Dreaming</p></div></p>
<h2>When It&#8217;s At Night (<a href="http://wiki.d-addicts.com/When_It's_At_Night">DramaWiki</a>)</h2>
<p>In this series Heo Cho Hwi searches for old national treasures to then put them in museum. I really like the first episode, which is quite awesome. However after the first episode it gets more and more boring.</p>
<p>Star-O-Meter: (1.5/5) (However, for the first episode 3.5/5)<br />
<div id="attachment_2823" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/when-it-at-night-en.jpg"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/when-it-at-night-en-300x210.jpg" alt="Catch the thief!" title="when-it-at-night-en" width="300" height="210" class="size-medium wp-image-2823" /></a><p class="wp-caption-text">Catch the thief!</p></div></p>
<h2>Mary stayed out all Night (<a href="http://en.wikipedia.org/wiki/Mary_Stayed_Out_All_Night">Wikipedia</a>)</h2>
<p>I first though this drama revolves around some kind of marriage frauds. However it&#8217;s about an arranged marriage and love and so I lost interest. And the lead actress looks like a 14 old girl and not like the 20-25ish she&#8217;s supposed to be. Totally miss casted for this role. </p>
<p>Star-O-Meter: (0.5/5)<br />
<div id="attachment_2824" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/marry-en.jpg"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/marry-en-300x206.jpg" alt="A fraud marriage is fun" title="marry-en" width="300" height="206" class="size-medium wp-image-2824" /></a><p class="wp-caption-text">A fraud marriage is fun</p></div></p>
<h2>Secret Garden (<a href="http://en.wikipedia.org/wiki/Secret_Garden_(TV_series)">Wikipedia</a>)</h2>
<p>o.O, WOW, this thing is horrible, horrible, horrible. I cannot believe how bad this thing is (In fact, I watched the whole thing, just to see if it stays that bad). The story is a mess, I hate every character in it, the story makes no sense. Only Ha Ji Won&#8217;s character is alright. I probably could rage an hour about how bad it is.</p>
<p>Star-O-Meter: (0.0/5)<div id="attachment_2825" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/secret-garden-en.jpg"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/secret-garden-en-300x197.jpg" alt="The secret garden is in the secret forest." title="secret-garden-en" width="300" height="197" class="size-medium wp-image-2825" /></a><p class="wp-caption-text">The secret garden is in the secret forest.</p></div></p>
<h2>Office Girls (<a href="http://en.wikipedia.org/wiki/Office_Girls">Wikipedia</a>)</h2>
<p>Office Girls is also bad. Especially the music is obnoxious, it always the some crappy song. And also the sound mix is horrible. The volume between voices, music and background is inconsistent and often ill balanced. Only the comic relief characters Liu Yu Le(劉禹樂) and Shi Ta Long(史特龍) are a little bit funny.</p>
<p>Star-O-Meter: (0.0/5)<div id="attachment_2828" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/office-girls-en.jpg"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/office-girls-en-300x176.jpg" alt="Yep, who want&#039;s to work?" title="office-girls-en" width="300" height="176" class="size-medium wp-image-2828" /></a><p class="wp-caption-text">Yep, who want&#8217;s to work?</p></div></p>
<h2>Korean Peninsula (<a href="http://en.wikipedia.org/wiki/Korean_Peninsula_(TV_series)">Wikipedia</a>, <a href="http://www.youtube.com/watch?v=obUqVYHNHcY">Trailer</a>)</h2>
<p>In this series North- and South Korea together try to research on a new fuel source. However this dangerous project suffers an terror attack and all people are having a hard time.<br />
I found this thing boring and stopped watching it quickly. (Maybe it get more interesting later on?)</p>
<p>Star-O-Meter: (1.5/5)<div id="attachment_2829" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/pensuela-en.jpg"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/pensuela-en-300x273.jpg" alt="Three, Two, One....BAAAAAAAAMMMMM!" title="pensuela-en" width="300" height="273" class="size-medium wp-image-2829" /></a><p class="wp-caption-text">Three, Two, One&#8230;.BAAAAAAAAMMMMM!</p></div></p>
<h2>Conclusion</h2>
<p>I watch to many TV series.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gamlor.info/wordpress/2012/06/series-ratings-psych-its-always-sunny-in-philadelphia-the-korean-peninsula-etc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Some Performance Numbers With Akka Async SQL</title>
		<link>http://www.gamlor.info/wordpress/2012/06/some-performance-numbers-with-akka-async-sql/</link>
		<comments>http://www.gamlor.info/wordpress/2012/06/some-performance-numbers-with-akka-async-sql/#comments</comments>
		<pubDate>Thu, 21 Jun 2012 21:11:45 +0000</pubDate>
		<dc:creator>gamlerhart</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[Technical Wibbly Wobbly]]></category>
		<category><![CDATA[akka]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[Scala]]></category>

		<guid isPermaLink="false">http://www.gamlor.info/wordpress/?p=2717</guid>
		<description><![CDATA[A while back I wrote about my small Async SQL library for Akka and its asynchronous MySQL driver. Besides a few tiny fixes I&#8217;ve added nothing new recently. However I&#8230; ]]></description>
				<content:encoded><![CDATA[<p>A while back I wrote about my small <a href="http://www.gamlor.info/wordpress/2012/05/async-sql-and-akka/">Async SQL library for Akka and its asynchronous MySQL driver</a>. Besides a few tiny fixes I&#8217;ve added nothing new recently.<br />
However I want to share a few number from my performance experiments.<br />
<div id="attachment_2735" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/adbcj-vs-jdbc.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/adbcj-vs-jdbc-300x147.png" alt="Racing Stuff" title="adbcj-vs-jdbc" width="300" height="147" class="size-medium wp-image-2735" /></a><p class="wp-caption-text">Racing Stuff</p></div></p>
<h2>Good Benchmarking, Science for itself</h2>
<p>Good benchmarking is a small science for itself. Creating a balanced benchmark, ensure equal conditions for multiple runs, cranking out usable numbers, do proper analysis etc. I didn&#8217;t do that. I just wrote some code, ran that stuff and compared the numbers.<br />
In the end it heavily depends on your scenario anyway. For example when you run trivial queries against a local database, then JDBC will probably win, since it only blocks a thread very briefly. If you add web-like latencies to the database communication, then my ADBCJ solution has an huge advantage.</p>
<h2>The Benchmark Scenario</h2>
<p>This is basically the benchmark scenario which I measured. It simulates a web like application.</p>
<ul>
<li>A request comes in</li>
<li>We query for the most important data. Also we query for some less important data. The more important data is returned asynchronously to the client first, while the other queries are still running. This should simulate a page, which first shows the important stuff and loads the rest in the back ground, like many websites do.</li>
<li>When the first part of the result arrives at the client, another request is sent, which updates some data</li>
<li>When all queries, updates and operations complete, we&#8217;re done. We measure the time between issuing the request and completing everything</li>
</ul>
<p>For the plain JDBC implementation I used the <a href="http://doc.akka.io/docs/akka/2.0.2/scala/futures.html">Akka future API</a>, to run that work in the background and continue with the other operations. The ADBCJ implementation relies on its asynchronous API.<br />
For these number I ran the database locally, so there is no huge round trip overhead. Only the queries need a bit of time to complete, from sub milliseconds up the around 6 milliseconds.</p>
<h2>Result, JDBC vs ADBCJ</h2>
<p>Well ADBCJ is as expected faster for this task. Mainly because it can send new queries, while processing the in streaming result of previous queries. Maybe the JDBC implementation also ends up exhausting the thread pool with blocked threads, but I didn&#8217;t check it if that&#8217;s the case:</p>
<table border="0" width="40%" cellpadding="0" cellspacing="0">
<tr>
<td></td>
<td>JDBC</td>
<td>ADBCJ</td>
</tr>
<tr>
<td>Min</td>
<td>36.00ms</td>
<td>20.00ms</td>
</tr>
<tr>
<td>Median</td>
<td>47.00ms</td>
<td>32.00ms</td>
</tr>
<tr>
<td>Mean</td>
<td>66.26ms</td>
<td>41.25ms</td>
</tr>
<tr>
<td>Max.</td>
<td>222.00ms</td>
<td>155.00ms</td>
</tr>
</table>
<p>Here&#8217;s also a box plot of the data. There is quite a high variance in the data, and a few latency spikes:<br />
<div id="attachment_2724" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/JDBC-vs-ADBJC.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/JDBC-vs-ADBJC-300x225.png" alt="JDBC vs ADBCJ" title="JDBC vs ADBCJ" width="300" height="225" class="size-medium wp-image-2724" /></a><p class="wp-caption-text">JDBC vs ADBCJ</p></div></p>
<h2>JDBC with Connection Pool, ADBCJ via JDBC bridge</h2>
<p>Now this is a little unfair, since you usually use a connection pool for JDBC. And we didn&#8217;t check out the ADBCJ via JDBC fallback driver. So I ran the benchmark as well with the <a href="http://jolbox.com/">BoneCP connection pool</a> and ADBCJ via JDBC.<br />
Guess what, JDBC with a connection pool reacts the fastest. This means that a connection pool has a huge effect in this benchmark, since it opens and closes database connection often. The conclusion is that ADBCJ desperately needs its own connect pool implementation, to handle similar scenarios.<br />
Another interesting fact is that ADBCJ via JDBC performs the worst here. It’s clear that it is probably a bit slower the JDBC version, because I manually split the JDBC calls reasonably across threads. The ADBCJ to JDBC bridge has no insight how to smartly dispatch the blocking calls. However the huge difference between JDBC and ADBCJ via JDBC is surprising. This could indicate that there are some implementation issues present in the ADBCJ to JDBC bridge.</p>
<table border="0" width="60%" cellpadding="0" cellspacing="0">
<tr>
<td></td>
<td>JDBC with Pool</td>
<td>ADBCJ</td>
<td>JDBC</td>
<td>ADBCJ via JDBC</td>
</tr>
<tr>
<td>Min</td>
<td>17.00ms</td>
<td>20.00ms</td>
<td>36.00ms</td>
<td>40.00ms</td>
</tr>
<tr>
<td>Median</td>
<td>30.00ms</td>
<td>32.00ms</td>
<td>47.00ms</td>
<td>72.00ms</td>
</tr>
<tr>
<td>Mean</td>
<td>41.37ms</td>
<td>41.25ms</td>
<td>66.26ms</td>
<td>85.35ms</td>
</tr>
<tr>
<td>Max.</td>
<td>156.00ms</td>
<td>155.00ms</td>
<td>222.00ms</td>
<td>197.00ms</td>
</tr>
</table>
<p>Again a box plot of this data. Again high variance and quite a few spikes:<br />
<div id="attachment_2727" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/withJDBCPool.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/withJDBCPool-300x225.png" alt="JDBC Connection Pool, ADBCJ via JDBC" title="withJDBCPool" width="300" height="225" class="size-medium wp-image-2727" /></a><p class="wp-caption-text">JDBC Connection Pool, ADBCJ via JDBC</p></div></p>
<h2>High Load Performance</h2>
<p>Well, I wanted to see if the picture doesn&#8217;t change if the load is much higher. So I cranked the executed request up, so that the machine is fairly busy. The database is still running locally. The picture doesn&#8217;t change much, maybe there is a tendency that the performance advantage of ADBCJ gets bigger. But I didn&#8217;t to more scaling testing to verify that. <br />
Also the ADBCJ to JDBC bridge crashed, because it just issued way to many connections. Well, as mentioned, the ADBCJ to JDBC bridge is more testing facility anyway.</p>
<table border="0" width="40%" cellpadding="0" cellspacing="0">
<tr>
<td></td>
<td>JDBC</td>
<td>ADBCJ</td>
</tr>
<tr>
<td>Min</td>
<td>41.00ms</td>
<td>20.00ms</td>
</tr>
<tr>
<td>Median</td>
<td>142.00ms</td>
<td>59.50ms</td>
</tr>
<tr>
<td>Mean</td>
<td>160.22ms</td>
<td>77.43ms</td>
</tr>
<tr>
<td>Max.</td>
<td>604.00ms</td>
<td>298.00ms</td>
</tr>
</table>
<p>And again in a box plot:<br />
<div id="attachment_2729" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/HighLoad-JDBC-vs-ADBCJ.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/HighLoad-JDBC-vs-ADBCJ-300x225.png" alt="Higher Load: JDBC vs ADBCJ" title="HighLoad-JDBC-vs-ADBCJ" width="300" height="225" class="size-medium wp-image-2729" /></a><p class="wp-caption-text">Higher Load: JDBC vs ADBCJ</p></div></p>
<h2>Conclusion</h2>
<p>Well, don&#8217;t draw to many conclusion from these numbers. We certainly can see that ADBCJ can be faster for some scenarios. We also can clearly  see, that the missing connection pool for ADBCJ is a huge performance penalty for many applications. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.gamlor.info/wordpress/2012/06/some-performance-numbers-with-akka-async-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mystery and Fantasy Series: The Fades</title>
		<link>http://www.gamlor.info/wordpress/2012/06/the-fades-en/</link>
		<comments>http://www.gamlor.info/wordpress/2012/06/the-fades-en/#comments</comments>
		<pubDate>Fri, 08 Jun 2012 21:35:54 +0000</pubDate>
		<dc:creator>gamlerhart</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Media Zap Oh Snap]]></category>
		<category><![CDATA[4-rating]]></category>
		<category><![CDATA[bbc]]></category>
		<category><![CDATA[fantasy]]></category>
		<category><![CDATA[horror]]></category>
		<category><![CDATA[mystery]]></category>
		<category><![CDATA[tv series]]></category>

		<guid isPermaLink="false">http://www.gamlor.info/wordpress/?p=2699</guid>
		<description><![CDATA[(이 블로그 글이 한국어로 저기에 있어요) The Fades is a Britisch Mystery and Fantasy Series, which aired recently on BBC3. In this series Paul, the main character, is often tormented&#8230; ]]></description>
				<content:encoded><![CDATA[<p>(이 블로그 글이 <a href="http://www.gamlor.info/wordpress/2012/06/the-fades-kr/">한국어로 저기에 있어요</a>)<br />
The Fades is a Britisch Mystery and Fantasy Series, which aired recently on BBC3. In this series Paul, the main character, is often tormented by nightmares, which even get worse and worse. And he&#8217;s an outsider, even his own sister doesn&#8217;t like him. Mac his his only friend. One day Paul meets Neil, who&#8217;s telling him that he&#8217;s an Angelic and has super powers. The Angelics protect the world and fight the evil things out there. And recently the souls of the dead cannot ascend and other strange things are going on. The help of Paul is desperately needed. But Paul isn&#8217;t sure if he really wants to help.</p>
<div id="attachment_2708" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/the-fades-en.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2012/06/the-fades-en-300x222.png" alt="슈퍼 퍼워로 뭘 하기 몰라요" title="The Fades" width="300" height="222" class="size-medium wp-image-2708" /></a><p class="wp-caption-text">슈퍼 퍼워로 뭘 하기 몰라요</p></div>
<p>I really like The Fades and think that it is fun. The story is good, the actors and special effects decent. I really like the atmosphere and tone, especially the horror movie like parts. There one thing I didn&#8217;t really like, and that&#8217;s Paul, the main character. His so insecure and he&#8217;s a whiny person. He never got my sympathy. Also I never could believe that Paul and Mac are geeks. Mac&#8217;s movie quotes are too old and out of place, to believe that his character is a teenager. </p>
<p>Anyway, I enjoyed the Fades, so I can recommend it if you like this kind of show. </p>
<p>Star-O-Meter: (4/5)</p>
<p>And here&#8217;s a little trailer:<br />
<iframe width="640" height="360" src="http://www.youtube.com/embed/x_yg6dqDLtc" frameborder="0" allowfullscreen></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gamlor.info/wordpress/2012/06/the-fades-en/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New English Only RSS Feed</title>
		<link>http://www.gamlor.info/wordpress/2012/05/new-english-only-rss-feed/</link>
		<comments>http://www.gamlor.info/wordpress/2012/05/new-english-only-rss-feed/#comments</comments>
		<pubDate>Wed, 30 May 2012 23:06:47 +0000</pubDate>
		<dc:creator>gamlerhart</dc:creator>
				<category><![CDATA[42]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[blog]]></category>

		<guid isPermaLink="false">http://www.gamlor.info/wordpress/?p=2632</guid>
		<description><![CDATA[Just a quick note about the RSS feeds on my blog here. I&#8217;ve added a new &#8216;English Only RSS&#8216; feed. That one will not include my &#8216;learning Korean&#8217; blog posts.&#8230; ]]></description>
				<content:encoded><![CDATA[<p>Just a quick note about the RSS feeds on my blog here. I&#8217;ve added a new &#8216;<a href="http://feeds.feedburner.com/GamlorEnglishOnly">English Only RSS</a>&#8216; feed. That one will not include my &#8216;learning Korean&#8217; blog posts. So, if you wanna skip the Korean stuff, subscribe to that new feed. The main RSS feed, the tech-feed and the media-feed will stay the same. That&#8217;s it.</p>
<div id="attachment_2673" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gamlor.info/wordpress/wp-content/uploads/2012/05/en-only-feed.png"><img src="http://www.gamlor.info/wordpress/wp-content/uploads/2012/05/en-only-feed-300x178.png" alt="Tons of different RSS feeds" title="en-only-feed" width="300" height="178" class="size-medium wp-image-2673" /></a><p class="wp-caption-text">Tons of different RSS feeds</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.gamlor.info/wordpress/2012/05/new-english-only-rss-feed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss><!-- Dynamic page generated in 4.260 seconds. --><!-- Cached page generated by WP-Super-Cache on 2013-05-14 06:05:42 -->
