29
TSDB INFLUXDB A TIME SERIES DATABASE Created by / Gianluca Arbezzano @GianArb

Time series database, InfluxDB & PHP

Embed Size (px)

DESCRIPTION

Time series database, InfluxDB and monitoring PHP applications

Citation preview

Page 1: Time series database, InfluxDB & PHP

TSDBINFLUXDB A TIME SERIES DATABASE

Created by / Gianluca Arbezzano @GianArb

Page 2: Time series database, InfluxDB & PHP

TSDBTIME SERIES DATABASE

It is a software system that is optimized for handling time seriesdata, arrays of numbers indexed by time (a datetime or a

datetime range)

Page 3: Time series database, InfluxDB & PHP

LEARN STARTUPEric Ries

The Lean Startup: How Today's Entrepreneurs Use ContinuousInnovation to Create Radically Successful Businesses

Page 4: Time series database, InfluxDB & PHP

TIME SERIES DATAA time series is a sequence of data points, measured typically at

successive points in time spaced at uniform time intervals

Page 5: Time series database, InfluxDB & PHP

OTHER POSSIBILITYGoogle AnalyticsAmazon CloudWatch...

Page 6: Time series database, InfluxDB & PHP

INFLUXDB

An open-source distributed time series database with noexternal dependencies

Page 7: Time series database, InfluxDB & PHP

it is written in Golang

wget http://s3.amazonaws.com/influxdb/influxdb_latest_amd64.debsudo dpkg -i influxdb_latest_amd64.deb

Docs

Page 8: Time series database, InfluxDB & PHP

WHY?Real timeEasyScalableHttp api & Client(php, python, ruby...)Single source

Page 9: Time series database, InfluxDB & PHP

OPEN SOURCE

Github

Page 10: Time series database, InfluxDB & PHP

GRAFANA

An open source, feature rich metrics dashboard and graph editorfor Graphite, InfluxDB & OpenTSDB.

Page 11: Time series database, InfluxDB & PHP

GETTING STARTEDcurl -X POST -d '[ { "name" : "hd_used", "columns" : ["value", "host", "mount"], "points" : [ [23.2, "serverA", "/mnt"] ] } ]' 'http://localhost:8086/db/mydb/series?u=root&p=root'

Page 12: Time series database, InfluxDB & PHP

MORE POINTS FOR INSERT[ { "name": "log_lines", "columns": ["time", "sequence_number", "line"], "points": [ [1400425947368, 1, "this line is first"], [1400425947368, 2, "and this is second"] ] }]

Page 13: Time series database, InfluxDB & PHP

IMPLEMENT UDPPROTOCOL

[input_plugins.udp] enabled = true port = 4444 database = "search"

InfluxDB is down? Your APP works!

Page 14: Time series database, InfluxDB & PHP

BENCHMARK UDP VS TCPCorley\Benchmarks\InfluxDB\AdapterEvent Method Name Iterations Average Time Ops/second ------------------------ ------------ -------------- ------------- sendDataUsingHttpAdapter: [1,000 ] [0.0026700308323] [374.52751] sendDataUsingUdpAdapter : [1,000 ] [0.0000436344147] [22,917.69026]

Page 15: Time series database, InfluxDB & PHP

QUERYcurl 'http://localhost:8086?u=root&p=root&q=select * from log_lines limit 1'

[ { "name": "log_lines", "columns": ["time", "sequence_number", "line"], "points": [ [1400425947368, 287780001, "here's some useful log info"] ] }]

Page 16: Time series database, InfluxDB & PHP

ADMIN PANEL:8083

Page 17: Time series database, InfluxDB & PHP

FEATURESCreate databaseManage usersQuery and Graphs

Page 18: Time series database, InfluxDB & PHP

GRAFANAIs an Javascript DashboardOpenSource

Drag and drop panelsClick and select region to zoomBars, Lines, PointsMix lines, bars and pointsInfluxDB query editorAnnotation lines

Page 19: Time series database, InfluxDB & PHP

ANNOTATIONS?!

You can mark deploy and monitoring differences between twoversions

Page 20: Time series database, InfluxDB & PHP

CORLEY/INFLUXDB-PHP-SDKAnother influxdb SDK written in PHP

Page 21: Time series database, InfluxDB & PHP

INSTALLphp composer.phar require corley/influxdb-sdk:dev-master

Page 22: Time series database, InfluxDB & PHP

ADAPTER SYSTEMVery flexible

UDP AdapterGuzzle AdapterYour implementation..

Page 23: Time series database, InfluxDB & PHP

CREATE CLIENT$options = new \InfluxDB\Options();$adapter = new \InfluxDB\Adapter\UdpAdapter($options);

$client = new \InfluxDB\Client();$client->setAdapter($adapter);

Page 24: Time series database, InfluxDB & PHP

FACTORY PATTERN$options = [ "adapter" => [ "name" => "InfluxDB\\Adapter\\GuzzleAdapter", "options" => [ // guzzle options ], ], "options" => [ "host" => "my.influx.domain.tld", ], "filters" => [ "query" => [ "name" => "InfluxDB\\Filter\\ColumnsPointsFilter" ], ],];$client = \InfluxDB\ClientFactory::create($options);

Page 25: Time series database, InfluxDB & PHP

MARK YOUR EVENT$client->mark("error.404", ["page" => "/a-missing-page"]);$client->mark("app.search", $points, "s");

Page 26: Time series database, InfluxDB & PHP

QUERY$influx->query("select * from mine");$influx->query("select * from mine", "s");

$client->setFilter(new ColumnsPointsFilter());$data = $client->query("select * from hd_used");

Page 27: Time series database, InfluxDB & PHP

THE KEY OF MEASURE

GitHub - Making MySql Better at GitHub

Page 28: Time series database, InfluxDB & PHP

RICHARD FEYNMAN - THE KEY TO SCIENCE

1. Guess2. Compute Consequences3. Compare with experiment/experience

"IF IT DISAGREES WITH EXPERIMENT, IT’S WRONG"

Page 29: Time series database, InfluxDB & PHP

FUTUREStar 12 Star this project

Use it and help us with your issues & PR