diff --git a/README.md b/README.md index adabeb480..e92f50a07 100644 --- a/README.md +++ b/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] +``` + diff --git a/benchmarks/Benchmarks/InfluxDB/MessageToInlineProtocolEvent.php b/benchmarks/Benchmarks/InfluxDB/MessageToInlineProtocolEvent.php new file mode 100644 index 000000000..4bfce6ee9 --- /dev/null +++ b/benchmarks/Benchmarks/InfluxDB/MessageToInlineProtocolEvent.php @@ -0,0 +1,92 @@ +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, + ], + ], + ] + ] + ]); + } +}