mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Bench inline protocol conversion
This commit is contained in:
16
README.md
16
README.md
@@ -284,3 +284,19 @@ Corley\Benchmarks\InfluxDB\AdapterEvent
|
||||
sendDataUsingUdpAdapter : [1,000 ] [0.0000890662670] [11,227.59529]
|
||||
```
|
||||
|
||||
### Message to inline protocol conversion
|
||||
|
||||
As you know the SDK will provide a single interface in order to send data to
|
||||
InfluxDB (concise or expanded).
|
||||
|
||||
The impact of message to inline protocol conversion is:
|
||||
|
||||
```
|
||||
Corley\Benchmarks\InfluxDB\MessageToInlineProtocolEvent
|
||||
Method Name Iterations Average Time Ops/second
|
||||
---------------------------------------------------- ------------ -------------- -------------
|
||||
convertMessageToInlineProtocolWithNoTags : [10,000 ] [0.0000230122805] [43,455.05877]
|
||||
convertMessageToInlineProtocolWithGlobalTags : [10,000 ] [0.0000301691532] [33,146.43911]
|
||||
convertMessageToInlineProtocolWithDifferentTagLevels: [10,000 ] [0.0000327563763] [30,528.40741]
|
||||
```
|
||||
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
namespace Corley\Benchmarks\InfluxDB;
|
||||
|
||||
use Athletic\AthleticEvent;
|
||||
use InfluxDB\Adapter\UdpAdapter;
|
||||
use InfluxDB\Options;
|
||||
|
||||
class MessageToInlineProtocolEvent extends AthleticEvent
|
||||
{
|
||||
private $method;
|
||||
private $object;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$object = new UdpAdapter(new Options());
|
||||
$reflection = new \ReflectionClass(get_class($object));
|
||||
$method = $reflection->getMethod("serialize");
|
||||
$method->setAccessible(true);
|
||||
|
||||
$this->method = $method;
|
||||
$this->object = $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* @iterations 10000
|
||||
*/
|
||||
public function convertMessageToInlineProtocolWithNoTags()
|
||||
{
|
||||
$this->method->invokeArgs($this->object, [
|
||||
[
|
||||
"points" => [
|
||||
[
|
||||
"measurement" => "vm-serie",
|
||||
"fields" => [
|
||||
"cpu" => 18.12,
|
||||
"free" => 712423,
|
||||
],
|
||||
],
|
||||
]
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @iterations 10000
|
||||
*/
|
||||
public function convertMessageToInlineProtocolWithGlobalTags()
|
||||
{
|
||||
$this->method->invokeArgs($this->object, [
|
||||
[
|
||||
"tags" => [
|
||||
"dc" => "eu-west-1",
|
||||
],
|
||||
"points" => [
|
||||
[
|
||||
"measurement" => "vm-serie",
|
||||
"fields" => [
|
||||
"cpu" => 18.12,
|
||||
"free" => 712423,
|
||||
],
|
||||
],
|
||||
]
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @iterations 10000
|
||||
*/
|
||||
public function convertMessageToInlineProtocolWithDifferentTagLevels()
|
||||
{
|
||||
$this->method->invokeArgs($this->object, [
|
||||
[
|
||||
"tags" => [
|
||||
"dc" => "eu-west-1",
|
||||
],
|
||||
"points" => [
|
||||
[
|
||||
"measurement" => "vm-serie",
|
||||
"tags" => [
|
||||
"server" => "tc12",
|
||||
],
|
||||
"fields" => [
|
||||
"cpu" => 18.12,
|
||||
"free" => 712423,
|
||||
],
|
||||
],
|
||||
]
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user