Basho Packages it's Riak Core for Distrubted App Developers

DZone 's Guide to

Basho Packages it's Riak Core for Distrubted App Developers

· Database Zone ·
Free Resource
The developers at Basho Technologies recently decided to take a useful piece of the Riak codebase and refractor it into its own codebase for easier usage.  Riak is a NoSQL key-value store with the additional ability to put links between the things you store and perform MapReduce queries.  Kevin Smith, a senior developer on the Basho team, explained that this the useful piece was the riak_core, which is an OTP application that provides the services required to easily write distributed applications.

The first feature in riak_core is the riak_core_node_watcher, which is responsible for checking the status of nodes within a riak_core cluster.  It can also take a node out of the cluster programmatically when, for example, there's a short required outage and you don't want to stop the server software.

A riak_core cluster stores the global state in a ring structure and the state information is transferred in such a way that all members stay in sync.  This is called "gossiping".  riak_core_ring is the module that creates and manipulates the state data while riak_core_ring_manager manages the cluster ring for a node.  riak_core_gossip manages the rings gossip.

A master/worker configuration is used on each node to manage work unit execution.  riak_core also uses consistent hashing to determine target nodes for requests.  The master process on each node farms out each request to worker processes called vnodes.  riak_core_vnode_master routes requests to the vnodes as they run after starting up the worker vnodes on a given node.  Finally, riak_core_vnode is an OTP behavior that wraps all the boilerplate logic required to implement a vnode.  

riak_core is currently available on GitHub and is licensed under the Apache v2 license.  Over the next few months Smith will blog about the process by which you can build a distributed graph database using riak_core. 

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}