<?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>FewBar.com - Make it good</title>
	
	<link>http://fewbar.com</link>
	<description>Technology, life, and mischief, not in that order</description>
	<lastBuildDate>Fri, 22 Jan 2010 12:53:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Fewbarcom-technology-life-humor" /><feedburner:info uri="fewbarcom-technology-life-humor" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>How do you do, that voodoo, that Queues Do?</title>
		<link>http://feedproxy.google.com/~r/Fewbarcom-technology-life-humor/~3/zue0dhQhwSA/</link>
		<comments>http://fewbar.com/2010/01/queue-voodoo-that-queues-do/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 08:32:46 +0000</pubDate>
		<dc:creator>clint</dc:creator>
				<category><![CDATA[Scalability]]></category>
		<category><![CDATA[amqp]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[gearman]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[qpid]]></category>
		<category><![CDATA[queuing]]></category>
		<category><![CDATA[stomp]]></category>

		<guid isPermaLink="false">http://fewbar.com/?p=136</guid>
		<description><![CDATA[Queues seem to be all over the place right now. Maybe its like when I wanted a VW GTi VR6 a few years back. I kept seeing them pass me on the freeway and thought &#8220;crap, everybody is getting this hot new thing and I&#8217;m missing out!&#8221;.
I think everybody at one point looked at MySQL [...]]]></description>
			<content:encoded><![CDATA[<p>Queues seem to be all over the place right now. Maybe its like when I wanted a VW GTi VR6 a few years back. I kept seeing them pass me on the freeway and thought &#8220;crap, everybody is getting this hot new thing and I&#8217;m missing out!&#8221;.</p>
<p>I think everybody at one point looked at MySQL and tought.. &#8220;that would work fine as a queue system&#8221;. For low volume stuff, it *is* fine. But then somebody grabs your little transactional, relational, reliable queue system and plugs 5 million messages per hour through it, and somewhere, a man name Heikki cries.</p>
<p>So then you start to look around.. and for those of us who have meager budgets and tend to use open source, there aren&#8217;t a lot of choices.<span id="more-136"></span> <a href="http://wiki.secondlife.com/wiki/Message_Queue_Evaluation_Notes">The guys at Second Life did some research for all of us&#8230;</a>. Once you get through that though, you realize that the needs of second life, a MMORPG, are quite a bit different from your average web app.</p>
<p>So, without further ado, my &#8220;queue&#8221; system round up.</p>
<ul>
<li><a href="http://activemq.apache.org/">ActiveMQ</a> &#8211; This shining star of the queueing world seems to come up quickly in conversation. At Adicio, we actually gave it a good try. The main problem was, we&#8217;re a PHP shop. The PHP accessibility comes not through the normal Java Messing Service connector, but <a href="http://stomp.codehaus.org/Protocol">&#8220;STOMP&#8221;</a>.
<p />
Honestly, I&#8217;m not a big fan of these giant Apache sponsored java projects. <a href="http://lucene.apache.org/solr/">SOLR</a> has changed my mind a bit, as it seems to work well and doesn&#8217;t really crash. Then again, I&#8217;m not carrying a pager anymore, so maybe it does suck and I&#8217;m just not seeing it.</p>
<p />
Anyway, at first, ActiveMQ was winning me over. It was pretty quick.. had a pretty simple setup curve (just start up the latest version, and you have a working persistent queue system), and despite having mountains of documentation that reads like the text spammers shove into their emails randomly to pass bayesian filters, it made sense.</p>
<p />
However, its fall was pretty quick, as the first problem we hit was its Producer Throttling. This probably works fine when you&#8217;re using the JMS connector. However, with Stomp, when ActiveMQ decides your queue is too full, and it needs you to stop, it just stops acking your packets. Your stomp client blocks (or spins, in non-block mode) and you wait. This is made worse by the fairly naive php stomp driver, which doesn&#8217;t really check to see why its write failed, or even try to see if it <b>can</b>.</p>
<p />
Things got better when that was disabled, but the stomp driver was still haphazard. After figuring out that the Master/Slave protocol requires one to shut down the slave whenever failing back to a downed master, I had had enough. Sionara ActiveMQ.
</li>
<li><a href="http://www.rabbitmq.com/">RabbitMQ</a> &#8211; This one seems to be a favorite of many. My experience is limited, and I really haven&#8217;t tried it that much. Its written in erlang, which I guess automatically makes something &#8220;telco reliable&#8221;. Cool.</li>
<li><a href="http://qpid.apache.org/">QPID</a> &#8211; Wow, this one is supposedly INCREDIBLE. <a href="http://www.redhat.com/mrg/messaging/features/#aio">&#8220;500,000 messages per second per LUN.&#8221; </a>. WOW. It also has RedHat&#8217;s backing, which is a big win for me.<br />
In fact, as I write this, I&#8217;m doing my best to build and install the latest qpid on CentOS 5.4. </p>
<pre>
 gcc -DHAVE_CONFIG_H -I. -I. -I./src/config -I./include/ -I/usr/src/redhat/BUILD/xerces-c-src_2_8_0/src -I./src/lexer/ -D_GNU_SOURCE -D_REENTRANT -O2 -g -m64 -mtune=generic -MT mapm_add.lo -MD -MP -MF .deps/mapm_add.Tpo -c src/mapm/mapm_add.c  -fPIC -DPIC -o .libs/mapm_add.o
...
</pre>
<p>In case you&#8217;re familiar, I&#8217;m there. Oops, thats not qpid. Thats xerces-c. Which I have to build.. and I also have to build xqilla after that. Luckily, 40 other packages required to build qpid were available in the standard CentOS yum repository.</p>
<p />
Another unfortunate reality is that there is no qpid connectivity available for PHP. Unless the <a href="http://code.google.com/p/php-amqp/">php-amqp module</a> works. Its really not clear yet.<br />
Anyway, this looks like a promising messaging technology. However, this much software leaves a lot of room for things to break.. so, while I will probably complete the build, as I want to find out how it stacks up to the others in terms of simplicity and performance, I think this one is dead.</p>
<p />
</li>
<li><a href="http://gearman.org">Gearman</a> &#8211; Ok I&#8217;m going to say it up front. I like this one. Its really not a &#8220;queue&#8221; system per sé. The name is an anagram of &#8216;manager&#8217; (say that 5 times fast!). Its one of those great things that came out of the Danga group, the same people who created MogileFS and Memcached.
<p />
Call me stupid, but I like to be able to read things. QPID is in C++, and is so big, I don&#8217;t even know where to start. Java gives me the shivers, and I don&#8217;t even know what erlang looks like. But damn, who doesn&#8217;t like poring over well written C? Thats pretty much what the new C port of gearmand is.</p>
<p />
I&#8217;m especially fond of the ease with which one can write a persistence layer. I recently submitted code to make the tokyocabinet queue store better. Its a simple B+Tree store that everybody&#8217;s going crazy about these days. Its also written in really nice C.</p>
<p />
The built in ability for gearman clients/workers (producers/consumers) to have a 2 way conversation is especially appealing. Its not like they can just freely pass messages back and forth. But clients can choose to wait for the job they submitted to complete. They can also check on the status of the job fairly easily. Workers can send back two integers (numerator and denominator), which is particularly useful for sending back a count of things done over the count of things to do.</p>
<p />
Combine all this cool stuff with the dead simple &#8216;gearman&#8217; command line client, and you have a happy Clint. I wrote a little PHP worker that just sits around collecting data sent to it by the other workers running. When it receives a &#8220;show_all_workers&#8221; message (function in gearman-ese), it just spits back a text report of what it knows. This can be triggered by just saying:</p>
<pre>
$ gearman -s -f show_all_workers

Known Workers: 5

dev3.adicio.com_Adicio_App_Reverse_Worker_29336 jobs=26508,restarts=0,memory_MB=1.47,lastcheckin=Thu, 21 Jan 2010 15:33:32 -0800
dev3.adicio.com_Adicio_App_Reverse_Worker_29333 jobs=19194,restarts=0,memory_MB=1.47,lastcheckin=Thu, 21 Jan 2010 15:33:32 -0800
dev3.adicio.com_Adicio_App_Reverse_Worker_29356 jobs=29208,restarts=0,memory_MB=1.47,lastcheckin=Thu, 21 Jan 2010 15:33:32 -0800
dev3.adicio.com_Adicio_App_Reverse_Worker_29370 jobs=27638,restarts=0,memory_MB=1.47,lastcheckin=Thu, 21 Jan 2010 15:33:32 -0800
dev3.adicio.com_Adicio_App_Reverse_Worker_29332 jobs=10636,restarts=0,memory_MB=1.47,lastcheckin=Thu, 21 Jan 2010 15:33:32 -0800

$
</pre>
<p>This is pretty damn cool. Now double the fun with <a href="https://launchpad.net/gearman-mysql-udf">MySQL UDF&#8217;s</a>, and you have a workable solution for queueing via MySQL trigger.<br />
<a href="http://fewbar.com/wp-content/uploads/2010/01/paris-hilton-thats-hot.jpg"><img src="http://fewbar.com/wp-content/uploads/2010/01/paris-hilton-thats-hot.jpg" alt="" title="paris hilton thats hot" width="256" height="256" class="alignnone size-full wp-image-138" /></a></p>
<p />
So, I can&#8217;t help but give this one the nod for simplicity of design. There are no massive books written to explain what gearman does. Just a nice easy C library, and perhaps one of the most important things, a really useful PHP extension.
</li>
</ul>

<p><a href="http://feedads.g.doubleclick.net/~a/axKgVZZ46PKjCAl0aNSLeHGpVNw/0/da"><img src="http://feedads.g.doubleclick.net/~a/axKgVZZ46PKjCAl0aNSLeHGpVNw/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/axKgVZZ46PKjCAl0aNSLeHGpVNw/1/da"><img src="http://feedads.g.doubleclick.net/~a/axKgVZZ46PKjCAl0aNSLeHGpVNw/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Fewbarcom-technology-life-humor/~4/zue0dhQhwSA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fewbar.com/2010/01/queue-voodoo-that-queues-do/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://fewbar.com/2010/01/queue-voodoo-that-queues-do/</feedburner:origLink></item>
		<item>
		<title>Nick Bartlett » Blog Archive » Selenium IDE and TinyMCE</title>
		<link>http://feedproxy.google.com/~r/Fewbarcom-technology-life-humor/~3/SwvdihZXFxw/</link>
		<comments>http://fewbar.com/2009/11/nick-bartlett-%c2%bb-blog-archive-%c2%bb-selenium-ide-and-tinymce/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 00:49:51 +0000</pubDate>
		<dc:creator>clint</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[selenium]]></category>
		<category><![CDATA[tinymce]]></category>

		<guid isPermaLink="false">http://fewbar.com/?p=133</guid>
		<description><![CDATA[Nick Bartlett » Blog Archive » Selenium IDE and TinyMCE.
This was very handy, and while googling for &#8216;tinymce&#8217; and &#8217;selenium&#8217; rendered this as the first link, I&#8217;d like to add links to make sure this quick and simple solution stays at the top.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nickbartlett.com/wordpress/selenium-ide-and-tinymce/">Nick Bartlett » Blog Archive » Selenium IDE and TinyMCE</a>.</p>
<p>This was very handy, and while googling for &#8216;tinymce&#8217; and &#8217;selenium&#8217; rendered this as the first link, I&#8217;d like to add links to make sure this quick and simple solution stays at the top.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/ZsEYW0oXP7PXNJ6iEgmrreJ2d-I/0/da"><img src="http://feedads.g.doubleclick.net/~a/ZsEYW0oXP7PXNJ6iEgmrreJ2d-I/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/ZsEYW0oXP7PXNJ6iEgmrreJ2d-I/1/da"><img src="http://feedads.g.doubleclick.net/~a/ZsEYW0oXP7PXNJ6iEgmrreJ2d-I/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Fewbarcom-technology-life-humor/~4/SwvdihZXFxw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fewbar.com/2009/11/nick-bartlett-%c2%bb-blog-archive-%c2%bb-selenium-ide-and-tinymce/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://fewbar.com/2009/11/nick-bartlett-%c2%bb-blog-archive-%c2%bb-selenium-ide-and-tinymce/</feedburner:origLink></item>
		<item>
		<title>Bromine and Selenium – second and third most useful elements behind Oxygen</title>
		<link>http://feedproxy.google.com/~r/Fewbarcom-technology-life-humor/~3/UtUHxeJK-Z0/</link>
		<comments>http://fewbar.com/2009/11/bromine-and-selenium-tests-for-the-rests-of-u/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 01:48:10 +0000</pubDate>
		<dc:creator>clint</dc:creator>
				<category><![CDATA[Engineers]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Scalability]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[selenium]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://fewbar.com/?p=125</guid>
		<description><![CDATA[If you&#8217;re an engineer, you hate testing. Seriously, who likes doing what those mere mortal &#8220;users&#8221; do? We&#8217;re POWER users and we don&#8217;t need to use all those silly features on all those sites. Just look at Craigslist, clearly an engineer&#8217;s dream tool.
For web apps, testing actually isn&#8217;t *that* hard. The client program (the browser) [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re an engineer, you hate testing. Seriously, who likes doing what those mere mortal &#8220;users&#8221; do? We&#8217;re POWER users and we don&#8217;t need to use all those silly features on all those sites. Just look at Craigslist, clearly an engineer&#8217;s dream tool.</p>
<p>For web apps, testing actually isn&#8217;t *that* hard. The client program (the browser) is readily available on every platform known to man, and they generally don&#8217;t do much more than store and retrieve data in clever ways. So, its not like we have to fire up a Large Hadron Collider to observe the effects of our web app.<span id="more-125"></span><a href="http://fewbar.com/wp-content/uploads/2009/11/periodictable.jpg"><img class="size-full wp-image-127 alignleft" title="periodictable" src="http://fewbar.com/wp-content/uploads/2009/11/periodictable.jpg" alt="periodictable" width="234" height="142" /></a></p>
<p>Therein lies the problem though, as clicking around on web forms and entering the same email address, password, address, phone number, etc. etc., 100 times, is BORING.</p>
<p>Enter <a href="http://seleniumhq.org/">Selenium</a>. This amazing little tool has been on the scene for a little while now, but its just now getting some momentum. Click through to the website and watch &#8220;the magic&#8221; as they put it, but basically here&#8217;s how it goes:</p>
<ul>
<li> open their firefox plugin and click &#8216;record</li>
<li>do something</li>
<li>click &#8216;record&#8217; again.</li>
</ul>
<p>Then just save this little test case to a file, and the next time you change anything that might relate to the series of clicks and data entries you just made, run this test again. There are all kinds of assertions you can make while you&#8217;re doing something. Like &#8216;Make sure the title is X&#8217; or &#8216;make sure a link to Y exists&#8217;.</p>
<p>But wait, I could have done that with something like Test::More,  PHPUnit, or lime. Where&#8217;s the real benefit?</p>
<p>Well because Selenium remotely controls your browser, all those gotchya&#8217;s regarding javascript CSS incompatibilities can come into play here. Because Selenium can control Internet Explorer, Firefox, *and* Safari. In fact it can also control Opera, and according to their website, any browser that properly supports javascript fully.</p>
<p>This is really a nice evolutionary step for web shops, as tools like this generally are OS specific and cost a lot of money. Once again open source software appears where a need becomes somewhat ubiquitous.</p>
<p>You can even take it a step further. The next thing that generally happens in a web dev shop when they get bigger than 20 or 30 people is they hire people who actually <strong>like</strong> testing. Well not really, but they dislike it *less* than software engineers. These are QA engineers. And they <strong>DO</strong> like things to be orderly and efficient.</p>
<p><a href="http://seleniumhq.org/projects/bromine/">Bromine</a> is the answer for that. Its still pretty rough around the edges, but it gets the job done.</p>
<p>Again check out their website and watch the screencast, but basically it goes like this:</p>
<ul>
<li>Write selenium tests as specified above</li>
<li>Upload tests to Bromine server</li>
<li>Attach tests to requirements</li>
<li>Run selenium remote control on all required OS/browser version combinations (can you say virtualbox?)</li>
<li>Run tests</li>
</ul>
<p>Another nice thing about using bromine is now you are running your tests in a server side language, not just the Selenium IDE, which is limited to the IDE&#8217;s generated &#8220;Selenese&#8221; XML commands for tests. The IDE exports your basic test into PHP or Java, and then on the bromine server you can do interesting things, like check an IMAP box for an email, run a backend process, or send an SMS.</p>
<p>At first it may not seem like much, but eventually you end up with a multitude of useful tests for your web app that can be run all the time against development branches before release, and catch many problems. Quality means happier users, which hopefully means loyal users that keep coming back.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/MnqW4fyYYJR5k67PzNqDy-sxpzg/0/da"><img src="http://feedads.g.doubleclick.net/~a/MnqW4fyYYJR5k67PzNqDy-sxpzg/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/MnqW4fyYYJR5k67PzNqDy-sxpzg/1/da"><img src="http://feedads.g.doubleclick.net/~a/MnqW4fyYYJR5k67PzNqDy-sxpzg/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Fewbarcom-technology-life-humor/~4/UtUHxeJK-Z0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fewbar.com/2009/11/bromine-and-selenium-tests-for-the-rests-of-u/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://fewbar.com/2009/11/bromine-and-selenium-tests-for-the-rests-of-u/</feedburner:origLink></item>
		<item>
		<title>TokyoOops</title>
		<link>http://feedproxy.google.com/~r/Fewbarcom-technology-life-humor/~3/UztshB4hwGM/</link>
		<comments>http://fewbar.com/2009/10/tokyo-tyrant-ignores-memcache-protocol-flags/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 04:28:52 +0000</pubDate>
		<dc:creator>clint</dc:creator>
				<category><![CDATA[Memcache]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[berkeleydb]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[memcachedb]]></category>
		<category><![CDATA[process]]></category>
		<category><![CDATA[RTFM]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[tokyotyrant]]></category>

		<guid isPermaLink="false">http://fewbar.com/?p=117</guid>
		<description><![CDATA[We had a fun time this week with TokyoTyrant. Recently it has become apparent that MemcacheDB has been all but abandoned. As fantastic as the early work was by Steve Chu, the project is in disrepair. That, coupled with the less than obvious failover for its replication combined to make us seek alternatives.


Brian Aker had [...]]]></description>
			<content:encoded><![CDATA[<p>We had a fun time this week with <a href="http://1978th.net/tokyotyrant/">TokyoTyrant</a>. Recently it has become apparent that <a href="http://www.memcachedb.org/">MemcacheDB</a> has been all but abandoned. As fantastic as the early work was by Steve Chu, the project is in disrepair. That, coupled with the <a href="http://fewbar.com/2009/03/memcachedb-fault-tolerance-procedures/">less than obvious failover for its replication</a> combined to make us seek alternatives.</p>
<p><a href="http://fewbar.com/wp-content/uploads/2009/10/virtual_stupidity.jpg"><img class="alignnone size-full wp-image-121" title="virtual_stupidity" src="http://fewbar.com/wp-content/uploads/2009/10/virtual_stupidity.jpg" alt="virtual_stupidity" width="280" height="280" /></a></p>
<p><span id="more-117"></span><br />
<a href="http://krow.net">Brian Aker</a> had mentioned to me at one time that TokyoTyrant was way better than memcachedb and we should run it instead. I took notice and it turns out he&#8217;s right! It does basically the same thing, applying the memcache protocol to an on disk key/value store. However, the code is incredibly clean, well maintained, and runs extremely fast. There&#8217;s also a lot more flexibility, with the ability to choose between in-memory or on disk storage, hash tables, B+Tree&#8217;s, etc.</p>
<p>The availability of log based asynchronous master/master replication (somewhat similar to MySQL&#8217;s replication in concept) was probably one of the biggest wins, allowing much simpler failover (just move the IP, or DNS, or whatever) when compared to MemcacheDB&#8217;s adherence to BerkeleyDB&#8217;s replication setup, which is a single-master system implementing an election algorithm.</p>
<p>Somewhere during migration, we missed one tiny detail though. Sometimes, the devil is in the details. This is really the only evidence in <a href="http://1978th.net/tokyotyrant/spex.html#protocol">the documentation that tokyo tyrant has support for the memcache protocol</a>. It is very clear:</p>
<blockquote><p>Memcached Compatible Protocol</p>
<p>As for the memcached (ASCII) compatible protocol, the server implements the following commands; &#8220;set&#8221;, &#8220;add&#8221;, &#8220;replace&#8221;, &#8220;get&#8221;, &#8220;delete&#8221;, &#8220;incr&#8221;, &#8220;decr&#8221;, &#8220;stats&#8221;, &#8220;flush_all&#8221;, &#8220;version&#8221;, and &#8220;quit&#8221;. &#8220;noreply&#8221; options of update commands are also supported. However, &#8220;flags&#8221;, &#8220;exptime&#8221;, and &#8220;cas unique&#8221; parameters are ignored.</p></blockquote>
<p>Now, as I said, there&#8217;s nothing ambiguous about this. That would have helped, if anyone on my team had ever read it. We installed TokyoTyrant, pointed our basic test code at it, and it worked. This is really a process problem, not so much a technical one. The process must be to assume it won&#8217;t work, and test all the different use cases to make sure it works.</p>
<p>Now, why is that bit of the manual important? Well we use PHP. Specifically, we use the PECL &#8220;Memcache&#8221; module to access memcache protocol storage. Now, the Memcache module is mostly oriented toward caching in the memory based original memcached. It works great for memcachedb too, which simply ignores the exptime parameter. However, memcacheDB *does not* ignore &#8220;flags&#8221;.</p>
<p>And therein lies the problem. Users of the <a href="http://pecl.php.net/package/memcache">PECL Memcache module</a> may not know this, but the flags are *important*. There are two bits in that flags field that the Memcache module may set. Bit 0 is used to indicate whether or not the content has been serialized, and, therefore, on read, must be unserialized. Bit 1 is used to indicate whether or not the content has been gzipped.</p>
<p>So, while all of the strings that were stored in MemcacheDB and subsequently copied to TokyoTyrant worked great, the serialized objects, arrays, and gzipped values, were completely inoperative, as they were coming back to the code as strings and binary compressed data. The gzipped data was easy (turn off automatic gzip compression). The serialized data took some quick tap dancing to remedy, with code something like this:</p>
<p><code lang="php"><br />
class Memcache_BrokenFlags extends Memcache<br />
{<br />
public function get($key, &amp;$flags)<br />
{<br />
$v = parent::get($key, $flags);<br />
$uv = @unserialize($v);<br />
return $uv === false ? $v : $uv;<br />
}<br />
}<br />
</code></p>
<p>Luckily our code all uses one Factory method to spawn all &#8220;MemcacheDB&#8221; connections, so it was easy to substitute this in.</p>
<p>Eventually we can just change the code by segregating into things that always serialize, and things that don&#8217;t, and just do the serialization ourselves. This should eventually allow us to use the new <a href="http://pecl.php.net/package/tokyo_tyrant">tokyo_tyrant module in PECL</a>, which only reliably stores scalars (I noticed recent versions have added a call to the internal PHP function convert_to_string().. this is, I think, a mistake, but one that still leaves it up the programmer to explicitly serialize when serialization is desired).</p>
<p>This was a pretty big gotchya, and one that illustrates that even though sometimes us cowboy coders and sysadmins get annoyed when those pesky business people ask us for plans, schedules, expected impact, etc., and we keep assuring them we know whats up, its still important to actually know whats up, and make sure to RTFMC .. C as in, CAREFULLY.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/o1al1L-eLGoYBlgW_DA19tbZxO0/0/da"><img src="http://feedads.g.doubleclick.net/~a/o1al1L-eLGoYBlgW_DA19tbZxO0/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/o1al1L-eLGoYBlgW_DA19tbZxO0/1/da"><img src="http://feedads.g.doubleclick.net/~a/o1al1L-eLGoYBlgW_DA19tbZxO0/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Fewbarcom-technology-life-humor/~4/UztshB4hwGM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fewbar.com/2009/10/tokyo-tyrant-ignores-memcache-protocol-flags/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://fewbar.com/2009/10/tokyo-tyrant-ignores-memcache-protocol-flags/</feedburner:origLink></item>
		<item>
		<title>At the end of the day, just ship the f***ing thing!</title>
		<link>http://feedproxy.google.com/~r/Fewbarcom-technology-life-humor/~3/uajWaAoKi_g/</link>
		<comments>http://fewbar.com/2009/09/at-the-end-of-the-day-just-ship-the-fing-thing/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 05:45:22 +0000</pubDate>
		<dc:creator>clint</dc:creator>
				<category><![CDATA[Engineers]]></category>
		<category><![CDATA[Geeky]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[goals]]></category>

		<guid isPermaLink="false">http://fewbar.com/?p=113</guid>
		<description><![CDATA[This article about &#8220;Duct Tape Programmers&#8221; excerpts another article with interviews from great coders. I just had to share this fantastic quote from Jamie Zawinski
“Yeah,” he says, “At the end of the day, ship the fucking thing! It’s great to rewrite your code and make it cleaner and by the third time it’ll actually be [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.joelonsoftware.com/items/2009/09/23.html">This article about &#8220;Duct Tape Programmers&#8221;</a> excerpts <a href="http://www.amazon.com/gp/product/1430219483?ie=UTF8&#038;tag=joelonsoftware&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=1430219483">another article with interviews from great coders</a>. I just had to share this fantastic quote from <a href="http://en.wikipedia.org/wiki/Jamie_Zawinski">Jamie Zawinski</a></p>
<blockquote><p>“Yeah,” he says, “At the end of the day, ship the fucking thing! It’s great to rewrite your code and make it cleaner and by the third time it’ll actually be pretty. But that’s not the point—you’re not here to write code; you’re here to ship products.”</p></blockquote>
<p>I&#8217;m a big fan of &#8220;the proper amount of abstraction&#8221;, but I think its important to remember the scope of each thing we&#8217;re working on. Rock on jwz.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/wIu-TnziFCKyDiFkImDW33KvcAk/0/da"><img src="http://feedads.g.doubleclick.net/~a/wIu-TnziFCKyDiFkImDW33KvcAk/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/wIu-TnziFCKyDiFkImDW33KvcAk/1/da"><img src="http://feedads.g.doubleclick.net/~a/wIu-TnziFCKyDiFkImDW33KvcAk/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Fewbarcom-technology-life-humor/~4/uajWaAoKi_g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fewbar.com/2009/09/at-the-end-of-the-day-just-ship-the-fing-thing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://fewbar.com/2009/09/at-the-end-of-the-day-just-ship-the-fing-thing/</feedburner:origLink></item>
		<item>
		<title>SSH brute force protection – Its almost always already written</title>
		<link>http://feedproxy.google.com/~r/Fewbarcom-technology-life-humor/~3/KCg0ioZL53g/</link>
		<comments>http://fewbar.com/2009/08/ssh-brute-force-protection-its-almost-always-already-written/#comments</comments>
		<pubDate>Sun, 23 Aug 2009 16:49:36 +0000</pubDate>
		<dc:creator>clint</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[collaboration]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://fewbar.com/?p=111</guid>
		<description><![CDATA[Every time I get my logwatch report and see the 20 &#8211; 40 daily brute force attempts on it, I cringe. I&#8217;ve locked it down to a point, but ultimately I prefer convenience on some level. Limiting any one IP to 2 ssh connections every 5 minutes has annoyed me as many times as it [...]]]></description>
			<content:encoded><![CDATA[<p>Every time I get my logwatch report and see the 20 &#8211; 40 daily brute force attempts on it, I cringe. I&#8217;ve locked it down to a point, but ultimately I prefer convenience on some level. Limiting any one IP to 2 ssh connections every 5 minutes has annoyed me as many times as it has probably saved me. Preventing root from logging in is nice too.</p>
<p>Ultimately though, I wanted a way to fight back against the brute forcers.. to get a step ahead of them. From seeing the success of projects like <a href="http://spamhaus.org">SpamHAUS</a> and <a href="http://www.projecthoneypot.org">Project HoneyPot</a>, I know that massive group collaboration works. Of course I started thinking how I&#8217;d write it in my head. Every time&#8230; for months.</p>
<p>Well, once I let go of my egotistical desire to write it, I found this great project, <a href="http://denyhosts.sourceforge.net">DenyHosts</a>, which does the same thing for the brute force scanners. I just installed it, and already it has added a few IPs to hosts.deny. Go download it, run it, and stop the annoying scanners!</p>

<p><a href="http://feedads.g.doubleclick.net/~a/WaJVOpHAMVmIT948FNDRV1YGSGg/0/da"><img src="http://feedads.g.doubleclick.net/~a/WaJVOpHAMVmIT948FNDRV1YGSGg/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/WaJVOpHAMVmIT948FNDRV1YGSGg/1/da"><img src="http://feedads.g.doubleclick.net/~a/WaJVOpHAMVmIT948FNDRV1YGSGg/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Fewbarcom-technology-life-humor/~4/KCg0ioZL53g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fewbar.com/2009/08/ssh-brute-force-protection-its-almost-always-already-written/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://fewbar.com/2009/08/ssh-brute-force-protection-its-almost-always-already-written/</feedburner:origLink></item>
		<item>
		<title>Your code must suck</title>
		<link>http://feedproxy.google.com/~r/Fewbarcom-technology-life-humor/~3/-rS3BRPMJCQ/</link>
		<comments>http://fewbar.com/2009/07/your-code-must-suck/#comments</comments>
		<pubDate>Sat, 25 Jul 2009 21:19:24 +0000</pubDate>
		<dc:creator>clint</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[design patterns]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[postgresql]]></category>

		<guid isPermaLink="false">http://fewbar.com/?p=103</guid>
		<description><![CDATA[While attending OSCON 2009 w/ my faithful sidekick fluffy, we constantly kept finding instances of a common theme. The leading companies and projects seem to share one attribute that might shock you.
They all have at least *some* crappy code. At some point, all of them have set aside their principles and thrown in a hack [...]]]></description>
			<content:encoded><![CDATA[<p>While attending <a href="http://en.oreilly.com/oscon2009">OSCON 2009</a> w/ my faithful sidekick <a href="http://poorlycoded.com/">fluffy</a>, we constantly kept finding instances of a common theme. The leading companies and projects seem to share one attribute that might shock you.</p>
<p>They all have at least *some* crappy code. At some point, all of them<span id="more-103"></span> have set aside their principles and thrown in a hack to get things working. This is reinforced by those projects that have their dignity, but no market share. FreeBSD users are famous for saying that Linux is coded by 10,000 monkeys. FreeBSD is an awesome project, that has powered some <a href="http://yahoo.com">huge websites</a>. However, the primary Free OS is Linux. Even further along that line is Windows, which is pretty much a hack on a hack on a hack, but somehow, everybody ends up running it.</p>
<p>This isn&#8217;t to say that all of the code in popular projects sucks. Just that some of it does. I&#8217;m still waiting for the example of an organization that has produced pure, beautiful code with no compromises, and then gone on to garner a large market share and/or massive profits.</p>
<p>The site <a href="http://www.thedailywtf.com/">TheDailyWTF</a> exists primarily because of this fact. I hit that site at least twice a week to have a good laugh. Many times it causes me to reminisce about some of the things I saw early in my career. Just as often, I&#8217;m reminded of something more recent. The trend doesn&#8217;t seem to stop, despite advances in computing and human understanding, it goes back decades. I imagine Ogg, the first guy who designed a wheel, snarked about how Thag&#8217;s wheels weren&#8217;t perfectly round. But ultimately, Thag was able to produce wheels that weren&#8217;t perfectly round, but rolled pretty well. He probably got them out in half the time, and ended up trading more wheels for Mammoth pelts than Ogg by a factor of five. No doubt Thag was able to attract more mates with his Mammoth Pelt fortune, so maybe its just in our nature. </p>
<p>Really though, this flies in the face of code purity, which we all want. Code sucking == profit? Hacks == market share? This doesn&#8217;t sit well with those of us who pride ourselves on brace placement discipline, and knowing at least 5 design patterns without looking them up in a book. But there it is, that pile of dung you knocked out at 3am the day before release to QA&#8230; 3 years ago. Still powering the site despite being closer to Alpaca bile than beautiful code.</p>
<p>This doesn&#8217;t mean projects fail without hacks. What it means though, is that projects that obsess over doing things &#8220;the right way&#8221; tend to languish, and rarely achieve success on a massive scale. For some that is ok, they&#8217;re happy to have produced something great that a few people like and that works right for them. In fact, this is largely the  (healthy) attitude I see from the PostgreSQL project. </p>
<p>The PostgreSQL developers and users tend to feel strongly that their database is far superior to the likes of say, MySQL. They&#8217;ll tell you that they have always had full ACID compliance, that their bug counts are low, and performance continues to rise with every release.</p>
<p>I know a lot of people are successfully running PostgreSQL, but really, by contrast, seems like everybody&#8217;s running MySQL. MySQL is not bad code either. It just has hacks. Ok, having dug into it a bit now, it has <strong>a lot</strong> of hacks. But, why is MySQL the leader, and PostgreSQL the follower.</p>
<p>I think the answer is right there in that last sentence. As Cesar Milan will tell you, &#8220;choo gotta be da pack leader&#8221;. PostgreSQL probably would have continued on as a fine, but obscure, database engine had MySQL not revolutionized data storage in the same way Apache revolutionized web serving. MySQL has managed to carve out a huge market with Free software, while PostgreSQL&#8217;s market is only now beginning to grow. Really PostgreSQL has refused to follow in MySQL&#8217;s footsteps for a long time, and because of that, they&#8217;ve avoided many of the pitfalls MySQL has fallen in to as their scope creeps larger and larger like an amoeba slowly devouring the edges of the enterprise market that used to seem so far from its original targets.</p>
<p>However, even the Postgres guys know that hacks may be necessary. <a href="http://archives.postgresql.org/pgsql-hackers/2008-05/msg00913.php">As of May, 2008 they have given in</a> and will produce a general purpose master/slave replication system. The message to the &#8220;pgsql-hackers&#8221; list has an air of reluctance to it..</p>
<blockquote><p>Users who might consider<br />
PostgreSQL are choosing other database systems because our existing<br />
replication options are too complex to install and use for simple cases.<br />
In practice, simple asynchronous single-master-multiple-slave<br />
replication covers a respectable fraction of use cases, so we have<br />
concluded that we should allow such a feature to be included in the core<br />
project.</p></blockquote>
<p>Its like they&#8217;re finally saying &#8220;ok we want more users, so we&#8217;ll include this thing that goes against our principles.&#8221; Personally I think this is great, as PostgreSQL <strong>is</strong> a nice RDBMS, and to be able to use it for small-medium scaleout just like MySQL is really quite exciting.</p>
<p>So, the moral of the story is, if you want your project to be successful, throw in some crap code. Otherwise your developers will be up on their high horses too long, and not down in the trenches getting things done.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/5Qtfw0e4ICyudscmTT5s-faSH_U/0/da"><img src="http://feedads.g.doubleclick.net/~a/5Qtfw0e4ICyudscmTT5s-faSH_U/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/5Qtfw0e4ICyudscmTT5s-faSH_U/1/da"><img src="http://feedads.g.doubleclick.net/~a/5Qtfw0e4ICyudscmTT5s-faSH_U/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Fewbarcom-technology-life-humor/~4/-rS3BRPMJCQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fewbar.com/2009/07/your-code-must-suck/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://fewbar.com/2009/07/your-code-must-suck/</feedburner:origLink></item>
		<item>
		<title>The Trans-doran Complex (How to get hired by me)</title>
		<link>http://feedproxy.google.com/~r/Fewbarcom-technology-life-humor/~3/c2xt1u1-9Tk/</link>
		<comments>http://fewbar.com/2009/06/how-to-get-hired-by-me/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 16:39:38 +0000</pubDate>
		<dc:creator>clint</dc:creator>
				<category><![CDATA[Engineers]]></category>
		<category><![CDATA[Life]]></category>
		<category><![CDATA[aikido]]></category>
		<category><![CDATA[hiring]]></category>
		<category><![CDATA[sethgodin]]></category>
		<category><![CDATA[zen]]></category>

		<guid isPermaLink="false">http://fewbar.com/?p=100</guid>
		<description><![CDATA[Seth Godin&#8217;s recent post about responding to discussions about things you don&#8217;t understand has got me thinking about hiring people.
When involved with a staffing decision, I look for one trait in particular above all others. If you don&#8217;t know how to say &#8220;I don&#8217;t know&#8221;, and ask for an explanation or help, then you&#8217;re not [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://sethgodin.typepad.com/seths_blog/2009/06/when-smart-people-are-hard-to-understand.html">Seth Godin&#8217;s recent post about responding to discussions about things you don&#8217;t understand</a> has got me thinking about hiring people.</p>
<p>When involved with a staffing decision, I look for one trait in particular above all others. If you don&#8217;t know how to say &#8220;I don&#8217;t know&#8221;, and ask for an explanation or help, then you&#8217;re not really smart. You don&#8217;t have a good <a href="http://sethgodin.typepad.com/seths_blog/2009/01/what-are-you-good-at.html">process</a> for learning. You may have a mountain of knowledge in your head, but it is surrounded by a huge, impenetrable ego shield, and so, cannot ever be added to. Its like you took the sum of what you knew, and stuffed it into a snow globe. When people shake you up.. sure.. its pretty, but thats all there is to it.</p>
<p>I&#8217;d rather work with people who are open to having their entire belief system about certain subjects shattered by a better idea. That doesn&#8217;t mean that you shouldn&#8217;t stick to your guns and assert your own ideas and beliefs. It just means, when challenged, be like the Zen Buddhist Aikido master and flow with the force of the attack, and when possible, use it to your advantage.<br />
<span id="more-100"></span><br />
(No google will not help you with the &#8220;trans-doran complex&#8221;. I&#8217;m hoping that upon seeing it you were curious, and after googling for it and finding nothing of substance, considered asking what it is.. <img src='http://fewbar.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>

<p><a href="http://feedads.g.doubleclick.net/~a/EF30hKk6WGbTWS7DwRWBU-NRNKA/0/da"><img src="http://feedads.g.doubleclick.net/~a/EF30hKk6WGbTWS7DwRWBU-NRNKA/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/EF30hKk6WGbTWS7DwRWBU-NRNKA/1/da"><img src="http://feedads.g.doubleclick.net/~a/EF30hKk6WGbTWS7DwRWBU-NRNKA/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Fewbarcom-technology-life-humor/~4/c2xt1u1-9Tk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fewbar.com/2009/06/how-to-get-hired-by-me/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://fewbar.com/2009/06/how-to-get-hired-by-me/</feedburner:origLink></item>
		<item>
		<title>TokyoTyrant – MemcacheDB, but without the BDB?</title>
		<link>http://feedproxy.google.com/~r/Fewbarcom-technology-life-humor/~3/LrxzHeJGR70/</link>
		<comments>http://fewbar.com/2009/06/tokyotyrant-memcachedb-but-without-the-bdb/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 06:40:26 +0000</pubDate>
		<dc:creator>clint</dc:creator>
				<category><![CDATA[Memcache]]></category>
		<category><![CDATA[Scalability]]></category>
		<category><![CDATA[benchmarks]]></category>
		<category><![CDATA[drizzle]]></category>
		<category><![CDATA[memcachedb]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[tokyocabinet]]></category>
		<category><![CDATA[tokyotyrant]]></category>

		<guid isPermaLink="false">http://fewbar.com/?p=85</guid>
		<description><![CDATA[Anyway, the next thing I mentioned was that we had also tried MemcacheDB with some success. Brian wasn't exactly impressed with MemcacheDB, and immediately suggested that we should be using <a href="http://tokyocabinet.sourceforge.net/tyrantdoc/">Tokyo Tyrant</a> instead. I had heard of Tokyo Cabinet, the new hotness in local key/value storage and retrieval, but what is this Tyrant you speak of?]]></description>
			<content:encoded><![CDATA[<p>This past April I was riding in a late model, 2 door rental car with an interesting trio for sure. On my right sat <a href="http://capttofu.livejournal.com/">Patrick Galbraith</a>, maintainer of DBD::mysql and author of the Federated storage engine. Directly in front of me manning the steering wheel (for those of you keen on spatial description, you may have noted at this point that its most likely I was seated in the back, left seat of a car which is designed to be driven on the right side of the road. EOUF [end of useless fact]), David Axmark, co-founder of MySQL. Immediately to his right sat <a href="http://krow.net/">Brian Aker</a>, of (most recently) Drizzle fame.<br />
<span id="more-85"></span><br />
This was one of those conversations that I felt grossly unprepared for. It was the 2009 MySQL User&#8217;s conference, and  Patrick and I had been hacking on <a href="https://launchpad.net/dbd-drizzle">DBD::drizzle</a> for most of the day. We had it 98% of the way there and were in need of food, so we were joining the Drizzle dev team for gourmet pizza.</p>
<p>As we navigated from the Santa Clara conference center to Mountain View&#8217;s quaint downtown, Brian, Patrick, and I were discussing memcached stuff. I mentioned <a href="http://fewbar.com/2008/12/memcached-and-mogile-form-memcachemegazord/">my idea, and subsequent implementation of the Mogile+Memcached method for storing data more reliably</a> in memcached. I knew in my head why we had chosen to read from all of the replica servers, not just the first one that worked, but I forgot (The reason, btw, is that if one of the servers had missed a write for some reason, you might get out-of-date data). I guess I was a little overwhelmed by Brian&#8217;s mountain of experience w/ memcached.</p>
<p>Anyway, the next thing I mentioned was that we had also tried MemcacheDB with some success. Brian wasn&#8217;t exactly impressed with MemcacheDB, and immediately suggested that we should be using <a href="http://tokyocabinet.sourceforge.net/tyrantdoc/">Tokyo Tyrant</a> instead. I had heard of Tokyo Cabinet, the new hotness in local key/value storage and retrieval, but what is this Tyrant you speak of?</p>
<p>I&#8217;ve been playing with Tokyo Tyrant ever since, and advocating for its usage at Adicio. Its pretty impressive. In addition to speaking memcached protocol, it apparently speaks HTTP/WEBDAV  too. The ability to select hash, btree, and a host of other options is nice, though I&#8217;m sure some of these are available as obscure options to berkeleydb as well.</p>
<p>Anyway, I was curious what performance was like, so I did some tests on my little Xen instance, and came up with pretty graphs.</p>
<p><a href="http://fewbar.com/wp-content/uploads/2009/06/tokyotyrantvsmemcachedb1.gif"><img src="http://fewbar.com/wp-content/uploads/2009/06/tokyotyrantvsmemcachedb1.gif" alt="tokyotyrantvsmemcachedb1" title="tokyotyrantvsmemcachedb1" width="465" height="472" class="alignnone size-full wp-image-92" /></a></p>
<p>I used the excellent <a href="http://code.google.com/p/brutis/">Brutis</a> tool to run these benchmarks using the most interesting platform for me at the moment.. which would be, php with the pecl Memcache  module.</p>
<p>These numbers were specifically focused on usage that is typical to MemcacheDB. A wide range of keys (in this case, 10000 is &#8220;wide&#8221; since the testing system is very small), not-small items (2k or so), and lower write:read ratio (1:50). I had the tests restart each daemon after each run, and these numbers are the results of the average of 3 runs each test.</p>
<p>I also tried these from another xen instance on the same LAN, and things got a lot slower. Not really sure why as latency is in the sub-millisecond range.. but maybe Xen&#8217;s networking just isn&#8217;t very fast. Either way, the numbers for each combination didn&#8217;t change much.</p>
<p>What I find interesting is that memachedb in no-sync mode actually went faster than memached. Of course, in nosync mode, memcachedb is just throwing data at the disk. It doesn&#8217;t have to maintain LRU or slabs or anything.</p>
<p>Tokyo Tyrant was very consistent, and used *very* little RAM in all instances. I do recall reading that it compresses data. Maybe thats a default? Anyway, tokyo tyrant also was the most CPU hungry of the bunch, so I have to assume having more cores might have resulted in much better results.</p>
<p>I&#8217;d like to get together a set of 3 or 4 machines to test multiple client threads, and replication as well. Will post that as part 2 when I pull it together. For now, it looks like.</p>
<p>In case anybody wants to repeat these tests, I&#8217;ve included <a href="http://spamaps.org/files/tt-mdb-memcache-tests.tgz">the results, and the scripts used to generate them in this tarball</a>.</p>
<p>&#8211; Additional info, 6/4/2009<br />
Another graph that some might find interesting, is this one detailing CPU usage. During all the tests, brutis used about 60% of the CPU available on the machine, so 40% is really 100%:</p>
<p><a href="http://fewbar.com/wp-content/uploads/2009/06/tokyotyranttests_cpu.gif"><img src="http://fewbar.com/wp-content/uploads/2009/06/tokyotyranttests_cpu.gif" alt="tokyotyranttests_cpu" title="tokyotyranttests_cpu" width="428" height="385" class="alignnone size-full wp-image-98" /></a></p>
<p>This tells me that the CPU was the limiting factor for Tokyo Tyrant, and with a multi-core machine, we should see huge speed improvements. Stay tuned for those tests!</p>

<p><a href="http://feedads.g.doubleclick.net/~a/UqfUpplGuWuvs4Q3mUNXO6IS5Sc/0/da"><img src="http://feedads.g.doubleclick.net/~a/UqfUpplGuWuvs4Q3mUNXO6IS5Sc/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/UqfUpplGuWuvs4Q3mUNXO6IS5Sc/1/da"><img src="http://feedads.g.doubleclick.net/~a/UqfUpplGuWuvs4Q3mUNXO6IS5Sc/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Fewbarcom-technology-life-humor/~4/LrxzHeJGR70" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fewbar.com/2009/06/tokyotyrant-memcachedb-but-without-the-bdb/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://fewbar.com/2009/06/tokyotyrant-memcachedb-but-without-the-bdb/</feedburner:origLink></item>
		<item>
		<title>Parallel mysql replication?</title>
		<link>http://feedproxy.google.com/~r/Fewbarcom-technology-life-humor/~3/2OOlNJhKJ9A/</link>
		<comments>http://fewbar.com/2009/06/parallel-mysql-replication/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 19:08:48 +0000</pubDate>
		<dc:creator>clint</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Scalability]]></category>
		<category><![CDATA[drizzle]]></category>
		<category><![CDATA[parallelism]]></category>
		<category><![CDATA[replication]]></category>

		<guid isPermaLink="false">http://fewbar.com/?p=80</guid>
		<description><![CDATA[Its always been a dream of mine. I&#8217;ve posted about parallel replication on Drizzle&#8217;s mailing list before. I think when faced with the problem of a big, highly concurrent master, and scaling out reads simply with lower cost slaves, this is going to be the only way to go.
So today I was really glad to [...]]]></description>
			<content:encoded><![CDATA[<p>Its always been a dream of mine. I&#8217;ve <a href="https://lists.launchpad.net/drizzle-discuss/msg03988.html">posted about parallel replication</a> on Drizzle&#8217;s mailing list before. I think when faced with the problem of a big, highly concurrent master, and scaling out reads simply with lower cost slaves, this is going to be the only way to go.</p>
<p>So today I was really glad to see that somebody is trying out the idea. Seppo Jaakola from <a href="http://www.codership.com/">&#8220;Codership&#8221;</a>, who I&#8217;ve never heard of before today, <a href="https://lists.launchpad.net/drizzle-discuss/msg04214.html">posted a link</a> to an article on his blog about his <a href="http://www.codership.com/content/parallel-applying">experimentation with parallel replication slaves</a>. The findings are pretty interesting.<br />
<span id="more-80"></span><br />
I hope that he&#8217;ll be able to repeat his tests with a real world setup. The software they&#8217;ve written seems to have the right idea. The biggest issue I have with the tests is that  the tests were run on tiny hardware. Hyperthreading? Single disks? Thats not really the point of having parallel replication slaves.</p>
<p>The idea is that you have maybe a gigantic real time write server for OLTP. This beast may have lots of medium-power CPU cores, and an obscene amount of RAM, and a lot of battery backed write cache for writes.</p>
<p>Now you know that there are tons of reads that shouldn&#8217;t ever be done against this server. You drop a few replication slaves in, and you realize that you need a box with as much disk storage as your central server, and probably just as much write cache. Pretty soon scaling out those reads is just not very cost effective.</p>
<p>However, if you could have lots of CPU cores, and lots of cheap disks, you could dispatch these writes to be done in parallel, and you wouldn&#8217;t need expensive disk systems or lots of RAM for each slave.</p>
<p>So, the idea is not to make slaves faster in a 1:1 size comparison. Its to make it easier for a cheap slave to keep up with a very busy, very expensive master.</p>
<p>I do see where another huge limiting factor is making sure things synchronize in commit order. I think thats an area where a lot of time needs to be spent on optimization. The order should already be known so that the commiter thread is just waiting for the next one in line, and if the next 100 are already done it can just rip through them quickly, not signal them that they can go. Something like this seems right:</p>
<p><code><br />
id=first_commit_id();<br />
while(wait_for_commit(id)) {<br />
  commit(id);<br />
  id++;<br />
}<br />
</code></p>
<p>I applaud the efforts of Codeship, and I hope they&#8217;ll continue the project and maybe ship something that will rock all our worlds.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/df7YqZabIctqbbvd1txuwtOzr44/0/da"><img src="http://feedads.g.doubleclick.net/~a/df7YqZabIctqbbvd1txuwtOzr44/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/df7YqZabIctqbbvd1txuwtOzr44/1/da"><img src="http://feedads.g.doubleclick.net/~a/df7YqZabIctqbbvd1txuwtOzr44/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Fewbarcom-technology-life-humor/~4/2OOlNJhKJ9A" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fewbar.com/2009/06/parallel-mysql-replication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://fewbar.com/2009/06/parallel-mysql-replication/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic Page Served (once) in 1.371 seconds --><!-- Cached page served by WP-Cache -->
