Code Monkey home page Code Monkey logo

cacheserver's Introduction

Cacheserver

  • in memory tsdb

Capability

  • store 20M series with 2 hours data in memory (use less than 100GB memory)

Architecture

How to Build && Run

go get -u -v github.com/n4mine/cacheserver
cd $GOPATH/github.com/n4mine/cacheserver
make

./cacheserver

How to Push && Get data

For debug/development

Push data

use series1 as name

curl -s -XPOST "http://127.0.0.1:7000/pushdata?name=series1&ts=$(date +%s)&value=$(shuf -i 0-100 -n1)"

Get data info

curl -s 'http://127.0.0.1:7000/getinfo?name=series1'

resp:

{
  "duration": 28,
  "newest": 1567001322,
  "oldest": 1567001294
}

Get data

curl -s 'http://127.0.0.1:7000/getdata?name=series1&from=1567001294&to=1567001322'

resp:

{
  "1567001294": 10,
  "1567001295": 23,
  "1567001296": 14,
  "1567001319": 25,
  "1567001320": 69,
  "1567001321": 66,
  "1567001322": 71
}

For production

type DataResp struct {
	// code == 0, normal
	// code >  0, exception
	Code int    `msg:"code"`
	Msg  string `msg:"msg"`
	Key  string `msg:"key"`
	From int64  `msg:"from"`
	To   int64  `msg:"to"`
	Step int    `msg:"step"`
	RRA  int    `msg:"rra"`
	Data []Iter `msg:"data"`
}

type Iter struct {
	*tsz.Iter
}

cacheserver's People

Contributors

dependabot[bot] avatar n4mine avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.