Over a million developers have joined DZone.

Basho Packages it's Riak Core for Distrubted App Developers

· Database Zone

Build fast, scale big with MongoDB Atlas, a hosted service for the leading NoSQL database. Try it now! Brought to you in partnership with MongoDB.

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. 

Now it's easier than ever to get started with MongoDB, the database that allows startups and enterprises alike to rapidly build planet-scale apps. Introducing MongoDB Atlas, the official hosted service for the database on AWS. Try it now! Brought to you in partnership with MongoDB.


Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}