Understanding Write Ahead Logging

I am trying to understand WAL (Write Ahead Logging) from the perspective of sqlite3, HBase etc. Below is a summary of my understanding. Refer to these links for more information: sqlite3, postgresql, sqlserver, hbase, bigtable. ###General stuff What is WAL Write new content of a write at end of a WAL file instead overwriting content in the actual database file Advantages of WAL Writes and reads are faster Writes and reads can be concurrent (for a given data file) More sequential disk I/O Fewer fsync() calls Allows crash recovery ###Sqlite3 ...

April 6, 2014 · 3 min · Bharath

Trying out spark streaming

I am playing with simple examples of spark streaming here and here. The flexibility of creating any number of separate dstreams, and calling updateStateByKey on any dstream is really nice. Here is a link to configure logging in a standalone spark program.

April 1, 2014 · 1 min · Bharath

Running Apache Spark on Apache Mesos (continued)

Continuing my failed attempt to run spark on mesos. @pacoid pointed me to a nice tutorial for this. Rest of this post is just documentation of my efforts. To spare you the pain of reading through all of this – it ends well. As of now I just want to run mesos properly. The test failures were due to the /vagrant directory usage. Basically I had synced the mesos source tree into /vagrant, which is shared between the host OS-X and the guest ubuntu-in-vagrant. It turns out that mmap(... MAP_SHARED ...) throws EINVAL when the file being mmaped is in /vagrant. This was causing leveldb’s MANIFEST file write to fail. This in turn caused all the mesos registrar tests and leveldb state tests to fail. So just moving the source tree from /vagrant to /home/vagrant solved the problem and allowed me to do a clean make check. :) ...

March 31, 2014 · 5 min · Bharath

Understanding Dremel

I am reading Google’s interesting paper on the dremel system. Below is a digest. Dremel is an scalable, interactive adhoc query system for analysis of read-only nested data. directly deals with nested data operates on commodity clusters uses serving tree like web search unlike pig/hive executes query natively without using MR uses columnar representation only relevant columns need to be read each column is better compressed this results in cpu, memory, iops, disk savings data model is same as that for protocol buffers new columnar representation for nested records fast record assembly algorithm using FSM and definition/repetition levels

March 29, 2014 · 1 min · Bharath

Understanding Millwheel

I am reading Google’s interesting paper on the millwheel system. Below is a digest. One time input to the system: computation graph, application code for nodes Ongoing stuff handled by the system: persistent state, streaming input The programming model provides: short term persistent storage long term persistent storage low watermark timestamp logical time out-of-order record processing exactly-once semantics for record processing. The persistent store is per-key per computation. So if there are 4 nodes in the computation DAG, there will be 4 “tables” with rows keyed on the key in the input record. Timers are based on low watermarks. The unique id which is used for ensuring exactly once semantics is assigned by the system and not by the user (not in the input). In a strong production, output data, state, timers – all are snapshotted in a single per-key per-computation atomic write. In a weak production, output data is sent forth optimistically assuming the receiver can ACK it quickly. A write sequencer is assigned to a lexicographic key interval of each computation. A sequencer ensures that older pending writes dont overwrite results of newer writes. Also the low watermarks are persisted for data consistency.

March 29, 2014 · 1 min · Bharath

Running Apache Spark on Apache Mesos

I am trying to run Apache Spark on Apache Mesos. I am following this tutorial. One problem I hit when trying to save the spark distribution on HDFS is: put: org.apache.hadoop.hdfs.server.namenode.SafeModeException: Cannot create /user/hduser/spark-1.0.0-SNAPSHOT-hadoop_1.0.4-bin.tar.gz. Name node is in safe mode. This was solved with: bin/hadoop dfsadmin -safemode leave While trying to build mesos I hit the following error: vagrant:/vagrant/mesos/build$ sudo apt-get install python-dev Reading package lists... Done Building dependency tree Reading state information... Done You might want to run 'apt-get -f install' to correct these: The following packages have unmet dependencies: python-dev : Depends: python2.7-dev (>= 2.7.3) but it is not going to be instal led scala : Depends: libjansi-java but it is not going to be installed E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a s olution). I was facing this error while doing different apt-get operations and I did not care too much till now. Now I was stumped. So finally ran apt-get -f install without any arguments. Then I could proceed with installing python-dev. Then I proceeded with building mesos. Build went fine. make check failed with the following error: ...

March 28, 2014 · 3 min · Bharath

Running Apache Spark examples

Apache Spark has a good set of examples to play with. But I could not figure out how to rerun the test by recompiling only that test. An entire sbt/sbt assembly will take ages and will preclude understanding modified examples within this lifetime. So a shorter route was necessary. The obvious sbt/sbt compile org.apache.spark.streaming.examples failed. Digging into the (slow as in molasses) output of sbt/sbt help showed sbt/sbt project to set the current project. Sidenote: Leaving a JVM running could not hurt the speed of sbt’s startup. End of Sidenote. Trying to set the current project to examples did not succeed. Wading through several error messages which mentioned ‘/’ as a special character did not help. ...

March 28, 2014 · 2 min · Bharath

Apache spark use cases

Here is a list of possible use cases for Apache spark. Mining logs for interesting patterns Text search (also web search)

March 26, 2014 · 1 min · Bharath

Big data processing toy example - Part 2

This is the second part of the blog series on big data processing. This will focus on doing some simple processing on a large dataset stored in HDFS. I have 300000 random integers stored in HDFS as a single shard in /user/hduser/random4 directory. val rdd4 = sc.hadoopFile("hdfs://vagrant-ubuntu-precise-64/user/hduser/random4") rdd4.partitions.size ###Problems encountered: The above snippet throws an exception: java.lang.RuntimeException: java.lang.InstantiationException at org.apache.hadoop.util.ReflectionUtils.newInstance (ReflectionUtils.java:115) at org.apache.spark.rdd.HadoopRDD.getInputFormat (HadoopRDD.scala:141) at org.apache.spark.rdd.HadoopRDD.getPartitions (HadoopRDD.scala:154) Checking the api reference for hadoopFile shows that some more arguments might be needed. Switching to sc.textFile solved the problem. ...

March 25, 2014 · 3 min · Bharath

Big data processing toy example - Part 1

This is the first part of the blog series on big data processing. This will focus on generating a large dataset. The idea is to generate a large dataset in a distributed way and write it to HDFS. Below is scala-spark snippet to generate lots of random integers and store them on HDFS. import util.Random val rdd = sc.parallelize(Seq.fill(100)(Random.nextInt)) rdd.saveAsTextFile("hdfs://vagrant-ubuntu-precise-64/user/hduser/random") ###Problems encountered The hostname was not really matching and spark-shell was throwing an EOFException. ...

March 25, 2014 · 3 min · Bharath