Bench inline protocol conversion

This commit is contained in:
Walter Dal Mut
2015-06-10 14:28:29 +02:00
parent f95e32e150
commit f185935e32
2 changed files with 108 additions and 0 deletions

View File

@@ -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]
```

View File

@@ -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,
],
],
]
]
]);
}
}