Coder Social home page Coder Social logo

rkv's People

Contributors

sidecus avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rkv's Issues

Large snapshot might cause leader to send it multiple times

Right now leader sends snapshot to follower using RPC stream. Follower receives it as RPC message stream and then converts it into a byte reader and copies it to a local file to ensure integrity and avoid partial snapshot apply. The file is then used to install the snapshot. When it's done client sends reply (reusing AE reply) back to leader.

The RPC message stream to byte reader conversion is done at kvstore package, and raft follower itself has no knowledge about individual chunk, and only sends one reply back.

When the snapshot is large, it takes time and leader might start sending another snapshot upon the 2nd heartbeat - it'll be ignored by the follower since it's a duplicate but it wastes bandwidth and compute on both leader and follower.

We'll need to create some "awareness" upon snapshot replication on the leader side to avoid this.

And btw it can also happen to normal log replication AE requests when follower is slow processing. Impact is much lower though.

Busy leader should yield for heartbeat

The benchmark capability in rkvclient can be used to stress rkv. On a 3 node cluster using loopback, 1000 relatively small concurrent request takes about 150ms.

However, the system drops cmds when testing with 10000 concurrent requests, e.g. using below command:

./rkvclient benchmark -address localhost:27016 -times 10000

The reason is 10000 concurrent requests make the leader too busy. It has no bandwidth (or reaching grpc limit?) to send heartbeat in time. Eventually follower triggers new election - given we don't wait for commit (done asynchronously unlike the paper has), a lot of set requests were lost during new leader transition.

We should consider things like below:

  1. Loosen election timeout upon certain conditions
  2. Yield in leader to make sure heartbeat can be sent even when it's flooded with requests
  3. Synchronous commit might be better for this kind of scenarios since it "forces" leader to do so - slower commit but guaranteed no data loss upon success

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.