A time series database prototype with multiple backends

Xephon-K


xephon-k


GoDoc Build Status Coverage Status Go Report Card codebeat badge

Xephon-K is a time series database with multiple backends. It's a playground for comparing modern TSDB design and implementation. It is not for production use, but it can show you simplified implementation of popular TSDBs. A detailed (but not well organized) survey can be found in doc/survey.

Supported backend

  • In Memory
  • Local disk, modeled after InfluxDB
  • Cassandra, modeled after KairosDB, but the partitioned schema is not implemented

Following are some backends I plan to implement in the future

  • RocksDB
  • Redis
  • MySQL, modeled after VividCortex
  • S3 + Dynamo, modeled after weaveworks' cortex

Related projects

About

  • Xephon comes from animation RahXephon, which is chosen for Xephon-B
  • K comes from KairosDB because this project is originally modeled after KairosDB, which is also the first TSDB I have used in production.

Authors

Owner
Xephon
In search of a new time series database
Xephon
Comments
  • Remove go kit

    Remove go kit

    Solved: Fix #6 #53 #54 (Config) Introduced: #56

    • [x] port old HTTP code
      • [x] only port write code, ignore read for now, since we are still benchmarking write ....
      • http read is ported, don't have plan for grpc yet, the serialize still got trouble
    • [x] allow config
    • [ ] make GRPC write working
      • [ ] need a grpc client
    • [ ] move client library out from pkg/bench
      • make it more close to tsdb-proxy
  • Data file block encoding and Columnar format

    Data file block encoding and Columnar format

    Partially #47 and Partially #49 (Don't have time to support table layout for now)

    • [x] write encoded block #45
    • [x] read encoded block #46

    Optional

    • [ ] (need another issue) change the in memory storage to columnar or compressed columnar format, the row format might be too consuming
  • [WIP] Refactor bechmark

    [WIP] Refactor bechmark

    • [x] support limit by number of points
    • [ ] reporter report data into json file
    • [x] use docker volume instead of default COW #51
    • [ ] collect container metrics?
  • Support multiple timestamp precision and Double Series

    Support multiple timestamp precision and Double Series

    Fix #35, Fix #36, Fix #38

    Use int64 for timestamp, but it could be different precision (second, millisecond, nanosecond),. Since only second can fit into int32 and modern architecture are 64 bit, we just use int64 for second precision as well.

    Also this is a chance for us to implement double point (currently, only int is supported) and fix some existing issues in IntSeries along the way of refactoring.

    • [x] Rename TimeNano -> T to avoid confusion
      • [x] IntPoint 0faedc643179ff94915fdcfc6386e0e54d51cf5a
      • [x] DoublePoint
    • [x] Change V from int -> int64 05f2b7d37922bd6c47a4297ca522428592f6088e
    • [x] Properly decode int and double series when decoding request f0fa155a8317e24cdac2f6855d6fddfa10c53660
      • [x] there could be mixed int and double series, may need to use json.RawMessage and deal it like query
      • [x] or use empty series, like UndeterminedSeries to get the type, now using MetaSeries with json.RawMessage
    • [x] IntPoint and IntSeries 0faedc643179ff94915fdcfc6386e0e54d51cf5a (simply use refactor provided by Gogland)
      • [x] common
      • [x] bench
      • [x] storage/memory
      • [x] storage/cassandra
      • [ ] collector
    • [x] DoublePoint and DoubleSeries
    • [ ] add the sorted flag when ingest series
    • [x] use interface for memory Data to support both DoubleSeries and IntSeries
    • [ ] remove duplicate when doing merge sort (backtrack?)
    • [ ] (optional) float32 instead of float64 because saw in AMS250 slide that GPU speed for float32 and float64 has big difference, may need a benchmark for that
  • Bench Prometheus

    Bench Prometheus

    The problem is .... can't find the API endpoint for using HTTP API for push

    TODO

    • [x] ~~support gRPC in the loader~~ this does not work, it does not have a gRPC server, the best I can find is https://github.com/prometheus/prometheus/tree/master/documentation/examples/remote_storage
    • which means we need to find the scrapper code to see how they call the underlying storage layer, seems to be Append method in retrieval/target.go, there is an interface called storage.SampleAppender which is implemented by the local storage

    Ref

    • https://github.com/prometheus/prometheus/blob/master/storage/remote/client.go#L64 it has gRPC endpoint for pushing data, though I didn't find the default url, I guess there is no url when using gRPC? or they are just using protobuf without using gRPC
  • Cassandra Backend

    Cassandra Backend

    Naiveschema + Tags

    • [x] cli for creating the schema (though actually not very needed) 7dfc37a83caff17513afee8befd96543bb1285ed
    • [ ] current naive schema with tags is WRONG, tags should be in partiton key .... 16b0675a43ad93a20c2c88f63251d96926f7708c
    • gocql can handle map properly
    • [ ] but you can't filter using map, cassandra think this is a very expensive operation and you must use allow fitlering
    • [x] read 60cccf712676f814bf4ec2249dd848c2c47e579a
    • [x] write 16b0675a43ad93a20c2c88f63251d96926f7708c
    • [x] unify the keyspace to avoid sprintf feb07ab108fdfca1f068963652e977b85ca38aef
    • [x] split int and double table feb07ab108fdfca1f068963652e977b85ca38aef
    • [ ] use buffer like KairosDB did, write large batch into Cassandra, currently just use the batch size of client
  • Basic benchmark disk size increased from 8M -> 19M

    Basic benchmark disk size increased from 8M -> 19M

    Previously, when using rle on value and raw big endian on time, we got 8M, but now we got 19M, further more, if we double the number of points, the file size triples, it goes to 66M instead of 30~40M

    Possible reasons

    • old benchmark are using tmpfs, which is different from ssd, but du and ls returns same result, and the write buffer size is default to 4KB

    TODO

    • better dump util
  • [Test] Switch to BDD test before the test grows large

    [Test] Switch to BDD test before the test grows large

    Current test are just plain golang unit test using assert library, which works perfectly with IDE like Gogland but hard to know what is doing in a glance.

    Some candidates

    • https://onsi.github.io/ginkgo/
  • http too many open file

    http too many open file

    When benchmarking in localhost, got the error, could because the loader and the server is in the same machine, need to containerize xephon-k to confirm this.

    Seems related to https://github.com/containous/traefik/issues/157 and https://github.com/containous/traefik/issues/127 Though I am not sure if the MaxIdleConnection per host applies to server, I know it works for client.

  • In Memory Store

    In Memory Store

    Though at start, the motivation is to rewrite KairosDB in Golang, a in memory store become very important for the following reasons

    • needed by tsdb-ql which is also the idea comes from
    • improve performance, it can be a write through/back cache
    • if no compression is added, a in memory store is not very hard to write

    TODO

    • [x] hash series, name + sorted tags 6c9eb506a49344dc40a83f3649a6b77dc5ce0879
    • [x] write series to correct IntSeriesStore 28ac98ab95fc9177852f5e35b4c46e7f2238f690
    • [ ] index tags
      • can't figure out a good data structure yet, might use set and do set join?
      • now using inverted index, see #27
    • [ ] read
      • [x] read all by name
      • [ ] read using filter by time and tag
    • [ ] flush/drop data periodically or by threshold
    • [ ] write to disk #32

    Ref

    • https://github.com/allegro/bigcache
  • Gogland refactor messed up the doc

    Gogland refactor messed up the doc

    when change index -> indexLength, it update a lot of comment, including the doc for the file format.

    • [x] search for indexLength should find most (all?) of them
    • [x] search for indexOffset
    • [x] search for seriesBlock
    • [ ] cassandra.md, known in cassandra backend .... saw it in error, caused by renaming markdown file for benchmark
  • [reboot] Add dev log and roadmap

    [reboot] Add dev log and roadmap

    It's been a while since I worked on xephon ... a lot has changed except the fact I never finish the projects I started ... Anyway, even go.ice is start being maintained, so xephon-k should get revived as well. Also there are more tsdb written in go now.

    TODO

    • [ ] init log to recap what has been done in xephon-k (good old grad school memories)
    • [ ] start playground to test missed things
      • [ ] consistent hashing
      • [ ] serialize inverted index (was building from scratch every time)
      • [ ] compress inverted index
      • [ ] more general data model, druid, piont
      • [ ] compaction
      • [ ] different transport, grpc was never really supported
      • [ ] tcp based line protocol
      • [ ] different compression (existing, RLE, delta RLE are too simple ...)
      • [ ] consider use tree for aggregation
    • [ ] clean up old codebase, I think most of them are no longer useful in the new code base beyond reference ...
    • [ ] a spec for implementation in other language especially java, c++

    Dependencies

    • [ ] reboot awesome-tsdb, it's been dead for even longer .... my ‘I will finish it next week' is still there ...
    • [ ] go.ice, gommon need to change accordingly, with dep it should be much easier using replace directive

    A MVP would be

    • [ ] store in memory, inverted index + series
    • [ ] WAL (I still don't think WAL is that useful for large volume similar time series data), but adding WAL is much harder than remove it ... so this time, do things in right order
    • [ ] compaction
    • [ ] use consistent hashing to shard series by meta (tags)
  • [mem] In memory store for data

    [mem] In memory store for data

    Related https://github.com/libtsdb/libtsdb-go/issues/1 Closed columnar format in memory https://github.com/xephonhq/xephon-k/issues/49 original tracker https://github.com/xephonhq/xephon-k/issues/3

    • [ ] review old in memory store
    • don't care too much about read performance when filter
    • [ ] try to keep it in sync with libtsdb, though having copy in client side between different protocol is not a big issue ...
    • [ ] try with large amount of data, maybe larger than 4GB, to see if it still works
      • https://github.com/allegro/bigcache
    • [ ] might use custom map implementation, default map is not that good ...
  • [go][dep] Init new codebase

    [go][dep] Init new codebase

    Like Xephon-B, it should make use of go.ice and libstdb-go, might need to adjust go.ice and gommon along the way ...

    • old codebase will be kept, we will start a new package called xk which is just another name of pkg, it's better than pkgv2 ...
      • simply ask dep to ignore the pkg package would work I suppose
    • [ ] empty cmd for server
    • [ ] grpc server
    • [ ] http server
    • [ ] simple in memory storage
  • Clean up code for BenchHub

    Clean up code for BenchHub

    Major issues

    • benchmark related code will be split into libstdb-go and xephon-b
    • #62 move collector somewhere else, might be benchhub, or gommon
    • add tracing on server side to know where is our hot spot
    • use go.ice as server framework

    TODO

    • [x] group and clean up old issues, a new tag pre-benchhub should be added
    • [ ] make the cassandra backend work again, it should be very easy without rich tag support
    • [ ] recap the column store, it should support read at least
      • [ ] the inverted index can just be kept in memory and rebuilt when start, I don't think there is time to deal with high carnality
      • might take the time and port it to gegecece ...
Object detection on multiple datasets with an automatically learned unified label space.
Object detection on multiple datasets with an automatically learned unified label space.

An object detector trained on multiple large-scale datasets with a unified label space; Winning solution of ECCV 2020 Robust Vision Challenges.

Dec 30, 2022
A tool for building identical machine images for multiple platforms from a single source configuration
A tool for building identical machine images for multiple platforms from a single source configuration

Packer Packer is a tool for building identical machine images for multiple platforms from a single source configuration. Packer is lightweight, runs o

Oct 3, 2021
Fast (linear time) implementation of the Gaussian Blur algorithm in Go.
Fast (linear time) implementation of the Gaussian Blur algorithm in Go.

Song2 Fast (linear time) implementation of the Gaussian Blur algorithm in Go.

Oct 25, 2022
🚀 fgprof is a sampling Go profiler that allows you to analyze On-CPU as well as Off-CPU (e.g. I/O) time together.
🚀 fgprof is a sampling Go profiler that allows you to analyze On-CPU as well as Off-CPU (e.g. I/O) time together.

?? fgprof - The Full Go Profiler fgprof is a sampling Go profiler that allows you to analyze On-CPU as well as Off-CPU (e.g. I/O) time together. Go's

Dec 31, 2022
FlyML perfomant real time mashine learning libraryes in Go

FlyML perfomant real time mashine learning libraryes in Go simple & perfomant logistic regression (~100 LoC) Status: WIP! Validated on mushrooms datas

May 30, 2022
Another AOC repo (this time in golang!)

advent-of-code Now with 100% more golang! (It's going to be a long advent of code...) To run: Get your data for a given year/day and copy paste it to

Dec 14, 2021
Load configuration in cascade from multiple backends into a struct
Load configuration in cascade from multiple backends into a struct

Confita is a library that loads configuration from multiple backends and stores it in a struct. Supported backends Environment variables JSON files Ya

Jan 1, 2023
a key-value store with multiple backends including leveldb, badgerdb, postgresql

Overview goukv is an abstraction layer for golang based key-value stores, it is easy to add any backend provider. Available Providers badgerdb: Badger

Jan 5, 2023
The Prometheus monitoring system and time series database.

Prometheus Visit prometheus.io for the full documentation, examples and guides. Prometheus, a Cloud Native Computing Foundation project, is a systems

Dec 31, 2022
VictoriaMetrics: fast, cost-effective monitoring solution and time series database
VictoriaMetrics: fast, cost-effective monitoring solution and time series database

VictoriaMetrics VictoriaMetrics is a fast, cost-effective and scalable monitoring solution and time series database. It is available in binary release

Jan 8, 2023
The Prometheus monitoring system and time series database.

Prometheus Visit prometheus.io for the full documentation, examples and guides. Prometheus, a Cloud Native Computing Foundation project, is a systems

Dec 31, 2022
Time Series Database based on Cassandra with Prometheus remote read/write support

SquirrelDB SquirrelDB is a scalable high-available timeseries database (TSDB) compatible with Prometheus remote storage. SquirrelDB store data in Cass

Oct 20, 2022
LinDB is an open-source Time Series Database which provides high performance, high availability and horizontal scalability.
LinDB is an open-source Time Series Database which provides high performance, high availability and horizontal scalability.

LinDB is an open-source Time Series Database which provides high performance, high availability and horizontal scalability. LinDB stores all monitoring data of ELEME Inc, there is 88TB incremental writes per day and 2.7PB total raw data.

Jan 1, 2023
TalariaDB is a distributed, highly available, and low latency time-series database for Presto
TalariaDB is a distributed, highly available, and low latency time-series database for Presto

TalariaDB is a distributed, highly available, and low latency time-series database that stores real-time data. It's built on top of Badger DB.

Nov 16, 2022
🤔 A minimize Time Series Database, written from scratch as a learning project.
🤔 A minimize Time Series Database, written from scratch as a learning project.

mandodb ?? A minimize Time Series Database, written from scratch as a learning project. 时序数据库(TSDB: Time Series Database)大多数时候都是为了满足监控场景的需求,这里先介绍两个概念:

Jan 3, 2023
Export output from pg_stat_activity and pg_stat_statements from Postgres into a time-series database that supports the Influx Line Protocol (ILP).

pgstat2ilp pgstat2ilp is a command-line program for exporting output from pg_stat_activity and pg_stat_statements (if the extension is installed/enabl

Dec 15, 2021
Get any cryptocurrencies ticker and trade data in real time from multiple exchanges and then save it in multiple storage systems.
Get any cryptocurrencies ticker and trade data in real time from multiple exchanges and then save it in multiple storage systems.

Cryptogalaxy is an app which will get any cryptocurrencies ticker and trade data in real time from multiple exchanges and then saves it in multiple storage systems.

Jan 4, 2023
S3pd - CLI utility that downloads multiple s3 objects at a time, with multiple range-requests issued per object

S3 Parallel Downloader CLI utility that downloads multiple s3 objects at a time,

May 13, 2022
Open source framework for processing, monitoring, and alerting on time series data

Kapacitor Open source framework for processing, monitoring, and alerting on time series data Installation Kapacitor has two binaries: kapacitor – a CL

Dec 24, 2022
Open Source HTTP Reverse Proxy Cache and Time Series Dashboard Accelerator
Open Source HTTP Reverse Proxy Cache and Time Series Dashboard Accelerator

Trickster is an HTTP reverse proxy/cache for http applications and a dashboard query accelerator for time series databases. Learn more below, and chec

Jan 2, 2023