Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-3783

Build ZooKeeper based on RocksDB



    • New Feature
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • server
    • None


      Here are the things we have done so far with ZK on RocksDB project, it's in an initial phase, we don't have time to explore more, but put here in case the community is interested in and can help move this forward.
      When we were designing and working on this project, it was set into 3 phases:
      1. Moving ZK snapshot onto RocksDB to reducing snapshot disk IO
      It still keeps the in memory DataTree but uses RocksDB for it's snapshot to leverage the benefit of incremental snapshot in RocksDB to reduce the write amplification when having large snapshot but only small partial of hot znodes being changed.
      Since ZK has it’s own txn file, the WAL in RocksDB could be disabled to avoid double writing.
      2. Removing in memory DataTree to get rid of memory bound
      Read data from RocksDB (maybe with some cache), but keep key structures like children in memory, so ZK won't be bounded to the memory limit, and still have good through for APIs like getChildren.
      3. Moving txn log into RocksDB with different column family
      Consider to move the log into the RocksDB to get rid of the ZK txn files, so that we don't need to manage the txn files ourselves and probably the backup/restore would be simpler.
      [Implementation for phase 1]
      The attachment is the initial version of for the 1st phase, it may not able to apply to the latest master code since it was based on a very old commit, but you can get some idea from this.
      The idea is simple, when changes are made in DataTree, they're recorded and applied to the RocksDB when processTxn in ZKDatabase.
      When loading from disk, it will iterate through the RocksDB keys to restore the in memory DataTree.
      It also considered things for slowly rollout or rollback, so it can support reading from snapshot file and write to RocksDB, or read from RocksDB and write to file during runtime based on the flag.


        Issue Links



              hanm Michael Han
              lvfangmin Fangmin Lv
              0 Vote for this issue
              6 Start watching this issue



                Time Tracking

                  Original Estimate - Not Specified
                  Not Specified
                  Remaining Estimate - 0h
                  Time Spent - 4h 10m
                  4h 10m