arrow_backward Back to blog

Introducing Oria

Oria (oh-rye-uh) is an in-memory, Ruby-based, zero-configuration key-value store. For those of you who don’t know, a key-value store (KVS) is a database-like piece of software that effectively behaves like a Hash in Ruby – you store values under unique keys and retrieve them later. One of the big benefits of this model over relational databases is that you can store arbitrarily structured data without the overhead of a SQL-based server.

I built Oria because I needed a semi-persistent store that spoke JSON and was reasonably fast, but I didn’t want my applications to rely on complex server-side applications. It is written in Ruby in a bid to make it dead simple to use. That means you can use it like Memcached or Redis without having to compile, manage, or monitor any processes. It’s very straightforward:

  1. Install it:
    gem install oria —source
  2. Require it:
    require “oria”
  3. Use it:
    Oria[:foo] = {:bar => "baz"}

You can store strings, hashes, integers, floats, booleans, and arrays. If you absolutely need marshaling, handle it on the client side:

 Oria[:foo] = Marshal.dump("baz")) bar = Marshal.restore(Oria[:foo]) 

But in general, I would encourage you to avoid using marshaling at all, and instead store the key attributes you need to keep track of, e.g.:

 Oria[:foo] = "baz" bar =[:foo]) 

Oria is different from other KVS’ in a few ways. First, it’s designed to provide the functionality available with other systems at a fraction of the server and maintenance cost. The zero-configuration setup means deploying, starting, and stopping all happen seamlessly. Second, Oria is built to be modestly performant. I’ve sacrificed the extreme performance gains from something like Tokyo Tyrant in order to provide something very easy to use. As a result, it’s not quite as full-featured as the alternatives in terms of networking or traffic capacity. Third, Oria’s persistence is modeled on Redis’- it writes asynchronously to the disk as it goes dormant (i.e. stops fielding requests). Unlike other KVS’, however, Oria is not fully persistent. Rebooting your server will completely clear Oria out, so it’s not intended as a permanent storage medium – just a well-performing, simple-to-configure, temporary data store.

You can learn more about Oria at its Github page.


New Project Request