Giter VIP home page Giter VIP logo

summarydb's Introduction

 _____                                           ____________ 
/  ___|                                          |  _  \ ___ \
\ `--. _   _ _ __ ___  _ __ ___   __ _ _ __ _   _| | | | |_/ /
 `--. \ | | | '_ ` _ \| '_ ` _ \ / _` | '__| | | | | | | ___ \
/\__/ / |_| | | | | | | | | | | | (_| | |  | |_| | |/ /| |_/ /
\____/ \__,_|_| |_| |_|_| |_| |_|\__,_|_|   \__, |___/ \____/ 
                                             __/ |            
                                            |___/             

Go

This is an implementation of SummaryStore in Golang.

By using window sliding aggregations, SummaryDB achieves much lower disk usage and lower time-based range query latencies compared to other TSDBs. These benefits come at the cost of higher error bounds of the query results.

SummaryDB is best suited for high volumes of numerical data, and it currently allows for querying of the following metrics across time:

  1. Max
  2. Min
  3. Count
  4. Sum

On generic data, it supports:

  1. Membership (using bloom filters)

Example

package main

import (
    "context"
    "summarydb"
)

func main() {
    db := summarydb.New("/path/to/db")
    // OR
    db := summarydb.Open("/path/to/db")
    defer db.Close()

    seq := summarydb.window.ExponentialLengthsSequence(2)
    stream := db.NewStream([]string{"sum", "max"}, seq).Run()

    stream.Append(0, 10.0)
    stream.Append(1, 11.0)
    stream.Append(2, 12.0)
    stream.Append(3, 13.0)
    stream.Append(4, 14.0)

    // Get sum between t=1 and t=3
    params := QueryParams{
        ConfidenceLevel: 0.95,
        SDMultiplier:    1.0,
    }
    aggResult := stream.Query("sum", 1, 3, &params)
    result := aggResult.value.Sum.Value
    error := aggResult.error
}

Dependencies

  1. BadgerDB is the persistent key-value store.
  2. Ristretto is the cache for the backing disk storage.
  3. Cap'n Proto is the serialization format for on-disk representation for all the window data.

summarydb's People

Contributors

dependabot[bot] avatar squadrick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

srinchow

summarydb's Issues

Write tests for each component of ingestion pipeline

Testing the pipeline components (Ingester, Summarizer, Writer, Merger) is a bit tricky due to their async nature. Currently, we only test the end-to-end pipeline.

Writer and Merger have a Process method that can be used for testing with some ease. Writer.Process is simple: only writes to storage, and doesn't need testing; only Merger.Process ought to be tested. Use an in-memory backend to track the changes made during merging.

Summarizer and Ingestor are tightly linked due to the empty buffer cycling, and need to be tested together.

The end-to-end test with buffering can be part of the Pipeline test.

Set up GitHub actions to run tests

I faced an issue where I couldn't compile the .capnp file into the corresponding .capnp.go file. The failure log:

protos/summarydb.capnp:1:19-30: error: Import failed: /go.capnp
protos/summarydb.capnp:3:2-4: error: Not defined: Go
protos/summarydb.capnp:4:2-4: error: Not defined: Go
go: downloading golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f
core/backing_store.go:5:2: package summarydb/protos is not in GOROOT (/opt/hostedtoolcache/go/1.15.2/x64/src/summarydb/protos)

Instead of debugging the exact problem, I figured the simpler path forward would be to version control the .capnp.go file (6182905). This makes the CI much simpler: just a regular go build/test.

I might have to consider this in the future and generate the file during the CI run.

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.