cacheserver

command module
v0.0.0-...-7d175ed Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2023 License: AGPL-3.0 Imports: 12 Imported by: 0

README

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
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL