Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pkg/stanza/fileconsumer] Reduce noise in benchmark (open-telemetry#3…
…1516) This PR reworks the end-to-end benchmark in `pkg/stanza/fileconsumer`. The primary goal is to surface a more accurate representation of performance within the benchmark. Several factors were leading to artificial delays which I believe may have drowned out actual impacts. Three significant sources of noise were mitigated: 1. Every log read was passed to a channel. This caused us to measure lot of time waiting for channels. Now, we only signal when the file is fully consumed. 2. Every line was generated on the fly. Now we generate a set of lines ahead of time and write these over and over. 3. Each line was written to file independently. Now we group the pre-generated lines write them all at once. We also write longer lines so that much more content is written per call. The overall result is a substantially clearer CPU profile and a slightly clearer memory profile. CPU Profile Before <img width="860" alt="image" src="https://github.com/open-telemetry/opentelemetry-collector-contrib/assets/5255616/a8bcd396-8c4a-4dcb-8c0b-0a3cbc852a86"> CPU Profile After <img width="859" alt="image" src="https://github.com/open-telemetry/opentelemetry-collector-contrib/assets/5255616/14ee9a7b-af2f-4df5-a8a5-10cb8830c9b6"> Memory Profile Before <img width="859" alt="image" src="https://github.com/open-telemetry/opentelemetry-collector-contrib/assets/5255616/86604420-754b-43f2-a143-39f60faed9d8"> Memory Profile After <img width="860" alt="image" src="https://github.com/open-telemetry/opentelemetry-collector-contrib/assets/5255616/6752be62-2d73-4f9d-bcea-aa5835cce601"> Additionally, this adds a new benchmark to cover a scenario with many (100) files. Finally, it reduces the time to run the benchmark from ~30s to ~20s.
- Loading branch information