Influx DB and PHP implementation

06 Jan 2015 - Tags: php, influxdb, monitoring, corley, monitoring, open source

Influx DB is time series database written in Go.

It supports SQL like queries and it has different entry points, REST API (tcp protocol) and UDP.

We wrote a sdk to manage integration between Influx and PHP.

It supports Guzzle Adapter but if you use Zend\Client you can write your implementation.

$guzzle = new \GuzzleHttp\Client();

$options = new Options();
$adapter = new GuzzleAdapter($guzzle, $options);

$client = new Client();

In this case we are using a Guzzle Client, we communicate with Influx in TPC, but we can speak with it in UDP

$options = new Options();
$adapter = new UdpAdapter($options);

$client = new Client();

Both of them have the same usage

$client->mark("", $points, "s");

The first different between udp and tcp is known, TPC after request expects a response, UDP does not expect anything and in this case does not exist any delivery guarantee. If you can accept this stuff this is the benchmark:

Corley\Benchmarks\Influx DB\AdapterEvent
    Method Name                Iterations    Average Time      Ops/second
    ------------------------  ------------  --------------    -------------
    sendDataUsingHttpAdapter: [1,000     ] [0.0026700308323] [374.52751]
    sendDataUsingUdpAdapter : [1,000     ] [0.0000436344147] [22,917.69026]

did you enjoy the article? Buy me a coffe

Buy me a coffeeBuy me a coffee

or share the content