<?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>Toru Maesaka &#187; Toru Maesaka</title>
	<atom:link href="http://torum.net/author/admin/feed/" rel="self" type="application/rss+xml" />
	<link>http://torum.net</link>
	<description>Hackaholic and a Web Addict based in Tokyo</description>
	<lastBuildDate>Tue, 28 Feb 2012 10:52:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>BlitzDB Crash Safety and Auto Recovery</title>
		<link>http://torum.net/2010/07/blitzdb-crash-safety-and-auto-recovery/</link>
		<comments>http://torum.net/2010/07/blitzdb-crash-safety-and-auto-recovery/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 09:43:14 +0000</pubDate>
		<dc:creator>Toru Maesaka</dc:creator>
				<category><![CDATA[drizzle]]></category>
		<category><![CDATA[oss]]></category>
		<category><![CDATA[blitzdb]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[recovery]]></category>
		<category><![CDATA[storage]]></category>

		<guid isPermaLink="false">http://torum.net/?p=2369</guid>
		<description><![CDATA[Crash Safety is a big deal in the database league. Lack of durability can lead to all sorts of terrible things upon a catastrophic event. Many projects, especially in the so called NoSQL world compromises crash safety in return for higher QPS. The argument there is that the availability of the overall system should be [...]]]></description>
			<content:encoded><![CDATA[<p>Crash Safety is a big deal in the database league. Lack of durability can lead to all sorts of terrible things upon a catastrophic event. Many projects, especially in the so called NoSQL world compromises crash safety in return for higher QPS. The argument there is that the availability of the overall system should be accomplished by replication since a database server can&#8217;t be rescued if the physical disk breaks. I happen to agree with this philosophy but I am also aware that this isn&#8217;t a correct answer for everyone. So, what will I do with BlitzDB?</p>
<p>Several relational database hackers have pointed out that BlitzDB isn&#8217;t any safer than MyISAM since it doesn&#8217;t guarantee crash safety. This is currently true but I plan on making BlitzDB much safer than MyISAM by providing following features.</p>
<ol>
<li>Auto Recovery Routine (startup option)</li>
<li>Tokyo Cabinet&#8217;s Transaction API (table-specific option)</li>
</ol>
<p>The second feature above would actually guarantee BlitzDB to be crash safe (especially combined with auto recovery) but I won&#8217;t get into depth in this post since this topic deserves a blog post of it&#8217;s own. Let me just state that this feature will be provided in a form like this:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> t1 <span style="color: #66cc66;">&#40;</span>
  a int <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span><span style="color: #66cc66;">,</span>
  b varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">256</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span> ENGINE <span style="color: #66cc66;">=</span> BLITZDB<span style="color: #66cc66;">,</span> CRASH_SAFE;</pre></div></div>

<p>From here on, I&#8217;ll cover how I plan on hacking auto recovery in BlitzDB.</p>
<h3>Auto Recovery Challenges</h3>
<p>As I blogged a while back, <a href="http://torum.net/2010/01/how-to-recover-a-tokyo-cabinet-database-file/">recovering Tokyo Cabinet</a> is relatively simple. However, this is not a sufficient solution in BlitzDB since the data file (hash database that actually holds the rows) and the index file(s) are independent from each other. That is, the likelihood of the data file and the index file(s) to be inconsistent is very high after a crash. So, how can we hack on this? Pretty simple.</p>
<h3>Indexes aren&#8217;t Important at Recovery Phase</h3>
<p>Because BlitzDB logically separates the data file and it&#8217;s indexes, index files aren&#8217;t that important. If a server crash had occurred, BlitzDB could delete the index file(s) and recompute them from the data file. Needless to say, this process would involve a lot of random access and computation but it would not dominate the time space of the system since it&#8217;s a one-time cost. This approach however has one flaw in it such that the index files can&#8217;t be recomputed if the data file is broken or is unrecoverable.</p>
<p>Therefore to guarantee crash safety, BlitzDB must ensure that the data file is unbreakable. This is precisely where Tokyo Cabinet&#8217;s Transaction API comes in. I&#8217;m planning on using it to protect the data file from breaking. If the data file is protected, the table can be rescued. Simple!</p>
<p>So, that&#8217;s what I have in mind for making BlitzDB a safer engine. Unfortunately I can&#8217;t start hacking on it immediately since I have several bugs to fix first. Nevertheless I&#8217;m looking forward to start hacking on it. This challenge should be quite fun to tackle.</p>
]]></content:encoded>
			<wfw:commentRss>http://torum.net/2010/07/blitzdb-crash-safety-and-auto-recovery/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Extending CREATE TABLE Syntax in Drizzle</title>
		<link>http://torum.net/2010/07/extending-create-table-syntax-in-drizzle/</link>
		<comments>http://torum.net/2010/07/extending-create-table-syntax-in-drizzle/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 17:37:42 +0000</pubDate>
		<dc:creator>Toru Maesaka</dc:creator>
				<category><![CDATA[drizzle]]></category>
		<category><![CDATA[oss]]></category>
		<category><![CDATA[api]]></category>

		<guid isPermaLink="false">http://torum.net/?p=2367</guid>
		<description><![CDATA[The flexibility to add table-specific options for things like compression, encryption and optimization can be useful to storage engine developers as this flexibility can open up new possibilities. Here&#8217;s what I&#8217;m talking about: CREATE TABLE t1 &#40; ... &#41; ENGINE = my_engine, MY_OPTION = your_arg; Supporting this is relatively easy in Drizzle and this API [...]]]></description>
			<content:encoded><![CDATA[<p>The flexibility to add table-specific options for things like compression, encryption and optimization can be useful to storage engine developers as this flexibility can open up new possibilities. Here&#8217;s what I&#8217;m talking about:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> t1 <span style="color: #66cc66;">&#40;</span>
  <span style="color: #66cc66;">...</span>
<span style="color: #66cc66;">&#41;</span> ENGINE <span style="color: #66cc66;">=</span> my_engine<span style="color: #66cc66;">,</span> MY_OPTION <span style="color: #66cc66;">=</span> your_arg;</pre></div></div>

<p>Supporting this is relatively easy in Drizzle and this API feature (and a bit more) is <a href="http://askmonty.org/wiki/Manual:Extending_CREATE_TABLE">available in MariaDB</a> as well. Unfortunately Drizzle&#8217;s method to do this isn&#8217;t documented in the Wiki yet but it should be added when our Storage Engine API becomes stable (as in, no interface changes).</p>
<h3>Implement StorageEngine::doValidateTableOptions()</h3>
<p>Here&#8217;s the actual interface.</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">bool</span> StorageEngine<span style="color: #008080;">::</span><span style="color: #007788;">doValidateTableOptions</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">const</span> std<span style="color: #008080;">::</span><span style="color: #007788;">string</span> <span style="color: #000040;">&amp;</span>key,
                                           <span style="color: #0000ff;">const</span> std<span style="color: #008080;">::</span><span style="color: #007788;">string</span> <span style="color: #000040;">&amp;</span>state<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></pre></div></div>

<p>This function is called for each table options given at CREATE TABLE syntax execution. The first argument, <em>key</em> is a const reference to a string that represents the option name. The second argument, <em>state</em> represents the argument given for that option.</p>
<p>Therefore, given: <em>COMPRESSION = YES_PLEASE</em>, <em>key</em> would be &#8220;COMPRESSION&#8221; and <em>state</em> would be &#8220;YES_PLEASE&#8221;. The objective of this function is to check whether the key/state pair makes sense to your storage engine. If this function returns false, Drizzle will return an error for the CREATE TABLE query. Personally I think this interface can be improved to be a bit more Developer friendly, such as making life easier to validate numeric values without enforcing the developer to play around with the data. Saying that, given the pace that Drizzle is growing, this could be improved before we know it.</p>
<h3>Access Options at StorageEngine::doCreateTable()</h3>
<p>Here&#8217;s the actual interface for doCreateTable().</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">int</span> doCreateTable<span style="color: #008000;">&#40;</span>drizzled<span style="color: #008080;">::</span><span style="color: #007788;">Session</span> <span style="color: #000040;">&amp;</span>session,
                  drizzled<span style="color: #008080;">::</span><span style="color: #007788;">Table</span> <span style="color: #000040;">&amp;</span>table_arg,
                  <span style="color: #0000ff;">const</span> drizzled<span style="color: #008080;">::</span><span style="color: #007788;">TableIdentifier</span> <span style="color: #000040;">&amp;</span>identifier,
                  drizzled<span style="color: #008080;">::</span><span style="color: #007788;">message</span><span style="color: #008080;">::</span><span style="color: #007788;">Table</span> <span style="color: #000040;">&amp;</span>table_proto<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></pre></div></div>

<p>Given that the options were successfully validated, doCreateTable() is called next. In Drizzle, all information regarding a table (including options) is represented in a Google Protocol Buffer message. A reference to that message object is passed to doCreateTable() as the fourth argument so all you need to do is loop through the options list in the message object and extract what you need. Here&#8217;s a minimal example that only takes care of one option.</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">int</span> n_options <span style="color: #000080;">=</span> table_proto.<span style="color: #007788;">engine</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>.<span style="color: #007788;">options_size</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> i <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> i <span style="color: #000080;">&lt;</span> n_options<span style="color: #008080;">;</span> i<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
  <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>table_proto.<span style="color: #007788;">engine</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>.<span style="color: #007788;">options</span><span style="color: #008000;">&#40;</span>i<span style="color: #008000;">&#41;</span>.<span style="color: #007788;">name</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #000080;">==</span> <span style="color: #FF0000;">&quot;my_option_name&quot;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
    <span style="color: #666666;">// Do whatever you like with this stream.</span>
    std<span style="color: #008080;">::</span><span style="color: #007788;">istringstream</span> stream<span style="color: #008000;">&#40;</span>table_proto.<span style="color: #007788;">engine</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>.<span style="color: #007788;">options</span><span style="color: #008000;">&#40;</span>i<span style="color: #008000;">&#41;</span>.<span style="color: #007788;">state</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
  <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>The above example should be simple to extend to handle multiple options. What&#8217;s really important in the above example is that the option name can be accessed with the name() accessor and the state (value) of that option with the state() accessor.</p>
<p>So, that&#8217;s all I have to cover for now. I hope this feature will help storage engine developers create and provide useful table specific features for their engine.</p>
<p>Happy Hacking.</p>
]]></content:encoded>
			<wfw:commentRss>http://torum.net/2010/07/extending-create-table-syntax-in-drizzle/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>BlitzDB is now in Drizzle&#8217;s Trunk Repository</title>
		<link>http://torum.net/2010/06/blitzdb-drizzle-merge/</link>
		<comments>http://torum.net/2010/06/blitzdb-drizzle-merge/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 11:20:45 +0000</pubDate>
		<dc:creator>Toru Maesaka</dc:creator>
				<category><![CDATA[drizzle]]></category>
		<category><![CDATA[oss]]></category>
		<category><![CDATA[blitzdb]]></category>

		<guid isPermaLink="false">http://torum.net/?p=2362</guid>
		<description><![CDATA[Happy to announce that BlitzDB has been merged with Drizzle&#8217;s Trunk. As much as I&#8217;m excited, it&#8217;s time to come back to reality. This merge is merely a beginning. There is much more work that needs to be done to BlitzDB such as ensuring stability by adding more tests, find bugs, and eliminate them. I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<p>Happy to announce that BlitzDB has <a href="http://bazaar.launchpad.net/~drizzle-developers/drizzle/development/revision/1626">been merged</a> with Drizzle&#8217;s Trunk.</p>
<p>As much as I&#8217;m excited, it&#8217;s time to come back to reality. This merge is merely a beginning. There is much more work that needs to be done to BlitzDB such as ensuring stability by adding more tests, find bugs, and eliminate them. I&#8217;m hoping that the likelihood of bugs being found will increase due to this merge. Admittedly, I want to hack on fancy (yet important) things like auto recovery but I&#8217;m going to resist doing this until I&#8217;m truly satisfied with the quality of BlitzDB. My plan is to have BlitzDB rock solid by Drizzle&#8217;s Beta release.</p>
<p>The review process to get BlitzDB into Drizzle was straight forward and smooth. This is mostly due to the fact that the community was very supportive about testing. Folks like Stewart Smith and Patrick Crews from Rackspace pointed out several bugs that I would not have found myself. I&#8217;m certainly lucky to have a supportive professional QA engineer (looking at you Patrick) to test out and give punishment to BlitzDB.</p>
<p>All I&#8217;ll be doing on BlitzDB for the next couple of weeks is debugging and refactoring to improve readability. What I need more of at the moment is test cases on JOINs that are likely to be used in practice. If you have a good test case, I would greatly appreciate it!</p>
]]></content:encoded>
			<wfw:commentRss>http://torum.net/2010/06/blitzdb-drizzle-merge/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Better Mobile Internet Life in Japan</title>
		<link>http://torum.net/2010/06/better-mobile-internet-life-in-japan/</link>
		<comments>http://torum.net/2010/06/better-mobile-internet-life-in-japan/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 12:42:31 +0000</pubDate>
		<dc:creator>Toru Maesaka</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[3g]]></category>
		<category><![CDATA[connectivity]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[mobile]]></category>

		<guid isPermaLink="false">http://torum.net/?p=2360</guid>
		<description><![CDATA[Having mobile internet connectivity was always something hot among tech geeks. What&#8217;s interesting though is that this luxury is gradually becoming a normal day to day lifestyle in urban Japan. Nowadays pretty much every major mobile carrier provides unlimited 3G Data SIM package for a competitive price. Pricing currently ranges between 2000 to 3000 JPY [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/tmaesaka/4706090010/" title="b-mobile U300 by tmaesaka, on Flickr"><img src="http://farm2.static.flickr.com/1278/4706090010_dc699f9379_m.jpg" width="165" height="240" alt="b-mobile U300" align="left" style="margin-right:8px;" /></a> Having mobile internet connectivity was always something hot among tech geeks. What&#8217;s interesting though is that this luxury is gradually becoming a normal day to day lifestyle in urban Japan. Nowadays pretty much every major mobile carrier provides unlimited 3G Data SIM package for a competitive price. Pricing currently ranges between 2000 to 3000 JPY (<a href="http://www.google.com/search?rls=en&#038;q=2500+jpy+in+usd&#038;ie=UTF-8&#038;oe=UTF-8">Google Currency Conversion</a>).</p>
<p>This movement in the mobile market is understandable since most modern lightweight laptops and netbooks sold in Japan has an internal 3G modem, which allows you to gain instant internet connectivity as long as there&#8217;s antenna coverage. Sony Vaio is a great example of this use-case. Needless to say, the iPad and Android is a contributing factor to the market shift as well.</p>
<p>The catch with these products is that you&#8217;re usually obliged to sign a contract for two years. This wouldn&#8217;t be a problem if you&#8217;re traveling to Japan and planning to stick around for that long but otherwise this can turn out to cost you unnecessary fees for cancellation.</p>
<h3>Traveling to Japan? Read This</h3>
<p>I&#8217;ve always been a fan of the prepaid model (as long as it&#8217;s not overpriced). So, last weekend I bought a 6 month package from b-mobile, which is a service that provides 3G internet connectivity (unlimited packets) for a finite period that you choose. The awesome thing about this service is that you don&#8217;t have to sign any contracts or register your personal information to the service provider (Japan Communications). All you need to do is prepay for a certain period and they&#8217;ll give you a SIM for it. No questions asked. Another good thing about b-mobile is that it runs on docomo&#8217;s <a href="http://en.wikipedia.org/wiki/FOMA">FOMA network</a> which is arguably the strongest mobile network in Japan.</p>
<p>For your interest I bought mine at <a href="http://maps.google.com/maps?f=q&#038;source=s_q&#038;hl=en&#038;geocode=&#038;q=bic+camera+shibuya&#038;sll=35.674018,139.707814&#038;sspn=0.010668,0.015171&#038;ie=UTF8&#038;hq=bic+camera&#038;hnear=Shibuya+Ward,+T%C5%8Dky%C5%8D+Metropolis,+Japan&#038;ll=35.660522,139.701226&#038;spn=0.01067,0.015171&#038;z=16&#038;iwloc=A">Bic Camera in Shibuya</a> and paid around 14,000 JPY for 6 months (works out to be around <a href="http://www.google.com/search?rls=en&#038;q=2333+jpy+in+usd&#038;ie=UTF-8&#038;oe=UTF-8">2333 JPY</a> per month). Their sales model is great for us consumers but the first impression I got was that this could be pretty dodgy if this product gets in the hands of folks with malicious intents. </p>
<h3>Perfect with Android, Especially Nexus One</h3>
<p>I decided to throw my new SIM into my HTC Magic (Dev Phone courtesy of Google) and setup tethering on it (both WiFi and USB Cable). Unfortunately the certain Android 2.1 kernel I was using wasn&#8217;t compatible with b-mobile so I had to go through several workarounds and ask my Android guru colleagues for help to get it working. The funny thing is that b-mobile will work out of the box with Nexus One running Froyo.</p>
<p>Despite the obstacles I&#8217;m happy with the outcome and I hope this blog entry would turn out to be helpful to those that are planning on traveling and staying in Japan for a while.</p>
]]></content:encoded>
			<wfw:commentRss>http://torum.net/2010/06/better-mobile-internet-life-in-japan/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>BlitzDB Concurrent Testing and Write Performance</title>
		<link>http://torum.net/2010/05/blitzdb-concurrency-testing/</link>
		<comments>http://torum.net/2010/05/blitzdb-concurrency-testing/#comments</comments>
		<pubDate>Wed, 12 May 2010 06:42:05 +0000</pubDate>
		<dc:creator>Toru Maesaka</dc:creator>
				<category><![CDATA[drizzle]]></category>
		<category><![CDATA[oss]]></category>
		<category><![CDATA[blitzdb]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://torum.net/?p=2353</guid>
		<description><![CDATA[Last month while being at the MySQL Conference, several people asked me about the status of BlitzDB. Specifically, they were interested in when I&#8217;ll release BlitzDB. Fair enough &#8211; I&#8217;ve been working on this project long enough for people to start questioning this. The answer is, BlitzDB is done in terms of implementing the design. [...]]]></description>
			<content:encoded><![CDATA[<p>Last month while being at the MySQL Conference, several people asked me about the status of BlitzDB. Specifically, they were interested in when I&#8217;ll release BlitzDB. Fair enough &#8211; I&#8217;ve been working on this project long enough for people to start questioning this.</p>
<p>The answer is, BlitzDB is done in terms of implementing the design. Right now it&#8217;s about finding bugs, fixing it and testing BlitzDB&#8217;s stability under concurrent load. Thanks to the motivation boost I gained at the conference, I&#8217;ve now fixed the bugs that were slowing me down and I&#8217;m gradually adding more tests into BlitzDB&#8217;s test suite. I consider BlitzDB&#8217;s initial release to be the day it gets merged into Drizzle&#8217;s trunk. This is almost ready as BlitzDB seems to be building fine on Drizzle&#8217;s Build Farm infrastructure. However, I won&#8217;t move to the next step until I&#8217;m satisfied with BlitzDB&#8217;s stability.</p>
<p>Yesterday I spent some time doing some concurrency testing on BlitzDB&#8217;s INSERT code with skyload. Needless to say, concurrency testing is also a convenient way to look at the performance of a particular component. So, I decided to publish my findings from this test. First, here is the background of the test.</p>
<h3>Purpose of the Test</h3>
<ul>
<li>Test BlitzDB&#8217;s slot-lock mechanism.</li>
<li>Confirm that BlitzDB will not crash under concurrent INSERT workload.</li>
<li>Confirm that key insertion to the index is working as expected.</li>
<li>Confirm that writes to multiple indexes work as expected.</li>
<li>Observe the write-performance impact of adding an index.</li>
</ul>
<p>Two commodity boxes were used. One dedicated for the client and the other dedicated for the server (Drizzle + BlitzDB). Both boxes has the same spec: Intel Quad Xeon E5345 (2×4MB L2 cache), 8GB Memory, 500GB SATA II, gigabit NIC. Servers were connected by a gigabit switch. File system on the server was ext3.</p>
<p>By default, a BlitzDB table is optimized for up to 1 million rows. Therefore this test inserted 1 million rows to a table with different concurrency levels. A different concurrency level is used per run. The table used in this test only contains three integer columns. Tests are performed up to three indexes. The linux kenel&#8217;s dirty buffer is flushed before each test run. Tests were run until the performance curve flattened.</p>
<h3>Result</h3>
<p align="center"><a href="http://www.flickr.com/photos/tmaesaka/4598572902/" title="BlitzDB Table Insertion - Multi Index by tmaesaka, on Flickr"><img src="http://farm2.static.flickr.com/1324/4598572902_c1e45d7ac5.jpg" width="500" height="294" alt="BlitzDB Table Insertion - Multi Index" /></a></p>
<p>As seen above, scalability from 1 thread to 4 thread showed an ideal curve. This is expected since the server is a 4 core box. From 4 threads, performance showed some improvements up to 12 threads. From there on, concurrency greatly exceeds the number of physical cores so we can&#8217;t observe decent performance growth. The highest insert QPS gained in this test was <strong>just over 86,000 QPS</strong>. With more cores on the server and more clients, I suspect BlitzDB can hit over 100k QPS.</p>
<p>Although this graph looks good at first sight, I&#8217;m not happy with it. The performance penalty for adding multiple indexes should be greater than what&#8217;s observed in this result. This is because TC&#8217;s B+Tree is internally protected by a single lock on writes. I suspect that the performance penalty is not observed in this graph because I didn&#8217;t give BlitzDB enough load to make TC work hard. This implies that a bottleneck could exist elsewhere (Network, Drizzle or BlitzDB&#8217;s handler level code).</p>
<p>However, I&#8217;m glad that BlitzDB stood stable on this concurrency test which was what I wanted to test in the first place. Admittedly I need to mix several types of queries to properly test BlitzDB&#8217;s stability. I plan on doing this next with sysbench and hopefully <a href="https://launchpad.net/randgen">RQG</a>.</p>
<p>Once this is done, I&#8217;ll submit a merge proposal to the Drizzle Project :)</p>
<h3>Future Development Plans</h3>
<ul>
<li>Find bugs, Fix bugs, Repeat.</li>
<li>Write an inbuilt auto recovery routine.</li>
<li>Eventually add a crash safe option to BlitzDB.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://torum.net/2010/05/blitzdb-concurrency-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing BlitzDB on Drizzle&#8217;s Build Farm</title>
		<link>http://torum.net/2010/05/blitzdb-on-build-farm/</link>
		<comments>http://torum.net/2010/05/blitzdb-on-build-farm/#comments</comments>
		<pubDate>Thu, 06 May 2010 10:37:36 +0000</pubDate>
		<dc:creator>Toru Maesaka</dc:creator>
				<category><![CDATA[drizzle]]></category>
		<category><![CDATA[oss]]></category>
		<category><![CDATA[blitzdb]]></category>
		<category><![CDATA[hudson]]></category>

		<guid isPermaLink="false">http://torum.net/?p=2349</guid>
		<description><![CDATA[One of many important things that the Drizzle project takes seriously is for the project sourcecode to successfully build in all our target platforms AND pass tests in them. This is not really specific to Drizzle as most open source projects would have the same policy. For example we do the same thing in memcached [...]]]></description>
			<content:encoded><![CDATA[<p>One of many important things that the Drizzle project takes seriously is for the project sourcecode to successfully build in all our target platforms AND pass tests in them. This is not really specific to Drizzle as most open source projects would have the same policy. For example we do the same thing in memcached thanks to Dustin Sailing&#8217;s buildbot kungfu. </p>
<p>Yesterday, Monty Taylor gave me access to Drizzle&#8217;s Build Farm Infrastructure so that I could test BlitzDB on various Linux distributions and FreeBSD. Unfortunately most build machines didn&#8217;t have Tokyo Cabinet installed so I could only test builds on Ubuntu and Debian. Fortunately the build went fine on those platforms though this was predictable since Ubuntu is my primary development platform. What was disturbing was getting test errors on my index test suite. I guess it&#8217;s time to put my thinking cap on and see what the problem is there.</p>
<p>This is a big leap towards getting BlitzDB in Drizzle&#8217;s trunk which I&#8217;m steadily working towards. I also want to benchmark BlitzDB at it&#8217;s current state with <a href="http://sysbench.sourceforge.net/">sysbench</a>&#8216;s OLTP tests. This is still low in my priority queue but hopefully I&#8217;ll do it in the next couple of months.</p>
]]></content:encoded>
			<wfw:commentRss>http://torum.net/2010/05/blitzdb-on-build-farm/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Drizzle Google Summer of Code Projects</title>
		<link>http://torum.net/2010/04/drizzle-summer-of-code/</link>
		<comments>http://torum.net/2010/04/drizzle-summer-of-code/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 06:12:03 +0000</pubDate>
		<dc:creator>Toru Maesaka</dc:creator>
				<category><![CDATA[drizzle]]></category>
		<category><![CDATA[oss]]></category>
		<category><![CDATA[gsoc]]></category>

		<guid isPermaLink="false">http://torum.net/?p=2346</guid>
		<description><![CDATA[This morning while being half a sleep, I was delighted to see an announcement email for Drizzle&#8217;s Google Summer of Code projects in my inbox. Congratulations to not only those that are taking part in GSoC via Drizzle but all of you participating in GSoC this year. Here&#8217;s the actual announcement email that contains the [...]]]></description>
			<content:encoded><![CDATA[<p>This morning while being half a sleep, I was delighted to see an announcement email for Drizzle&#8217;s Google Summer of Code projects in my inbox. Congratulations to not only those that are taking part in GSoC via Drizzle but all of you participating in GSoC this year. Here&#8217;s the actual announcement email that contains the list of Drizzle projects that will take place this year.</p>
<ul>
<li><a href="https://lists.launchpad.net/drizzle-discuss/msg06568.html">https://lists.launchpad.net/drizzle-discuss/msg06568.html</a></li>
</ul>
<p>This year I&#8217;m mentoring <a href="http://www.ucs.louisiana.edu/~ded5797/">Djellel Eddine Difallah</a> on &#8220;<strong>A Memcached Query Cache Plugin for Drizzle</strong>&#8220;. This happens to be a project I abandoned a <a href="http://torum.net/2008/10/rethink-query-cache-drizzle/">long time ago</a> so I was happy to see someone digging it up and seeking interest in it.</p>
<p>I&#8217;m excited to work with Djellel over the summer. Looking forward to having lots of fun with all the technical challenges and most importantly hacking under the open community environment.</p>
]]></content:encoded>
			<wfw:commentRss>http://torum.net/2010/04/drizzle-summer-of-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vacation in Hong Kong and Macau</title>
		<link>http://torum.net/2010/04/vacation-in-hong-kong-maca/</link>
		<comments>http://torum.net/2010/04/vacation-in-hong-kong-maca/#comments</comments>
		<pubDate>Fri, 02 Apr 2010 07:52:14 +0000</pubDate>
		<dc:creator>Toru Maesaka</dc:creator>
				<category><![CDATA[travel]]></category>

		<guid isPermaLink="false">http://torum.net/?p=2342</guid>
		<description><![CDATA[I just got back from a vacation in Hong Kong and Macau. It was my first visit to Hong Kong which tuned out to be a really enjoyable one. I&#8217;d certainly love to visit Hong Kong again. People were nice, beautiful scenery and cantonese food was delicious. Getting a free business class upgrade definitely made [...]]]></description>
			<content:encoded><![CDATA[<p>I just got back from a vacation in Hong Kong and Macau. It was my first visit to Hong Kong which tuned out to be a really enjoyable one. I&#8217;d certainly love to visit Hong Kong again. People were nice, beautiful scenery and cantonese food was delicious. Getting a free business class upgrade definitely made the trip better too.</p>
<p align="center"><a href="http://www.flickr.com/photos/tmaesaka/4478943138/" title="Hong Kong by tmaesaka, on Flickr"><img src="http://farm5.static.flickr.com/4009/4478943138_0f39ba1eb9_m.jpg" width="240" height="161" alt="Hong Kong" /></a> <a href="http://www.flickr.com/photos/tmaesaka/4478321097/" title="Hong Kong by tmaesaka, on Flickr"><img src="http://farm5.static.flickr.com/4068/4478321097_d11fb42687_m.jpg" width="240" height="161" alt="Hong Kong" /></a></p>
<p>However, what truly made our trip was the taxi driver we met on the last day. He was hardly looking at the road and kept talking to us in the back by turning around and facing us. We were all freaked out when he started drawing pictures to communicate with us while doing over 100km/h (62mph) on the highway.</p>
<p>It was also nice to catch up with an old University friend who is living in Hong Kong. It&#8217;s always great to see that your fellow alumni is doing well. I&#8217;m not sure when I&#8217;ll be able to visit Hong Kong again but I hope for it to be soon.</p>
<p>You can see more pictures <a href="http://www.flickr.com/photos/tmaesaka/sets/72157623615770211/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://torum.net/2010/04/vacation-in-hong-kong-maca/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DATE type under the hood in Drizzle/MySQL</title>
		<link>http://torum.net/2010/03/date-type-and-drizzle/</link>
		<comments>http://torum.net/2010/03/date-type-and-drizzle/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 07:24:39 +0000</pubDate>
		<dc:creator>Toru Maesaka</dc:creator>
				<category><![CDATA[drizzle]]></category>
		<category><![CDATA[oss]]></category>
		<category><![CDATA[blitzdb]]></category>
		<category><![CDATA[database]]></category>

		<guid isPermaLink="false">http://torum.net/?p=2338</guid>
		<description><![CDATA[Learned something new from my own bug in BlitzDB today. The problem was that writing a DATE column index would always return a duplicate key error (regardless of what I feed it). There are two suspicious candidates that can cause this. Comparison Function has a defect. Key Generator has a defect. The latter suspect was [...]]]></description>
			<content:encoded><![CDATA[<p>Learned something new from my own bug in BlitzDB today. The problem was that writing a DATE column index would always return a duplicate key error (regardless of what I feed it). There are two suspicious candidates that can cause this.</p>
<ul>
<li>Comparison Function has a defect.</li>
<li>Key Generator has a defect.</li>
</ul>
<p>The latter suspect was going to be tricky if it was true since BlitzDB currently uses Drizzle&#8217;s native &#8220;field packer&#8221; (except for VARCHAR) inherited from MySQL. This would mean that Drizzle&#8217;s field system has a bug in it which was somewhat difficult to believe. Furthermore, you should always blame yourself before you start suspecting other people&#8217;s code. So, I decided to look into the comparison function which was completely written by me. Turned out that&#8217;s where the bug was.</p>
<h3>Comparison Function</h3>
<p>Allow me to quickly clarify what I mean by &#8220;comparison function&#8221; in this context. TC&#8217;s B+Tree API has an interface that allows you to provide your own comparison function for all operations that involves traversing.</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">bool tcbdbsetcmpfunc<span style="color: #009900;">&#40;</span>TCBDB <span style="color: #339933;">*</span>bdb<span style="color: #339933;">,</span> TCCMP cmp<span style="color: #339933;">,</span> <span style="color: #993333;">void</span> <span style="color: #339933;">*</span>cmpop<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>What BlitzDB&#8217;s comparison function callback does is, it looks at the data type of the values to be compared and performs appropriate processing on the values then compares them. You can also look at it as a long switch statement. For those that are interested, this code is in <a href="http://bazaar.launchpad.net/%7Etmaesaka/blitzdb/trunk/annotate/head%3A/plugin/blitzdb/blitzcmp.cc">blitzcmp.cc</a> (blitz_keycmp_cb).</p>
<h3>DATE under the hood</h3>
<p>After inspecting the &#8220;type number&#8221; with GDB and looking at the corresponding ha_base_keytype enum, it turns out that the DATE type is internally represented as an unsigned 3 byte integer (HA_KEYTYPE_UINT24). This was pleasant to discover since I&#8217;ve been wondering what a 3 byte integer is still used for in Drizzle. The problem I had was that I didn&#8217;t take this type into account in the comparator and it also showed how silly I am since the answer was always there.</p>
<ul>
<li><a href="http://dev.mysql.com/doc/refman/5.1/en/storage-requirements.html">10.5. Data Type Storage Requirements</a></li>
</ul>
<p>Now, the question is should it be kept this way? Respect alignment or reduce total I/O and space by keeping it this way? This should hopefully be a fun discussion to have in the Drizzle community :)</p>
<p>P.S. My two cents is that it should respect alignment since folks that seek performance should have most of their data on memory. Respecting alignment in this environment should make some difference. Although, I can only say this after benchmarking it of course.</p>
]]></content:encoded>
			<wfw:commentRss>http://torum.net/2010/03/date-type-and-drizzle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Speaking at the MySQL Conference 2010</title>
		<link>http://torum.net/2010/02/speaking-at-the-mysql-conference-2010/</link>
		<comments>http://torum.net/2010/02/speaking-at-the-mysql-conference-2010/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 09:31:30 +0000</pubDate>
		<dc:creator>Toru Maesaka</dc:creator>
				<category><![CDATA[drizzle]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[oss]]></category>
		<category><![CDATA[travel]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://torum.net/?p=2336</guid>
		<description><![CDATA[I&#8217;m a little behind in announcing this but I&#8217;m going to be speaking at O&#8217;Reilly&#8217;s MySQL Conference this year. My presentation is a three hour tutorial titled, Drizzle Storage Engine Development. Practical Example with BlitzDB. Three hours is a long time but I assure you that there will be a break. This session isn&#8217;t solely [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a little behind in announcing this but I&#8217;m going to be speaking at O&#8217;Reilly&#8217;s MySQL Conference this year. My presentation is a three hour tutorial titled, <a href="http://en.oreilly.com/mysql2010/public/schedule/detail/12409">Drizzle Storage Engine Development. Practical Example with BlitzDB</a>. Three hours is a long time but I assure you that there will be a break.</p>
<p>This session isn&#8217;t solely about going through Drizzle&#8217;s Storage Engine API. Various performance topics like B+Tree structure, memory handling and concurrency control will be covered. I will also go through BlitzDB&#8217;s design concept and it&#8217;s internal stuff. So, needless to say I&#8217;ll talk a lot about Tokyo Cabinet and it&#8217;s internals as well.</p>
<p>Hopefully those that come along will walk out of the tutorial standing far ahead of the start line. It will help you get started on reading the implementation of other storage engines in the MySQL ecosystem (MyISAM, InnoDB, PBXT, Federated and so forth). Better yet you will start writing one.</p>
<p>Looking forward to seeing you there :)</p>
]]></content:encoded>
			<wfw:commentRss>http://torum.net/2010/02/speaking-at-the-mysql-conference-2010/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

