MCPcopy Index your code
hub / github.com/ByteStorage/FlyDB

github.com/ByteStorage/FlyDB @v1.1.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.1.1 ↗ · + Follow
3,741 symbols 8,162 edges 160 files 754 documented · 20% updated 14mo agov1.1.0 · 2023-08-13★ 1,23631 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

FlyDB-logo

GitHub top language Go Reference LICENSE GitHub stars GitHub forks Go Report Card GitHub go.mod Go version (subdirectory of monorepo)GitHub contributors

English | 简体中文

FlyDB aims to serve as an alternative to in-memory key-value storage (such as Redis) in some cases, aiming to strike a balance between performance and storage cost. It does this by optimizing resource allocation and using cost-effective storage media. By intelligently managing data, FlyDB ensures efficient operations while minimizing storage costs. It provides a reliable solution for scenarios that require a balance between performance and storage costs.

📚 What is FlyDB ?

FlyDB is a high-performance key-value (KV) storage engine based on the efficient bitcask model. It offers fast and reliable data retrieval and storage capabilities. By leveraging the simplicity and effectiveness of the bitcask model, FlyDB ensures efficient read and write operations, resulting in improved overall performance. It provides a streamlined approach to storing and accessing key-value pairs, making it an excellent choice for scenarios that require fast and responsive data access. FlyDB's focus on speed and simplicity makes it a valuable alternative for applications that prioritize performance while balancing storage costs. 

🏁 Fast Start: FlyDB

You can install FlyDB using the Go command line tool:

go get github.com/ByteStorage/FlyDB@v1.1.0

Or clone this project from github:

git clone https://github.com/ByteStorage/FlyDB.git

🖥 How to use FlyDB ?

Here is a simple example of how to use the Linux version:

See flydb/examples for details.

package main

import (
    "fmt"
    "github.com/ByteStorage/FlyDB/flydb"
    "github.com/ByteStorage/FlyDB/config"
)

func main() {
        options := config.DefaultOptions
    options.DirPath = "/tmp/flydb"
    db, _ := flydb.NewFlyDB(options)

        err := db.Put([]byte("name"), []byte("flydb-example"))
        if err != nil {
            fmt.Println("Put Error => ", err)
        }


    val, err := db.Get([]byte("name"))
    if err != nil {
        fmt.Println("Get Error => ", err)
    }
        fmt.Println("name value => ", string(val))


        err := db.Delete([]byte("name"))
        if err != nil {
            fmt.Println("Delete Error => ", err)
        }
}

You can also run this command.

./build.sh

🚀 Performance test

We did a simple performance test of the V1.0.4 version of FlyDB. This test mainly focused on reading and writing large-scale data, and we selected 500,000 random data for testing.

Through testing, we found that in V1.0.4, with 500,000 data:

BTree Index

PUT performance: 572.265968ms

GET performance: 355.943926ms

v1.0.4-btree

ARTree Index

PUT performance: 569.610614ms

GET performance: 297.781977ms

v1.0.4-art

If you have a better way to optimize read and write performance, please submit your 'pr'.

📢 Benchmark test

We compared the results of a benchmark test using FlyDB V1.0.4 with other kv databases written in golang on the market and found that the read/write performance test results exceeded most open source kv databases.

See in detail: https://github.com/ByteStorage/contrast-benchmark

goos: linux
goarch: amd64
pkg: contrast-benchmark
cpu: 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz

