Git Product home page Git Product logo

consistent-hashing's Introduction

下载解压后直接根目录make然后就可以执行了./conHash
要加入到你的项目中,把src下面的东西copy进你的项目中就好了

利用C++和STL库实现了一致性Hash算法

我主要是利用STL里面的map和list进行节点管理

由于STL里面有我想要的所有东西,所以我觉得没必要自己再去写一个红黑树啥的

为了避免Hash冲突我用了multimap

由于2^32个key hash冲突的机会太小了,所以这样做比较完美的解决了这个问题

要实现均衡负载,就必须要有一个很好的hash函数

hash函数我用了MD5,你也可以传进去一个自己的hash函数,我也提供了响应的接口去检查你的hash函数是否合理

下面是功能截图

dong

dong2

dong2

dong2

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.