Skip to content

Establish Benchmark Suite for OTel Exporter & Memory Pressure Analysis #78

Description

@goh-chunlin

Description:

To improve the performance profile of the simulation engine and ensure we are maintaining timing integrity, we need to baseline the current OpenTelemetry export logic. Currently, the telemetry path may be inducing unnecessary heap allocations and GC pressure during simulation cycles.

Goal:

Integrate BenchmarkDotNet to capture a baseline of the current OTel exporter latency and memory allocation per event.

  1. Create the Project: Just run dotnet new console -n SimNextgenApp.Benchmarks in the solution folder. It does NOT need to be part of your main build pipeline yet and you can keep it as a standalone tool to probe your core engine;
  2. Add the dependency: dotnet add SNA.Benchmarks package BenchmarkDotNet;
  3. Add the reference: dotnet add SNA.Benchmarks reference SimNextgenApp/SimNextgenApp.csproj;
  4. Telemetry Baseline: Create a benchmark class OTelExporterBenchmarks that measures the serialisation and export latency of the current implementation;
    • Target the method that serialises and sends the OTel data;
    • Make sure to use the [MemoryDiagnoser] attribute on the class because that is the one that will show us the "Allocated" bytes, the smoking gun that will prove to us why a Ring Buffer is necessary.
  5. Metrics to Track: - Mean execution time;
    • Allocated (Memory per operation);
    • Gen 0/1/2 collections (to observe GC impact).
  6. Baseline Target: Benchmark against a mock stream of 10k events to simulate realistic pressure.

We need empirical data to prove the performance impact of our current telemetry approach. This baseline will serve as the reference for future refactors and help us identify if the current OTel path is the root cause of observed timing jitter.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions