GithubHelp home page GithubHelp logo

influxdb-cache's Introduction

InfluxDB Cache

This package is a simple reverse-proxy* that split an InfluxDB request into smaller cacheable pieces.

This package is still in development and is not yet suitable to production workloads.

Also You might want to use a reverse proxy such as Nginx in front of this to filter all queries that are not /queries (And all post queries) as those are not supported yet.

Why not use Continuous Queries ?

Continuous queries are fine. But they are not flexible at all... Also they do not solve as much problems as caching does.

How does it work ?

When making a request to the cache, the request is being parsed and split in several pieces:

SELECT mean(cpu) FROM cpu WHERE time > now() - 6h GROUP BY time(10s)

This request can be split across it's time range in smaller pieces. This allows us to cache those small pieces and re-use them in a following request.

Each cacheable piece only depends on the defined aggregation time. This means that every time the request is sent, most of the underlying pieces will match existing ones. Of course the first and last pieces will often be uncacheable.

// svg // Showing a request, it's time range and where the request is beeing separated.

Ideal infrastructure

Keep in mind that using this package adds at least 2 layers between your client and InfluxDB.

I would also suggest to have all 3 proxy layers on the same machine.

NGINX -> Cacher -> Varnish -> InfluxDB

See examples directory for VCL example file.

Configuration

TODO

  • If none of statements in the query is cacheable don't Unmarshall anything
  • Handle no result influxdb errors
  • Check Time zone issue (if it really is there)
  • Request parallelization
  • Better logging system
  • Handle errors and status codes
  • Proxy headers in both ways ?
  • Use initial time boundaries (now() and stuff) instead of always replacing it (Open to discussion)
  • Rethink the Chunksize (Probably using a non-linear function of group-by-interval)

influxdb-cache's People

Contributors

corentingi 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.