Replies: 2 comments
-
What's your thoughts? @open-telemetry/cpp-approvers @open-telemetry/cpp-maintainers |
Beta Was this translation helpful? Give feedback.
-
Finally hade some time playing around with HTTP(both json & binary/protobuf) as well as gRPC. Just as you say @owent going from json => binary makes a huge difference as Nlohmann json serialization is slow. But what surprises me is that gRPC is 2x - 3x slower then HTTP with protobuf. It is built with ENABLE_ASYNC_EXPORT. But even if gRPC is slower compared to HTTP with protobuf. HTTP/protobuf is not fast enough either. I still think the Exporter should work with a backgrounds thread(or multiple). For instance as soon as: I have looked into writing my own Exporter and using Boost Asio Beast for the HTTP requests and the Boost Asio IO context in the background thread. Similar approach for gRPC. But with asio-grpc. But when looking into the Exporter SDK I noticed there are 3 different base classes(SpanExporter, LogRecordExporter & PushMetricExporter) are very similar. Any reason for separating all Exporters like this? Shouldn't the Exporters be more connected to the transport mechanism and more or less transparent to what they really are exporting/transporting? Maybe this should be another discussion thread. |
Beta Was this translation helpful? Give feedback.
-
I have been testing traces, metrics & logs http exporter. I started out testing the trace Exporter over HTTP. First without ENABLE_ASYNC_EXPORT turned on. It was a no go for out heavy asynchronous application(powered by Boost Asio). Enabling ENABLE_ASYNC_EXPORT did partly the trick. Still quite slow & heavy on the CPU side.
I recently started testing the HTTP exporter for logging. Been using Boost Logging for a long time and it is decent when it comes to performance. Using a different sinks running as backends(background thread).
So, I started out turning ENABLE_ASYNC_EXPORT on from start. First I compared the OStreamLogRecordExporter with the OtlpHttpLogRecordExporter. With Curl running asynchronously it shouldn't really be much difference. Right? Well it is. A factor 7-8x slower. I started looking into the code and Nlohmann json is known for slow serialization. Switching to binary/protobuf did some improvements. But still functions like createSession, addSession, ... in OtlpHttpClient are quite heavy and will affect the "main thread"
I then tried the same approach as Boost Logging. Doing as much as possible in a background thread directly in OtlpHttpLogRecordExporter::Export as soon as you have the "proto::collector::logs::v1::ExportLogsServiceRequest service_request". Dispatch it in a thread safe queue to a background thread and let it handle the rest.
Sure I guess performance boost can be achieved by switching Curl to something faster. But this is a rather easy change in current code and as OtlpHttpLogRecordExporter::Export already are returning "return opentelemetry::sdk::common::ExportResult::kSuccess;" directly it shouldn't change the behaviour.
Comments on my thoughts?
Beta Was this translation helpful? Give feedback.
All reactions