Meeting20120602: slides.rst

File slides.rst, 1.7 KB (added by hodgestar, 12 years ago)

Riak ORM talk slides (source, equally minimal)

Building an ORM for Riak

Author: Simon Cross
Date: 2 June 2012

What is Riak?

images/riak-transparent-small.png
  • A key/value store (a GIANT hash table)
  • A product of Basho (www.basho.com)
  • Apached licensed

Why Riak

  • Super easy to administer
  • Secondary indexes
  • Solr-like search interface
  • Map-reduce queries

Under the hood

  • The key space is a partitioned ring.
  • Vector clocks are used to determine ordering.
  • When conflicts arrise, keep both values.

Setting up Riak

Download package and install:

$ wget http://downloads.basho.com/riak/CURRENT/riak_1.1.2-1_i386.deb
$ sudo dpkg -i riak_1.1.2-1_i386.deb

Add another node:

$ riak-admin join riak@192.168.1.10

Tweaks for /etc/riak/app.config:

{riak_kv, [
  %% Switch to backend that supports indexes
  {storage_backend, riak_kv_eleveldb_backend}
  ...
  ]},

{riak_search, [
  %% To enable Search functionality
  {enabled, true}
  ]},

Why an ORM

  • Description of data
  • Ease of use

What we want this to look like

class Contact(Model):
    """A contact"""

    user_account = ForeignKey(UserAccount)
    name = Unicode(max_length=255, null=True)
    surname = Unicode(max_length=255, null=True)
    email_address = Unicode(null=True)
    msisdn = Unicode(max_length=255)
    created_at = Timestamp(default=datetime.utcnow)
    groups = ManyToMany(ContactGroup)

How we wrote it

  • Descriptors
  • Database engine
  • Supports both sync and async in one code-base!