Git Product home page Git Product logo

membase's Introduction

Membase โ€“ key-value storage solution

Why this exists?

The goal of this project is to provide simple, easy to modify and relatively fast key-value storage, written in modern C++. While alternatives like Memcached and Redis written in pure C, this project focuses on code readability and flexibility.

How to use

You can insert values using PUT:

PUT user:47:name severin
OK
PUT user:47:id 47
OK
PUT user:47:age 21
OK

Then You can search:

FINDKEY user:47
KEY user:47:name
KEY user:47:age
KEY user:47:id
OK

Then GET:

GET user:47:age
VALUE 21

See section "Commands" for more.

Features

Modes

Database can operate in different modes:

  • memory: store data only in-memory
  • persistent: store data only on disk

Performanse

Latency for PUT & GET operations in most cases below 0.75 ms for memory mode. Extensive performanse metrics and tooling can be found in perf folder.

Plans

Current plans contains:

  • Creating more effitient data-strucrure for storing key-value strings for cache
  • Replasing current persistent storage with self-developed
  • Creating flexible search functionality
  • Adding wrapper libraries for different programming languages (C, C++, Python, Rust, Go, are priorities for now)

Commands

  • GET [key] Returns the value if exists, error otherwise
  • PUT [key] [value] Insert pair, key and value can be any sequence of symbols (not control symbols or spaces)
  • REMOVE [key] Removes key form storage
  • WIPE Completely erases database
  • FINDKEY [search] Returns list of keys that start with specific sequencee in lexical order
  • FINDVALUE [search] Returns list of keys, values of such starts with specific sequence in lexical order

Config

You have to provide app with argument -config config.json. Example config:

{
    "mode": "persistent",
    "server": {
        "host": "127.0.0.1",
        "port": 2222,
        "max_request_length": 4098
    },
    "cache": {
        "buckets": 1048576,
        "memory": 1073741824
    },
    "persistent": {
        "path": "/tmp/testdb",
        "create_if_missing": true
    }
}

Where:

  • mode Can be persistent or memory
  • server
    • host & port Accept connections from
    • max_request_length Maximum possible summary length of command
  • cache
    • buckets Default number of buckets in hash table (can grow in runtime)
    • memory Maximum available memory to the system. If memory is full, the majority of operations will result in errors
  • persistent
    • path Path to persistent storage
    • create_if_missing If false and database does not exist, result if failure

Contributing

All contributions that address issues or implement features are welcome. If you encountered bugs or have some ideas you welcome to create an issue on github.

membase's People

Contributors

severindenisenko avatar

Watchers

 avatar

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.