OSCON 2010: Hands-on Cassandra

The second tutorial I attended on Tuesday, and the last one of the conference, was Hands-on Cassandra. Actually, I missed the first half of this tutorial, for reasons which I explain in my Tuesday recap post.

I’ve been told by those that attended the full tutorial that the first half wasn’t really worth attending. In fact, when I arrived at the beginning of the second half, I caught the tail end of the presenter demonstrating how he recreated Twitter using Cassandra, something he dubbed Twissandra. This seems to be the exercise of choice for any distributed system. In a way, that’s smart. Take a highly distributed system everyone is familiar with, explain the challenges faced by such a system, then demonstrate the effectiveness with which the software in question can solve the problem.

In any case, the second half of the tutorial was mostly dedicated to an explanation of how Cassandra distributes its data. The details and, frankly, the delivery weren’t that interesting for me, so I didn’t follow the discussion. It was too high level to keep my interest.

I still think that Cassandra is deserving of some investigation. I have a project in mind that it may be perfect for. At my day job, we have what is essentially a distributed, key-based data store. We’ve had to implement all of the data replication functionality. If Cassandra can alleviate the need to design and implement our own data replication and integrity systems, we can put more effort into the final delivery of the data, instead of its transmission.

OSCON 2010: PostgreSQL Reloaded

The full title of this session is PostgreSQL Reloaded – Hot Standby, Streaming Replication & More! It was presented by Chander Ganesan, who, even before the tutorial started, demonstrated his skill as a presenter. Reading his biography, I noted that he appears to be a professional trainer, which is a nice sign. He started out by waiting for a whiteboard to be delivered. Good! That means pictures will be drawn and audience interaction may take place. I really appreciate his dynamic personality and presenting style. Having gotten little sleep the night before, he was able to keep me awake and focused.

Unlike Monday, I chose tutorials on Tuesday that held some relevance to the work I’m doing. At my day job, we have a MySQL database backing a critical production system. We have spent years fighting with it and dealing with its failures and instability. I have a bias towards PostgreSQL, having used it in the past, and finding it a superior database to MySQL. That, however, is beside the point. What is pertinent is that I have been considering a complete redesign of the system, using PostgreSQL as the data source, and a tutorial on the built-in standby and replication capabilities coming with the release of PostgreSQL 9.0 is timely.

The slides for this tutorial were distributed to us when we registered. They are intended to stand on their own, serving as documentation if we later work on implementing the concepts presented here. That said, the information density of the slides didn’t at all detract from the presentation. As a hands-on demonstration, Chander didn’t project the slides very often and, when he did, only referenced them as he spent time explaining the material.

In order to better understand how PostgreSQL implements hot standby and replication, Chander first gave us an overview of how PostgreSQL manages the data a database. I’ll be brief, so this is probably not entirely correct. For efficiency, data is manipulated in 8 kilobyte pages stored in memory, in what is called the shared buffer pool. These pages remain in memory until the pool is exhausted, at which point one or ore infrequently used pages will have any changes written to disk and purged from the pool. This means that while the updates are stored in the pool, there is a (potentially long) window of time in which a crash will cause data loss. To prevent data loss, all update operations are first written to the write-ahead log (WAL) files. During a recovery operation, these WAL files can be used to play back any transactions that were lost in the crash.

Having these WAL files means that, from a given point in time, the database can be reconstructed. It’s not a stretch to shift the playback of these WAL files into real time on a secondary system. This automatically creates the possibility of a live replicated database, which can be queried in place of the primary database.

The rest of the tutorial was devoted to demonstrating how to set up and use warm standby databases, hot standby databases, and streaming replication.

OSCON 2010: Get Started with the Arduino

Arduino and BreadboardThe second tutorial I attended at OSCON on Monday was one I had regrettably skipped when I was last here in 2008: Get Started with the Arduino.  After purchasing my Getting Started with Arduino Kit for $69.95, I tore it open like a kid in a toy store.  Inside the kit were the Arduino board itself, some jumper wires, a handful of components, including LED bulbs and resistors, and a USB cable to allow for programming the notebook computers everyone in attendance brought with them.

