Giter Club home page Giter Club logo

Comments (1)

ketoo avatar ketoo commented on May 7, 2024

In the NF examples, some functions, such as VerifyAccount, accept only the string strAccount, and not
strAccount + "_AccountInfo "
----------------Just a name to remember it easier, you can change as you like.

virtual NFListstd::string GetDriverIdList() = 0;
virtual NF_SHARE_PTR GetDriver(const std::string& strID) = 0;
virtual NF_SHARE_PTR GetDriverBySuitRandom() = 0;
virtual NF_SHARE_PTR GetDriverBySuitConsistent() = 0;
virtual NF_SHARE_PTR GetDriverBySuit(const std::string& strHash) = 0;

Imagine that you want to create a scalable database backend with "n" database servers for your application or a distributed system with a cluster of servers. To meet the goal we would meet the rules below:

a. We should be able to distribute the incoming queries uniformly among the set of "n" database servers
b. We should be able to dynamically add or remove a database server
c. When we add/remove a database server, we need to move the minimal amount of data between the servers

    //get redis driver by consistent hashing, normally we use this one
virtual NF_SHARE_PTR<NFIRedisClient>  GetDriverBySuitRandom() = 0;

    //some special features that we want the data away store in a special database we use this one
virtual NF_SHARE_PTR<NFIRedisClient>  GetDriverBySuitConsistent() = 0;

    //get redis driver by the hash value that you pass
virtual NF_SHARE_PTR<NFIRedisClient>  GetDriverBySuit(const std::string& strHash) = 0;

References below:
https://www.acodersjourney.com/system-design-interview-consistent-hashing/
https://en.wikipedia.org/wiki/Consistent_hashing

from noahgameframe.

Related Issues (20)

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.