Benchmark_PutValue_FlyDB
Benchmark_PutValue_FlyDB-16            95023         13763 ns/op        2904 B/op         16 allocs/op
Benchmark_GetValue_FlyDB
Benchmark_GetValue_FlyDB-16          2710143         463.5 ns/op         259 B/op          5 allocs/op
Benchmark_PutValue_Badger
Benchmark_PutValue_Badger-16           59331         22711 ns/op        6006 B/op         48 allocs/op
Benchmark_GetValue_Badger
Benchmark_GetValue_Badger-16          158686          7686 ns/op       10844 B/op         42 allocs/op
Benchmark_PutValue_BoltDB
Benchmark_PutValue_BoltDB-16           32637         56519 ns/op       21009 B/op        123 allocs/op
Benchmark_GetValue_BoltDB
Benchmark_GetValue_BoltDB-16          655971         24327 ns/op         723 B/op         26 allocs/op 
Benchmark_PutValue_GoLevelDB
Benchmark_PutValue_GoLevelDB-16        71931         14709 ns/op        2226 B/op         12 allocs/op
Benchmark_GetValue_GoLevelDB
Benchmark_GetValue_GoLevelDB-16       500736          2520 ns/op        1278 B/op         15 allocs/op
Benchmark_PutValue_NutsDB
Benchmark_PutValue_NutsDB-16           78801         13582 ns/op        3242 B/op         22 allocs/op
Benchmark_GetValue_NutsDB
Benchmark_GetValue_NutsDB-16          373124          5702 ns/op        1392 B/op         14 allocs/op
Benchmark_PutValue_RoseDB
Benchmark_PutValue_RoseDB-16           69776         19166 ns/op        6242 B/op         59 allocs/op
Benchmark_GetValue_RoseDB
Benchmark_GetValue_RoseDB-16         4155183         298.0 ns/op         167 B/op          4 allocs/op
Benchmark_PutValue_Pebble
Benchmark_PutValue_Pebble-16           91304         21877 ns/op        2720 B/op          8 allocs/op
Benchmark_GetValue_Pebble
Benchmark_GetValue_Pebble-16           66135         15837 ns/op       17193 B/op         22 allocs/op
PASS

🔮 How to contact us ?

If you have any questions and want to contact us, you can contact our developer team, we will reply to your email:

Team Email: bytestoragecommunity@gmail.com

Or add my wechat, invite you to enter the project community, and code masters together to exchange learning.

Add wechat please comment Github

vx

✅ TODO List

  • [ ] Extended data structure support: including but not limited to string, list, hash, set, etc.
  • [ ] Compatible with Redis protocols and commands.
  • [x] Support http services.
  • [x] Support tcp services.
  • [x] Log aggregation
  • [ ] Data backup
  • [ ] Distributed cluster model.

📜 Version update doc

See in detail: Version-update-document

👀 Contributor

📝 How to contribute ?

If you have any ideas or suggestions for FlyDB, please feel free to submit 'issues' or' pr 'on GitHub. We welcome your contributions!

Please refer to the complete specification procedure:CONTRIBUTEING

📋 Licence

FlyDB is released under the Apache license. For details, see LICENSE file.

Thanks To JetBrains

Thanks to JetBrains for the free open source license.

FlyDB-logo

Extension points exported contracts — how you extend this code

Iterator (Interface)
Iterator is a generic index iterator. [5 implementers]
engine/index/index.go
IOManager (Interface)
IOManager is an abstract IO management interface that can accommodate different IO types. Currently, it supports standar [3 …
engine/fileio/io_manager.go
Interface (Interface)
Interface is the interface that must be implemented by a raft server. [1 implementers]
lib/raft/raft_interface.go
Store (Interface)
Store is the interface of store. [1 implementers]
cluster/store/store.go
SchedulingStrategy (Interface)
SchedulingStrategy is the interface that wraps the basic SelectNode method. [1 implementers]
cluster/meta/scheduler.go
Region (Interface)
Region is the interface of region. [1 implementers]
cluster/region/region.go
Pool (Interface)
Pool is a connection pool interface
lib/pool/pool.go
DataHandler (Interface)
(no doc) [2 implementers]
lib/dh/dh_interface.go

Core symbols most depended-on inside this repo

GetTestKey
called by 161
lib/randkv/rand_kv.go
RandomValue
called by 98
lib/randkv/rand_kv.go
Get
called by 86
cluster/cluster.go
Clean
called by 77
structure/hash.go
newClient
called by 55
cmd/client/string.go
Write
called by 54
engine/fileio/io_manager.go
GetLog
called by 53
lib/datastore/flydb.go
stringToBytesWithKey
called by 52
structure/string.go

Shape

Method 2,572
Function 646
Struct 458
Interface 61
TypeAlias 3
FuncType 1

Languages

Go100%

Modules by API surface

lib/proto/gstring/db.pb.go512 symbols
lib/proto/glist/db.pb.go378 symbols
lib/proto/ghash/db.pb.go354 symbols
lib/proto/gzset/db.pb.go204 symbols
lib/proto/master.pb.go173 symbols
lib/proto/gset/db.pb.go144 symbols
lib/proto/gstring/db_grpc.pb.go120 symbols
lib/proto/slave.pb.go118 symbols
lib/proto/ghash/db_grpc.pb.go95 symbols
lib/proto/master_grpc.pb.go70 symbols
lib/proto/gzset/db_grpc.pb.go70 symbols
lib/proto/gset/db_grpc.pb.go70 symbols

For agents

$ claude mcp add FlyDB \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page