Code Monkey home page Code Monkey logo

bitcask's Introduction

Bitcask

The repositoy contains a simple key-value store that uses Bitcask as the storage engine and Redis Serialization Protocol (RESP) as the network protocol.

Features

  • Redis-compatible server and client
  • Lock-free concurrent reads
  • Asynchronous data compaction
  • Asynchronous disk synchronization

Usages

Clone the repository and build the project. Once finish, the executables are placed in the target/release folder.

$ git clone https://github.com/ltungv/bitcask.git
$ cd bitcask && cargo build --release

Get the server help message.

$ ./target/release/svr --help

USAGE:
    svr [OPTIONS]

OPTIONS:
    -c, --config <CONFIG>    Path to the configuration file without the extension [default: config]
    -h, --help               Print help information
    -V, --version            Print version information

Get the client help message.

$ ./target/release/cli --help

USAGE:
    cli [OPTIONS] <SUBCOMMAND>

OPTIONS:
    -h, --help           Print help information
        --host <HOST>    The host address of the server [default: 127.0.0.1]
        --port <PORT>    The port number of the server [default: 6379]
    -V, --version        Print version information

SUBCOMMANDS:
    del     Delete keys
    get     Get key's value
    help    Print this message or the help of the given subcommand(s)
    set     Set key's value

Configurations

To change the server settings, a configuration file is used. By default, the server will try to read the configuration file located at the directory where the server is run. Alternatively, a custom path to the configuration file can be given through the CLI upon startup. An example of the configuration file is given in config.toml.

net.host = "0.0.0.0"
net.port = 6379
net.min_backoff_ms = 500
net.max_backoff_ms = 64000
net.max_connections = 128

storage.path = "db"
storage.concurrency = 4
storage.readers_cache_size = 256
storage.max_file_size = 2000000000
storage.sync = "none"

storage.merge.policy = "always"
storage.merge.check_interval_ms = 180000
storage.merge.check_jitter = 0.3

storage.merge.triggers.fragmentation = 0.6
storage.merge.triggers.dead_bytes = 512000000

storage.merge.thresholds.fragmentation = 0.4
storage.merge.thresholds.dead_bytes = 128000000
storage.merge.thresholds.small_file = 10000000

Additionally, we can use environment variables to override the server settings. Environment variables that change the settings are prefixed with BITCASK, and the prefix along with nested fields are separated with double underscores __. For example, BITCASK__NET__HOST=127.0.0.1 will change to host address to 127.0.0.1, and BITCASK__STORAGE__MAX_FILE_SIZE=2 will change Bitcask's max file size to 2.

Supported Redis commands

bitcask's People

Contributors

ltungv avatar

Stargazers

 avatar Liuyifan avatar Liu Jinyi avatar Ryan Stankiewicz avatar Victor Künstler avatar Kai avatar Sehyo Chang avatar Jerome Gravel-Niquet avatar  avatar Francesco Tomaselli avatar Chetan Sharma avatar David.Gao avatar V. Can Keklik avatar Jonathan Frank avatar Kevin Zhang avatar Eason Wang avatar  avatar  avatar

Watchers

James Cloos avatar  avatar

Forkers

davidalphafox

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.