In the beginning, I was shamed.  While I tried and failed to follow the Linux installation instructions, my coworker, Debbie, was able to plug my Arduino board into her Microsoft Windows notebook and get the first example running.  When the udev tip didn’t work, things were looking bleak for my attempt to control open hardware with an open operating system.  Finally, a trip to Google landed me right back on the Arduno wiki at the installation instructions for Fedora.  Finally, I could upload code to my Arduino board.  After getting the initial example to work, I modified it to change the pattern of the blinking on-board LED bulb:

int ledPin = 13;

void setup() {
    pinMode(ledPin, OUTPUT);
}

void loop() {
    digitalWrite(ledPin, HIGH); delay(300);
    digitalWrite(ledPin, LOW);  delay(300);
    digitalWrite(ledPin, HIGH); delay(300);
    digitalWrite(ledPin, LOW);  delay(300);
    digitalWrite(ledPin, HIGH); delay(1000);
    digitalWrite(ledPin, LOW);  delay(1000);
}

While we were playing with our new toys, we were treated to the history of the Arduino project, some other open hardware projects, and some of the things people have done with them.  Unfortunately, I was too busy playing with my new toy to take notes on these things, so the history lesson, by way of Wikipedia, is left as an exercise for the reader.

The editor embedded in the Arduino IDE leaves a lot to be desired.  It’s like Microsoft Notepad with syntax coloring.  My coworker found a setting that forces the IDE to use an external editor.  Basically, all it does is to make the editing window read-only.  Files edited outside of the IDE are re-read when the code is compiled.  In short order, I was able to find a Vim syntax file for Arduino code files.

After the break, we were introduced to using the Arduino board in combination with a breadboard, which allows for the creation of more complex circuits.  I’m excited, because I still have the breadboard, components, and multi-meter I bought in college for a computer engineering class.  I’ve been waiting all these years to finally have an excuse to dig them out of the closet and put them to use.  The Arduino will be a fun learning tool when my daughter is older, too.

To commence our unstructured time, which would last until the end of the tutorial (and the day), we were shown a simple circuit to wire up between the Arduino board and the breadboard.  Using a copy of the first blinking code, we could acheive the same effect of blinking the external LED simply by modifying which pin was referenced.  I took this a step further and made my LED bulb pulse like the light on a suspended MacBook.

I’m glad I decided to attend the Arduino tutorial this year. I’ve just picked up yet another hobby I don’t have time for.

OSCON 2010: Introduction to 3D Animation with Blender

The first tutorial I chose to attend this year at OSCON was Introduction to 3D Animation with Blender.  It was something I wanted to attend for fun instead of for work.  The instructor was Matthew Momjian, a 17 year old high school student who has been using Blender for four years.  His experience with the software showed, too.

The version of Blender available in the Fedora 13 package repository is 2.49b, but the tutorial focused on the beta version of 2.5, which has a redesigned user interface and new and improved features.  A Linux version was available on the internal cache website offered by OSCON, but it was 32 bit.  I ended up downloading a copy from the Blender website (the conference wifi doesn’t start to get really bad until Wednesday).  Unfortunately, Blender proved unstable and would frequently crash with a segmentation fault.  Matthew had provided files to serve as starting points for each section of the tutorial, so it was relatively easy to follow along, even if I didn’t complete the previous section.

Matthew walked us through generating a simple animation of a flying saucer approaching a planet and hitting it with a beam of light.  We started with simple shapes, two spheres, one flattened, for the saucer, a cone for the beam of light, and another sphere for the planet.  From there we learned how to apply surfaces and textures, manipulate light sources, and perform a simple animation.

All in all, I think the tutorial was worthwhile.  If I had launched Blender without it, I would be lost.  I’m still lost, but at least I have some semblance of an idea about how it works.