honey-badger

command module
v0.1.0-alpha.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 8 Imported by: 0

README

Honey Badger

Go Report Card Go

Honey Badger is simple and fast cache server with persistent storage build on top of BadgerDB. It uses gRPC as transport protocol.

Getting Started

Build server

To build Honey Badger server you need Go 1.21 or above.

Windows users may need to install GNU Make. The best way is to use some package manager like scoop

To start, clone the repo

git clone git@github.com:meeron/honey-badger.git

Go to honey-badger directory and install packages

$ cd honey-badger
$ go install

Then run the following command

$ make build

This will produce server binary. Run it with default configuration

$ ./bin/hb

or on Windows

bin\hb.exe
Client

To connect to server you need gRPC client. Using honey_badger.proto file you can generate one with your favorite language.

Check server_test.go for examples in Go language.

To make call you can also use grpc_cli command line tool

$ grpc_cli call localhost:18950 hb.Sys.Ping ""
connecting to localhost:18950
code: "pong"
Rpc succeeded with OK status

The command line tool also offers function to list avilable services on server

$ grpc_cli ls localhost:18950
hb.Data
hb.Db
hb.Sys

Then all methods in service

$ grpc_cli ls localhost:18950 hb.Data
Set
Get
GetByPrefix
Delete
DeleteByPrefix
SetBatch

Eventually you can print details for each previous commands.

$ grpc_cli ls localhost:18950 hb.Data.Set -l
rpc Set(hb.SetRequest) returns (hb.Result) {}
Benchmark (in memory)

To test server performance on your system run

$ ./bin/hb -bench localhost:18950
os: darwin/arm64
cpus: 8

payload size: 256 bytes
num goroutines: 20
Set_30000: 293.691166ms
Set_50000: 509.71825ms
Set_100000: 1.026570458s

payload size: 256 bytes
num goroutines: 20
Get_30000: 317.108166ms
Get_50000: 489.316917ms
Get_100000: 982.176458ms

payload size: 256 bytes
num goroutines: 1
SetBatch_100000: 175.145125ms
SetBatch_300000: 596.115083ms
SetBatch_500000: 1.007408541s

The result Set_30000: 293.691166ms says that in 293ms 30k items has been sent to server using 20 concurrent tasks.

Hardware requirements

Honey Badger server should run on anything. CPU and RAM depends on your needs, but absolute minium is SSD disk (if persistance storage will be in use). Use benchmark command to check how Honey Badger is working on your instance.

System requirements

Linux and Mac

Honey Badger should build run on any Linux distro. BadgerDB recommends max file descriptors set to a high number depending upon the expected size of your data.

Windows

It should build and run just fine.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL