Popularity
2.9
Growing
Activity
0.0
Stable
10
1
0
Programming language: Crystal
License: MIT License
Tags:
Algorithms And Data Structures
hash_ring alternatives and similar shards
Based on the "Algorithms and Data structures" category.
Alternatively, view hash_ring alternatives based on common mentions on social networks and blogs.
Get performance insights in less than 4 minutes
Scout APM uses tracing logic that ties bottlenecks to source code so you know the exact line of code causing performance issues and can get back to building a great product faster.
Sponsored
scoutapm.com
Do you think we are missing an alternative of hash_ring or a related project?
README
hash_ring
The Consistent Hash Ring is a useful data structure when you operate the distributed servers. This library is implementation of Consistent Hash Ring based on the excellent Elixir hash ring lib.
Installation
Add this to your application's shard.yml
:
dependencies:
hash_ring:
github: TobiasGSmollett/hash_ring
Usage
require "hash_ring"
# Register 3 servers
hash_ring = HashRing::HashRing.new(["one", "two", "three"])
# Every user is assigned a server by consistent hash ring.
hash_ring.get("user1") # => "three"
hash_ring.get("user2") # => "three"
hash_ring.get("user3") # => "one"
hash_ring.get("user4") # => "two"
# Removes the "two" server
hash_ring.remove("two")
# Exists two servers which are "one" and "three".
hash_ring.get("user1") # => "three"
hash_ring.get("user2") # => "three"
hash_ring.get("user3") # => "one"
hash_ring.get("user4") # => "three"
Contributing
- Fork it ( https://github.com/TobiasGSmollett/hash_ring/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- tobias TobiasGSmollett - creator, maintainer