Nelz's Blog

Mah blogginess

Working With Amazon SimpleDB

At Widgetbox I’ve been playing with Amazon SimpleDB to implement some features that we’ll be releasing soon. I wanted to share some of my impressions with you, but another blogger has already posted a great writeup at http://www.royans.net/arch/2009/02/28/experimenting-with-simpledb-flagthiscom/. However, I’ll add my $.02 contribution to what he posted.

1 (“Its not a relational database.”) is very, very important. You’ve really got to stretch your brain a bit to get out of the RDBMS headspace to see how it can be beneficial. Everything is stored as a string, so if you want to any kind of sorting with regards to numbers or dates, you have to format the values to be sorted lexicographically. (This reminds me of when I was working with Lucene.)

In addition to not having any kind of auto-increment (as mentioned in that blogs #5 point), there is no concept of an “increment” operation on a field. At first I was tempted to try for a Read-Increment-Update pattern, but if you think of how that would interact with Amazon’s concept of Eventual Consistency (which, for some inexplicable reason, I find absolutely hilarious), you will realize this is a sub-optimal pattern for data integrity. (The pattern I ended up using lends itself only to the specific interaction patterns I am designing for, so I won’t bore you with the details.)

Though there is no auto-increment, many blog posts have been published recommending UUID’s, which seems to be working for me as well.

As for that blogs #8 point, there is now a offered called Javascript Scratchpad for Amazon SimpleDB, which is just a small set of HTML/JS pages that you save locally and run in a browser. I think it’s actually a pretty cool lightweight and simple GUI tool to offer.

Looking at the price list, you might think that SimpleDB could get expensive fast. But, if you read carefully you’ll see the following: “Data transferred between Amazon SimpleDB and other Amazon Web Services within the same region is free of charge (i.e., $0.00 per GB).” That’s pretty cool. As long as whatever is hitting your SimpleDB instance resides on the Amazon cloud (in the same region), you don’t pay for data transfer.

I also gotta comment on the Java client provided by Amazon. Yeah, it works, but working with it is fairly “meh”. You get the source an everything for it, but it’s not Open Source and they definitely don’t give the impression that they’re looking for any contributions. I would’ve submitted a couple of lines of documentation for some of the methods at the very least.

I’ve heard some good things about the typica library, specifically that the interaction patterns with the library are nicer than the Amazon-provided library. There only seems to be one (maybe two?) developer working on it, but at least it’s hosted on Google Code so, unlike Amazon, maybe the developer would welcome contributions.

I haven’t used typica myself yet, but since I’m not too far down the other path, maybe I’ll check it out.