<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Roger Hoover on Medium]]></title>
        <description><![CDATA[Stories by Roger Hoover on Medium]]></description>
        <link>https://medium.com/@thedude_rog?source=rss-9a42aa05d220------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*j4tjoQFb6C1I7FYQ-lWjFA.jpeg</url>
            <title>Stories by Roger Hoover on Medium</title>
            <link>https://medium.com/@thedude_rog?source=rss-9a42aa05d220------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 04:12:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@thedude_rog/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Druid vs OpenTSDB]]></title>
            <link>https://medium.com/@thedude_rog/druid-vs-opentsdb-6ba135bf2af8?source=rss-9a42aa05d220------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ba135bf2af8</guid>
            <dc:creator><![CDATA[Roger Hoover]]></dc:creator>
            <pubDate>Tue, 13 Jan 2015 19:16:51 GMT</pubDate>
            <atom:updated>2015-01-13T19:25:40.764Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Disclaimers: a) I haven’t actually benchmarked these b) I’m not an expert on either system so there could be inaccuracies</em></p><p>I’ve read that <a href="http://druid.io/">Druid</a> out performs <a href="http://opentsdb.net/">OpenTSDB</a> for queries, especially as the number of dimensions grows. Why is this so?</p><p>TL;DR: HBase is optimized for low-latency writes, point reads and small scans, not for aggregating billions of rows. Druid is optimized for filtering and aggregation.</p><p>OpenTSDB <a href="http://opentsdb.net/docs/build/html/user_guide/backends/hbase.html">stores metrics in sorted order by metricname,time,[tags]</a>. To filter and aggregate, it needs to scan all row keys in the time interval, parse the tags to see if they match the filter criteria, and perform the aggregation on the column data. If we’re lucky, the data is already resident in the <a href="http://hortonworks.com/blog/hbase-blockcache-101/">block cache</a>. <a href="http://hbase.apache.org/book.html#client.filter">Filtering can be done on the region server</a> but all data passing the filters must be sent to the query client for aggregation (I don’t think co-processors are <a href="https://groups.google.com/forum/#!msg/opentsdb/Oab7bPSWcfs/tZyDcjsAMx8J">flexible enough to be applied per query</a>). Also, because HBase has a Log-Structured Merge architecture, queries for newer data may be slower as the RegionServer may have to scan and merge data from the memtable and multiple HFiles.</p><p>Druid stores metrics in column format as well, applying compression like LZF, and ideally keeps all the data in memory. It also keeps bitmaps indexes for dimensions that it can use <a href="http://lemire.me/blog/archives/2013/12/23/even-faster-bitmap-decoding/">to efficiently pick out only the rows it needs to read</a>. Filtering is fast because bitwise boolean logic can be used on the entire vector at once. Aggregation is fast in Druid because it only reads the data that’s needed and divides the aggregation work amongst all the nodes serving the query. Only the partial aggregates need to be combined at the broker node.</p><p>Since HBase is strongly consistent and optimized for writes, data is only served from a single region server. You cannot scale up the query capacity for a given shard beyond dedicating an entire RegionServer to it. Druid, on the other hand, treats shards (called segments) as immutable and can replicate them to as many historical nodes as needed to achieve the desired query concurrency and throughput.</p><p>In Druid, since metrics are grouped into datasources, if you run a query that aggregates multiple metrics, the filtering computation can be shared. OpenTSDB would require two separate queries, both doing scanning and filtering.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ba135bf2af8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Camus Gotchas]]></title>
            <link>https://medium.com/@thedude_rog/camus-gotchas-b8ecebc08645?source=rss-9a42aa05d220------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8ecebc08645</guid>
            <dc:creator><![CDATA[Roger Hoover]]></dc:creator>
            <pubDate>Wed, 27 Nov 2013 01:41:06 GMT</pubDate>
            <atom:updated>2013-12-10T00:17:28.535Z</atom:updated>
            <content:encoded><![CDATA[<h4>Leveraging LinkedIn’s Kafka to Hadoop ETL tool</h4><p><a href="http://engineering.linkedin.com/">LinkedIn</a> has been making significant contributions to the Open Source community, including <a href="https://kafka.apache.org/">Apache Kafka</a>, <a href="http://www.project-voldemort.com/voldemort/">Voldemort</a>, <a href="http://samza.incubator.apache.org/">Apache Samza</a>, and <a href="http://data.linkedin.com/opensource">more</a>. Recently, they’ve open-sourced their <a href="https://github.com/linkedin/camus">ETL job</a>, called Camus, which batch imports data from Kafka into Hadoop. It has some great features like automatic topic discovery, Avro schema management, date partitioning, and fault tolerance.</p><p>I’m very grateful for this project. It has saved me a lot of effort. However, there are still some rough edges. These are the things I’ve run into so far that might save you some grief. I’m using Kafka 0.8.0-beta1 and Avro for serialization.</p><h4>Schema Registry</h4><p>The SchemaRegistry.register() API should be globally idempotent. If the same schema is added to the registry more than once from any JVM process, it should return the same schema id. This requirement is not stated anywhere but the <a href="https://github.com/linkedin/camus/blob/master/camus-etl-kafka/src/main/java/com/linkedin/camus/etl/kafka/coders/KafkaAvroMessageEncoder.java#L69-L80">default message encoder assumes that it can safely auto-register any schema that it hasn’t seen before</a>. The current <a href="https://github.com/linkedin/camus/blob/master/camus-schema-registry/src/main/java/com/linkedin/camus/schemaregistry/MemorySchemaRegistry.java">MemorySchemaRegistry</a> implementation (intended as a toy demo) <a href="https://github.com/linkedin/camus/issues/36">is not idempotent</a>, which can trip you up when you’re trying to get started.</p><p>A <a href="https://github.com/linkedin/camus/pull/39">simple solution</a> is to use <a href="http://avro.apache.org/docs/1.7.5/api/java/org/apache/avro/SchemaNormalization.html#parsingFingerprint64%28org.apache.avro.Schema%29">Avro Fingerprints</a> but that requires that schema ids be able to hold 64-bit values. Unfortunately, the default message encoding assumes integer (32-bit) schema ids (more on this below).</p><h4>Message Encoding/Decoding</h4><p>The default messaging encoding for Kafka and Avro <a href="https://github.com/linkedin/camus/blob/master/camus-etl-kafka/src/main/java/com/linkedin/camus/etl/kafka/coders/KafkaAvroMessageEncoder.java#L82">assumes that schema ids are integer (32-bit) values</a>. If your schema ids are bigger than 32 bits, you’ll need to write your own encoder and decoder and there isn’t a great way to share the 90+% of the code that you’ll want to leverage from the default implementation.</p><h4>Partitioner API</h4><p>What if you want to override the default path conventions for HDFS? No worries, Camus allows you to plugin your own <a href="https://github.com/linkedin/camus/blob/master/camus-api/src/main/java/com/linkedin/camus/coders/Partitioner.java">Partitioner</a>. Problem solved, right?</p><p>Not so fast! If you need to use data from the message to construct the HDFS path, it requires a few awkward steps.</p><ul><li>First, in your message decoder, extract the data you need from the message and put it into a <a href="http://hadoop.apache.org/docs/current/api/org/apache/hadoop/io/MapWritable.html">MapWritable</a> on the <a href="https://github.com/linkedin/camus/blob/master/camus-api/src/main/java/com/linkedin/camus/coders/CamusWrapper.java">CamusWrapper</a>. The framework will add this to an ETLKey that will get passed to your partitioner.</li><li>Strangely, the ETLKey is only passed to one of the methods of your partitioner and not the one where you construct the HDFS path. To get around this, you have to extract the data in the <a href="https://github.com/linkedin/camus/blob/master/camus-api/src/main/java/com/linkedin/camus/coders/Partitioner.java#L22">encodePartition() method</a>, encode it as a string, and decode it in the <a href="https://github.com/linkedin/camus/blob/master/camus-api/src/main/java/com/linkedin/camus/coders/Partitioner.java#L40">generatePartitionedPath() method</a>. Not just any string encoding will do. The encoding must conform to some <a href="https://github.com/linkedin/camus/blob/master/camus-api/src/main/java/com/linkedin/camus/coders/Partitioner.java#L9-L10">documented</a> and some <a href="https://github.com/linkedin/camus/issues/40">additional undocumented assumptions</a>.</li></ul><h4>Kafka 0.8.x</h4><p>Use <a href="https://github.com/linkedin/camus/tree/camus-kafka-0.8">this branch</a> with Kafka 0.8.x.</p><h4>Build Dependencies</h4><p>If you want your own project to depend on Camus, you can probably include it’s source in your project using git submodules or you can publish it to your own Maven repository. We setup an internal <a href="http://archiva.apache.org/">Archiva</a> instance and published camus artifacts to it. However, the camus build has two dependent jars bundled into it so you’ll need to publish those to your Archiva instance as well.</p><pre>mvn deploy:deploy-file -DpomFile=lib/avro-repo-bundle-1.7.4-SNAPSHOT-withdeps.xml -Dfile=lib/avro-repo-bundle-1.7.4-SNAPSHOT-withdeps.jar -DrepositoryId=&quot;your-repo.snapshots&quot; -Durl=&quot;http://your-achiva-host:8070/archiva/repository/snapshots/&quot;</pre><pre>mvn deploy:deploy-file -DpomFile=lib/kafka-0.8-SNAPSHOT.xml -Dfile=lib/kafka-0.8-SNAPSHOT.jar -DrepositoryId=&quot;your-repo.snapshots&quot; -Durl=&quot;http://your-achiva-host:8070/archiva/repository/snapshots/&quot;</pre><h4>Configuration</h4><p>There are a lot of properties you can configure and most of them are not documented. You’ll have to look at the source code.</p><h4>Embedding The Producer</h4><p>When you embed the <a href="https://github.com/linkedin/camus/blob/camus-kafka-0.8/camus-etl-kafka/src/main/java/com/linkedin/camus/etl/kafka/coders/KafkaAvroMessageEncoder.java">KafkaAvroMessageEncoder</a> class in your application as a producer to the Camus, you may run into some dependency issues. In particular, let’s say you have a RESTful API that takes messages over HTTP and enqueues them to Kafka. If you build an uber war file that includes all the Camus dependencies, it will include <a href="http://search.maven.org/#artifactdetails%7Corg.apache.hadoop%7Chadoop-core%7C1.0.3%7Cjar">hadoop-core</a>. By default, Jetty will scan all dependent jars in the war file and read any WEB-INF/web.xml files that it finds.</p><pre>$ jar tf repository/org/apache/hadoop/hadoop-core/1.0.3/hadoop-core-1.0.3.jar | grep web.xml<br>webapps/datanode/WEB-INF/web.xml<br>webapps/hdfs/WEB-INF/web.xml<br>webapps/history/WEB-INF/web.xml<br>webapps/job/WEB-INF/web.xml<br>webapps/task/WEB-INF/web.xml</pre><p>If you decompile the classes that get loaded by the web apps in hadoop-core, you’ll see they are referring to an old version of Jersey (when it was still com.sun.jersey instead of org.glassfish.jersey).</p><pre>javap ./org/apache/hadoop/hdfs/web/resources/UserProvider.class | grep jersey<br> public com.sun.jersey.spi.inject.Injectable getInjectable(com.sun.jersey.core.spi.component.ComponentContext, java.lang.annotation.Annotation, java.lang.Object);</pre><p>This will cause a ClassNotFoundException for com.sun.jersey.spi.inject.InjectableProvider unless you tell Jetty not to include any WEB-INF dirs from included jars by setting the <a href="http://www.eclipse.org/jetty/documentation/current/configuring-webapps.html#web-inf-include-jar-pattern">WebInfIncludeJarPattern</a> so it won’t match anything (e.g. “none”).</p><pre>&lt;Configure class=&quot;org.eclipse.jetty.webapp.WebAppContext&quot;&gt;<br> &lt;Set name=”contextPath”&gt;/&lt;/Set&gt;<br> &lt;Set name=”war”&gt;/path/to/war&lt;/Set&gt;<br> &lt;Call name=&quot;setAttribute&quot;&gt;<br> &lt;Arg&gt;org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern&lt;/Arg&gt;<br> &lt;Arg&gt;none&lt;/Arg&gt;<br> &lt;/Call&gt;<br>&lt;/Configure&gt;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8ecebc08645" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Running Kafka in a Hybrid Cloud Environment]]></title>
            <link>https://medium.com/@thedude_rog/running-kafka-in-a-hybrid-cloud-environment-17a8f3cfc284?source=rss-9a42aa05d220------2</link>
            <guid isPermaLink="false">https://medium.com/p/17a8f3cfc284</guid>
            <dc:creator><![CDATA[Roger Hoover]]></dc:creator>
            <pubDate>Tue, 19 Nov 2013 03:59:48 GMT</pubDate>
            <atom:updated>2013-11-19T03:59:48.275Z</atom:updated>
            <content:encoded><![CDATA[<h4>New configuration options coming in Kafka 0.8.1</h4><p>With <a href="http://kafka.apache.org/">Kafka</a> 0.8.0, if you deploy brokers in a cloud environment, you can run into trouble configuring clients that are not in the same cloud environment. This article describes changes coming in Kafka 0.8.1 to address this.</p><p><strong><em>Why do you need clients outside the cloud environment of the broker?</em></strong></p><ul><li>You may want to setup Kafka replication using the <a href="https://cwiki.apache.org/confluence/display/KAFKA/Kafka+mirroring+(MirrorMaker)">MirrorMaker tool</a>.</li><li>You may have systems in an existing data center that need to publish to a Kafka cloud deployment.</li></ul><p><strong><em>What’s the issue?</em></strong></p><p>Most often with on-demand compute systems such as <a href="http://aws.amazon.com/ec2/">EC2</a> and <a href="http://www.openstack.org/">OpenStack</a>, virtual machines only see their private IP addresses (typically in an <a href="https://tools.ietf.org/html/rfc1918">RFC 1918</a> address space) which are not reachable from the outside. With OpenStack, you can assign “floating IPs” (Elastic IPs on EC2) to a virtual machine which forwards traffic to the VM but does not expose the IP as an interface that the VM can bind to.</p><p>As shown below, what you want is for external clients to use the floating IP to connect to the broker and for the broker itself to bind it’s private “fixed IP”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QYoyMni9S-ckamoLofrSqg.png" /><figcaption>A Kafka deployment spanning more than one cloud</figcaption></figure><p>The reason this doesn’t work for Kafka 0.8.0 is that a single configuration parameter is used both for binding a socket on the broker and for advertising the broker in ZooKeeper for clients to discover.</p><p>With <a href="https://issues.apache.org/jira/browse/KAFKA-1092">this patch</a>, which will be included in the Kafka 0.8.1 release, these two settings can now be configured independently.</p><pre>host.name=&lt;fixed IP&gt;<br>advertised.host.name=&lt;floating IP&gt;</pre><p>The <strong><em>host.name</em></strong> parameter configures the interface that the broker will bind to. If not set, the server will bind to all interfaces on the VM.</p><p>The <strong><em>advertised.host.name</em></strong> parameter specifies the hostname the broker will advertise to producers and consumers. If not set, it uses the value of <strong><em>host.name </em></strong>if set; otherwise it uses the hostname of the VM.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17a8f3cfc284" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>