Coder Social home page Coder Social logo

tranndc / godbee Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zalopay-oss/godbee

0.0 0.0 0.0 34.54 MB

An experimental & simple key-value service written in Go/C++

Dockerfile 0.10% Go 28.83% Python 0.13% Shell 0.07% Makefile 0.80% C++ 69.38% C 0.68%

godbee's Introduction

GodBee

Build Status Project Level Coverage Status version version version

Overview

GodBee is a Key-Value Store Service project. In this project, we choose B-Tree and B+Tree data structures to organize and manipulate data. Key-Value Storage is written in C++ and Service layer is written in Golang programming language. We use gRPC services to handle requests from client and use CGO to access data from C++ storage.

Architecture

Requirements

  • C++17
  • Golang 1.13.1
  • Locust
  • Python 3.7.3
  • Docker Engine - Community 19.03.3

Methods supported

syntax = "proto3";

package service;

service KeyValueStoreService {
    rpc Connect (ConnectionRequest) returns (MessageResponse){}
    rpc Disconnect (DisconnectRequest) returns (MessageResponse) {}
    rpc Get (GetRequest) returns (GetResponse) {}
    rpc Set (SetRequest) returns (MessageResponse) {}
    rpc Remove (RemoveRequest) returns (RemoveResponse) {}
    rpc Exist (ExistRequest) returns (ExistResponse) {}
}

Build

# Clone project
git clone https://github.com/zalopay-oss/godbee.git

Run

  • Make CGO understands C++17
# Modify Go enviroment variable
export CGO_CXXFLAGS="-g -rdynamic -std=c++17 -o -pthread
  • Run server:
# Build server
make build-server

# Run server
./server
  • Or run Docker server:
# Build docker image named "godbee-server"
docker build -t godbee-server .

# Run image
docker run -it --net="host" godbee-server

Test

Test CLI

After run server, you can use GodBee-CLI to send commands to GodBee, and read the replies sent by the server, directly from the terminal.

Run CLI:

# Build and run client
make cli

Command line usage:

  • Connect to B/B+ Storage:
# CONNECT {B | BPLUS}
GodBee > CONNECT B
OK
  • Disconnect to the storage:
# CLOSE
GodBee > CLOSE
OK
  • Insert new Key-Value:
# SET key value
GodBee > SET a a
OK
  • Get value from key:
# GET key
GodBee > GET a
"a"
  • Remove key:
# {REMOVE|DEL} key
GodBee > DEL a
OK
  • Check whether key exists in storage or not.
# EXIST key
GodBee > EXIST a
FALSE
  • Exit program
GodBee > exit
Bye bye!!! Beeeeee~

Run unit tests

# Run test
make test

Benchmark

You can view benchmark results at here.

P99 overview (miliseconds)

Percentile Storage Exist Get Remove Set
50% B-Store 20 19 88 110
B+Store 21 20 87 110
99% B-Store 36 35 270 270
B+Store 39 37 250 270
100% B-Store 71 59 880 1000
B+Store 77 75 810 1000

Documentation

Acknowledgements

Thanks AJ Pham for guiding us during the project.

godbee's People

Contributors

ptq204 avatar tranndc 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.