Skip to content
This repository has been archived by the owner on Oct 17, 2023. It is now read-only.

meeron/honey-badger

Repository files navigation

!! OBSOLETE !!

This repository is obsolete. New repository: https://github.com/honey-badger-io/honey-badger

Honey Badger

Go Report Card Go Build HoneyBadger.Client

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 build server binaries

$ make build

This will produce server binary. Run it with default configuration

$ ./bin/hb

or on Windows

bin\hb.exe

Docker

Run Docker image using

docker run --name honey-badger -p 18950:18950 -d meeron/honey-badger:latest

Client

Current official clients:

Feel free to post na issue if you miss client for your favorite language.

In the mean time you can use honey_badger.proto file to generate a client for any 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
SendWithStream_100000: 212.652541ms
SendWithStream_300000: 482.201958ms
SendWithStream_500000: 805.415042ms

payload size: 256 bytes
num goroutines: 1
ReadWithStream_100000: 100.984375ms
ReadWithStream_300000: 316.02125ms
ReadWithStream_500000: 532.293375ms

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 and 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.