1+ ## Introduction
2+
13The idea is to record the wire messages of the profiling agent and see how well they compress using different
24compressors and what the CPU impact is.
35
@@ -7,25 +9,49 @@ This will write the wire messages into the given directory. The directory will b
79You can then use the ` protobench ` tool to compress the wire messages and see how well they compress and how much
810CPU time it takes to compress them.
911
10- To run the profiling agent, first have a receiving endpoint, e.g. ` devfiler ` listening on localhost:11000.
11- Then run the profiling agent with the ` -reporter-save-outputs-to ` flag:
12+ ### Recording wire messages
13+
14+ Make sure you have a receiving endpoint, e.g. ` devfiler ` listening on localhost:11000.
15+ Now run the profiling agent with the ` -reporter-save-outputs-to ` flag:
1216``` shell
1317sudo ./opentelemetry-ebpf-profiler -reporter-save-outputs-to=/tmp/protobuf -collection-agent=127.0.0.1:11000 -disable-tls
1418```
1519The wire messages are written to ` protobuf/ ` , one file per message.
1620
17- To compress the wire messages and generate a bar chart, run the ` protobench ` tool:
21+ ### Benchmark compression of wire messages
22+
23+ In reality, the previously recorded wire messages are sent compressed over the network.
24+ Compression efficiency and CPU usage are important factors to consider when choosing a compression algorithm.
25+
26+ The ` protobench ` tool helps to compare compression algorithms and their performance:
27+ - for realistic results, wire messages are compressed one-by-one
28+ - different compressors with different compression levels are used
29+ - the compression ratio and CPU usage are measured
30+ - the results are written as a bar chart or a CSV file
31+
32+ To compress the wire messages and generate a bar chart, run the ` protobench ` tool with an output file ending in ` .png ` :
1833``` shell
1934cd tools/protobench
2035go run ./... -bench-proto-dir=/tmp/protobuf -output-file=results.png
2136```
2237If you don't see any errors, the tool will generate a PNG file with a bar chart showing the compression ratio and
23- compression time for each compressor.
38+ CPU usage for each compressor/level .
2439The extension ` .csv ` can be used to generate a CSV file with the raw data instead of a PNG file.
2540No ` -output-file ` flag will display the results in the terminal.
2641
2742Of course, you can also use the ` protobench ` tool to compare compression of any other files.
2843
44+ ### Reproducible reporter outputs
45+
46+ The profiling agent supports recording and replaying reporter inputs with the ` -reporter-record-inputs-to ` and
47+ ` -reporter-replay-inputs-from ` flags.
48+
49+ Replaying in combination with ` -reporter-save-outputs-to ` generates a (nearly) reproducible set of wire messages,
50+ which be easily compared with the ` protobench ` tool. This can be useful for comparing different implementations of
51+ the reporter or the wire protocol.
52+
53+ Generated inputs can be shared for CI, benchmarking, development, testing or debugging purposes.
54+
2955### Example PNG output
3056
3157![ Example output] ( example.png )
0 commit comments