{"id":21526926,"url":"https://github.com/lambdaclass/elixir_riak_core","last_synced_at":"2025-04-09T23:34:15.116Z","repository":{"id":37479276,"uuid":"500464366","full_name":"lambdaclass/elixir_riak_core","owner":"lambdaclass","description":"Wrapper to Riak Core for Elixir","archived":false,"fork":false,"pushed_at":"2023-04-13T23:15:52.000Z","size":1044,"stargazers_count":9,"open_issues_count":2,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-04T13:54:21.671Z","etag":null,"topics":["distributed-systems","elixir","erlang","riak","riak-core"],"latest_commit_sha":null,"homepage":"https://lambdaclass.github.io/elixir_riak_core/","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lambdaclass.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-06T14:22:44.000Z","updated_at":"2025-02-21T12:08:08.000Z","dependencies_parsed_at":"2022-09-10T05:10:35.933Z","dependency_job_id":null,"html_url":"https://github.com/lambdaclass/elixir_riak_core","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdaclass%2Felixir_riak_core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdaclass%2Felixir_riak_core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdaclass%2Felixir_riak_core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdaclass%2Felixir_riak_core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lambdaclass","download_url":"https://codeload.github.com/lambdaclass/elixir_riak_core/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248130170,"owners_count":21052708,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["distributed-systems","elixir","erlang","riak","riak-core"],"created_at":"2024-11-24T01:47:15.312Z","updated_at":"2025-04-09T23:34:15.073Z","avatar_url":"https://github.com/lambdaclass.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Riax ![Build](https://github.com/lambdaclass/elixir_riak_core/actions/workflows/github-actions.yml/badge.svg)\n\nRiax is an Elixir wrapper for [Riak Core](https://github.com/basho/riak_core). \nRiak Core is a building block for distributed and scalable systems\nin the form of an Erlang Framework.\n\nTo learn more about Riak you can check the  [Riak Core](#riak-core) and [useful links section](#useful-links) sections.\nTo learn more about Riax, check [the setup](https://lambdaclass.github.io/elixir_riak_core/setup.html), [the tutorial](https://lambdaclass.github.io/elixir_riak_core/tutorial.html) or [the API Reference](https://lambdaclass.github.io/elixir_riak_core/api-reference.html).\n\nIf you want to set it up with Erlang, we also have an [up-to-date (OTP 25)\ntutorial](https://github.com/lambdaclass/riak_core_tutorial). \n## Use example\n\n```elixir\niex(dev1@127.0.0.1)1\u003e #### Check the Ring Status\niex(dev1@127.0.0.1)2\u003e Riax.ring_status\n==================================== Nodes ====================================\nNode a: 64 (100.0%) dev1@127.0.0.1\n==================================== Ring =====================================\naaaa|aaaa|aaaa|aaaa|aaaa|aaaa|aaaa|aaaa|aaaa|aaaa|aaaa|aaaa|aaaa|aaaa|aaaa|aaaa|\n:ok\niex(dev1@127.0.0.1)3\u003e #### Join an already running Node\niex(dev1@127.0.0.1)4\u003e Riax.join('dev2@127.0.0.1')\n13:51:21.258 [debug] Handoff starting with target: {:hinted, {913438523331814323877303020447676887284957839360, :\"dev2@127.0.0.1\"}}\niex(dev1@127.0.0.1)5\u003e #### Send a command to a VNode\niex(dev1@127.0.0.1)6\u003e Riax.sync_command(1, \"riax\", {:ping, 1})\n    13:13:08.004 [debug] Received ping command!\n    {:pong, 2, :\"dev1@127.0.0.1\", 822094670998632891489572718402909198556462055424}\n```\n\n## Installation\n\nAdd Riax to your dependencies:\n```elixir\ndefp deps do\n  [\n    {:riax, \"\u003e= 0.1.0\", github: \"lambdaclass/elixir_riak_core\", branch: \"main\"}\n  ]\nend\n```\nAnd follow [the setup](https://lambdaclass.github.io/elixir_riak_core/setup.html)\n\n## Riak Core\n\n## What is it?\nIt is based on the [Dynamo architecture](https://www.allthingsdistributed.com/files/amazon-dynamo-sosp2007.pdf),\nmeaning it is easy to scale horizontally and distributes work in a decentralized\nmanner. The great thing about Riak it's that it provides this architecture as a\nreusable Erlang library, meaning it can be used in any context\nthat benefits from a decentralized distribution of work.\n\n## Why Riax? \nYou must be thinking \"ok, fine, this is an Erlang lib, I'll use it directly\".\nThe setup of Riak Core can be tricky, specially from Elixir, this library\ntakes care of all the gory details for you - we suffered so you don't have to.\n\n## What's so great about it?\nThe key here is that Riak Core provides Consistent Hashing and Virtual Nodes.\nVirtual Nodes distribute work between them, and Consistent Hashing lets us\nroute commands to these Virtual Nodes. Note that many Virtual Nodes can run in\na Physical Node (i.e. a physical server) and can be easily set up or taken down.\nPlus, the only thing that you have to do using this library is giving them names\nand implement a behaviour, Riak handles the rest for you.\n\n## Use cases\nThe most intuitive and straight-forward use case is a key-value store in memory,\nwe've actually [implemented one here](https://github.com/lambdaclass/elixir_riak_core/blob/main/test/key_value/riax_kv.ex) for our tests.\n\nA game server which handles requests from players could partition\nplayers through said hashing to handle load, and ensure that players requests\nare always handled on the same Virtual Node to ensure data locality. \n\nA distributed batch job handling system could also use consistent hashing and\nrouting to ensure jobs from the same batch are always handled by the same node,\nor distribute the jobs across several partitions and then use the distributed\nmap-reduce queries to gather results.\n\nAnother example: Think about serving a dataset which you want quick \naccess to, but It's too big to fit in memory. We could distribute said\nfiles (or file) between Virtual Nodes, use an identifier (say, like an index)\nhash it and assign it to a Virtual Node. Riak fits really well here as it\nscales easily horizontally.\nThis last use case is actually explained below.\n\n## More about Hashing and VNodes\nBefore performing an operation, a hashing function is applied to some data, a\nkey. The key hash will be used to decide which node in the cluster should be\nresponsible for executing the operation. The range of possible values the key\nhash can take (the keyspace, usually depicted as a ring), is partitioned in\nequally sized buckets, which are assigned to Virtual Vodes.\n\n![The Ring](https://raw.githubusercontent.com/lambdaclass/riak_core_tutorial/master/ring.png)\n\nVirtual Nodes share what is called a keyspace.\nThe number of VNodes is fixed at cluster creation and a given hash value will\nalways belong to the same partition (i.e. the same VNode). The VNodes in turn\nare evenly distributed across all available physical nodes. Note this\ndistribution isn't fixed as the keyspace partitioning is: the VNode distribution\ncan change if a physical node is added to the cluster or goes down.\n\nAfter this, be sure to check [the tutorial](https://lambdaclass.github.io/elixir_riak_core/tutorial.html)\nto see this in action\n## Useful links\n* [Introducing Riak Core](http://basho.com/posts/business/introducing-riak-core/)\n* [Riak Core Wiki](https://github.com/basho/riak_core/wiki)\n* [Masterless Distributed Computing with Riak Core](http://www.erlang-factory.com/upload/presentations/294/MasterlessDistributedComputingwithRiakCore-RKlophaus.pdf)\n* Ryan Zezeski's \"working\" blog:\n  [First, multinode](https://github.com/rzezeski/try-try-try/tree/master/2011/riak-core-first-multinode) and\n  [The vnode](https://github.com/rzezeski/try-try-try/tree/master/2011/riak-core-the-vnode)\n* [Little Riak Core Book](https://marianoguerra.github.io/little-riak-core-book/)\n* riak_core in Elixir:\n  [Part I](https://medium.com/@GPad/create-a-riak-core-application-in-elixir-part-1-41354c1f26c3),\n  [Part II](https://medium.com/@GPad/create-a-riak-core-application-in-elixir-part-2-88bdec73f368),\n  [Part III](https://medium.com/@GPad/create-a-riak-core-application-in-elixir-part-3-8bac36632be0),\n  [Part IV](https://medium.com/@GPad/create-a-riak-core-application-in-elixir-part-4-728512ece224) and\n  [Part V](https://medium.com/@GPad/create-a-riak-core-application-in-elixir-part-5-86cd9d2c6b92)\n* [A Gentle Introduction to Riak Core](http://efcasado.github.io/riak-core_intro)\n* Understanding Riak Core:\n  [Handoff](http://basho.com/posts/technical/understanding-riak_core-handoff/),\n  [Building Handoff](http://basho.com/posts/technical/understanding-riak_core-building-handoff/)\n  and\n  [The visit fun](http://basho.com/posts/technical/understanding-riak_core-visitfun/)\n* [udon_ng](https://github.com/mrallen1/udon_ng) example application.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flambdaclass%2Felixir_riak_core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flambdaclass%2Felixir_riak_core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flambdaclass%2Felixir_riak_core/lists"}