GithubHelp home page GithubHelp logo

gsharma / consistent-hash Goto Github PK

View Code? Open in Web Editor NEW
8.0 3.0 2.0 3.26 MB

Consistent Hashing tracer bullets

License: Apache License 2.0

Java 100.00%
consistent-hashing karger rendezvous ring jump sharding

consistent-hash's Introduction

Build Status Test Coverage Quality Gate Licence

Consistent Hashing

Karger et al. introduced the concept of consistent hashing and gave an algorithm to implement it. Consistent hashing specifies a distribution of data among servers in such a way that servers can be added or removed without having to totally reorganize the data. It was originally proposed for web caching on the Internet, in order to address the problem that clients may not be aware of the entire set of cache servers.

Ring Consistent Hashing

https://www.akamai.com/es/es/multimedia/documents/technical-publication/consistent-hashing-and-random-trees-distributed-caching-protocols-for-relieving-hot-spots-on-the-world-wide-web-technical-publication.pdf

Jump Consistent Hashing

https://arxiv.org/abs/1406.2294

Rendezvous Consistent Hashing

https://www.eecs.umich.edu/techreports/cse/96/CSE-TR-316-96.pdf

Maglev Consistent Hashing

https://ai.google/research/pubs/pub44824 (section 3.4)

Rough Design Notes

  1. Start with a circle in line with Karger et al
  2. N nodes can be replicated R times to improve shard distribution. Replicated nodes to be termed Virtual nodes.
  3. Shard replicated nodes' hashes to angles on the cicle
  4. Add sharded nodes' hashes to a sorted map - key (angle) : value (node id)
  5. Circle is now primed
  6. Operations provided: a) data ops: add(), get(), remove() - key (angle) : value (kv pair) b) node ops: addNode(), removeNode()
  7. Don't deal with get() misses. get() misses should be rehydrated, responsibility of clients to rehydrate from permanent storage
  8. Don't apply algorithmic operations to storage stratum server-side, rather apply only client-side
  9. Tunables available: a) replication factor (by cluster size, by hardware homogeneity) b) choice of hashing algorithm
  10. Open questions: a) no perfect hashing algorithms - how to cheaply deal with collisions? b) how to handle hot replicas that show a major K/N skew? c) can we do better than Krager? d) what is a good value for the upper-bound of N times R?
  11. Consider improvements afforded by HRW / Rendezvous Hashing.
  12. Is support for CAS operations needed?

Consistent Hashing as a library

Add mvn dependency:

<dependency>
  <groupId>com.github.consistenthash</groupId>
  <artifactId>consistenthash</artifactId>
  <version>1.0-SNAPSHOT</version>
</dependency>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.